1990_TI_DSP_Applications_Vol_2 1990 TI DSP Applications Vol 2
User Manual: 1990_TI_DSP_Applications_Vol_2
Open the PDF directly: View PDF .
Page Count: 628
Download | |
Open PDF In Browser | View PDF |
~ TEXAS INSTRUMENTS Digital Signal Processing Applications with the TAfS320 Familv 1990 1990 Digital Signal Processor Products DigHa/Signa/Processing Applications with the TMS320 Family Volume 2 Edited by Panos Papam/challs, Ph.D. Digital Signal Processing Semiconductor Group Texas Instruments • TEXAS INSTRUMENTS IMPORTANT NOTICE Texas Instruments (TI) reserves the right to make changes to or to discontinue any semiconductor product or service identified in this publication without notice. TI advises its customers to obtain the latest version of the relevant information to verify, before placing orders, that the information being relied upon is current. TI warrants performance of its semiconductor products to current specifications in accordance with Tl's standard warranty. Testing and other quality control techniques are utilized to the extent TI deems necessary to support this warranty. Unless mandated by government requirements, specific testing of all parameters of each device is not necessarily performed. TI assumes no liability for TI applications assistance, customer product design, software performance, or infringement of patents or services described herein. Nor does TI warrant or representthat 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. TRADEMARKS ADI and AutoCAD are trademarks of Autodesk, Inc. Apollo and Domain are trademarks of Apollo Computer, Inc. ATVista is a trademark of Truevision, Inc. Code View, MS-Windows, MS, and MS-DOS are trademarks of Microsoft Corp. DEC, DigitalDX, VAX, VMS, and Ultrix are trademarks of Digital Equipment Corp. DGIS is a trademark of Graphic Software Systems, Inc. EPIC, XDS, TlGA, and TlGA-340 are trademarks of Texas Instruments, Inc. GEM is a trademark of Digital Research, Inc. GSS*CGI is a trademark of Graphic Software Systems, Inc. HPGL is a registered trademark of Hewlett-Packard Co. Macintosh and MPWare trademarks of Apple Computer Corp. NEC is a trademark of NEC Corp. PC-DOS, PGA, and Micro Channel are trademarks of IBM Corp. PEPPER is a registered trademark of Number Nine Computer Corp. PM is a trademark of Microsoft Corp. PostScript is a trademark of Adobe Systems, Inc. RTF is a trademark of Microsoft Corp. Sony is a trademark of Sony Corp. Sun 3, Sun Workstation, Sun View, Sun Windows, and SPARC are trademarks of Sun Microsystems, Inc. UNIX is a registered trademark of AT&T Bell Laboratories. Copyright © 1990, Texas Instruments Incorporated CONTENTS FOREWORD....... ...... ........ ... ........................................ ............. ... v PREFACE.......................... ......................................................... vii PART I. INTRODUCTION 1. The TMS320 Family and Book Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. The TMS320 Family of Digital Signal Processors (Kun-Shan Lin, Gene A. Frantz, and Ray Simar, Jr., reprinted from PROCEEDINGS OF THE IEEE, Vol. 75, No.9, September 1987) .......................................................... 11 3. The Texas Instruments TMS320C25 Digital Signal Microcomputer (Gene A. Frantz, Kun-Shan Lin, Jay B. Reimer, and Jon Bradley, reprinted from IEEE Micro Magazine, Vol. 6, No.6, December 1986) .......................................................... : . 29 PART II. DIGITAL SIGNAL PROCESSING INTERFACE TECHNIQUES 4. Hardware Interfacing to the TMS32OC2x (George Troullinos and Jon Bradley) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5. Interfacing the TMS320 Family to the TLC32040 Family (Linear Products - Texas Instruments). ... . .. . .. . . .. . . . . .. . . . . .. . . . .. . . . . . . . . . . . . ... . . . . . . .. 107 6. ICC Requirements of a TMS32OC25 (Dave Zalac) ........................................................................ >. • •• 153 7. An Implementation of a Software UART Using the TMS32OC25 (Dave Zalac). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . .. . . . . . .. . . . . . . . . . . . . . . .. . .. . .. . .... 167 8. TMS32OC17 and TMS370c010 Serial Interface (Peter Robinson). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 189 PART m. DATA COMMUNICATIONS 9. Theory and Implementation of a Splitband Modem Using the TMS32010 (George Troullinos, Peter Ehlig, Raj Chirayil, Jon Bradley, and Domingo Garcia). . .. . . . . .. . .. . .. .. 221 10. Implementation of an FSK Modem Using the TMS32OC17 (Phil Evans and Al Lovrich). .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . .. .. . . . . . ... 331 11. An AIl-Digital Automatic Gain Control (AI Lovrich and Raj Chirayil) ............................................................. 389 PART IV. TELECOMMUNICATIONS 12. General-Purpose Tone Decoding and DTMF Detection (Craig Marven) ....................................................... , . . . . . . . . . . . . . . . . .. 423 PART V. CONTROL 13. Implementation of PID and Deadbeat Controllers with the TMS320 Family (lrfan Ahmed) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 529 iii PART VI. TOOLS 14. TMS320 Algorithm Debugging Techniques (Peter Robinson). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 585 TMS320 BmLIOGRAPHY .................................................................... 597 INDEX .......................................' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 615 iv Foreword Much has happened in the TMS320 Family since Volume 1 of Digital Signal Processing Applications with the TMS320 Family was published, and Volumes 2 and 3 are a timely update to the family history. The DSP microcomputers keep changing the perspective of the systems designers by offering more computational power and better interfacing capabilities. The steps of change are coming more quickly, and the potential impact is greater and greater. Because things change so rapidly in this area, there is a pressing need for ways to quickly learn how to utilize the new technology. These new volumes respond to that need. As with Volume 1, the purpose of these books is to teach us about the issues and techniques that are important in implementing digital signal processing systems using microprocessors in the TMS320 Family. Volume 2 highlights the TMS320C25; and Volume 3, the TMS320C30 chip. A large part of the books is devoted to such matters as characteristics of the TMS320C25 and TMS320C30 chips, useful program code for implementing special DSP functions, and details on interfacing the new chips to external devices. The remainder of the books illustrates how these chips can be used in communications, control, and computer graphics applications. What these two volumes make clear is how remarkably fast the field of DSP microcomputing is evolving. IC technologists and designers are simply packing more and more of the right kind of computing power into affordable microprocessor chips. The high-speed floating-point computing power and huge address spaces of chips like the TMS320C30 open the door to a whole new class of applications that were difficult or impractical with earlier generations offixed-point DSP chips. The signal processing theorists and system designers are clearly being challenged to match the creativity of the chip designers. The present books differ from Volume 1 in the inclusion of a small section on tools. This is a hopeful sign, because it is progress in this area that is likely to have the greatest impact on speeding the widespread apprication of DSP microprocessors. While useful design tools are beginning to emerge, much more can be done to help system designers manage the complexity of sophisticated DSP systems, which often involve a unique combination of theory, numerical and symbolic processing algorithms, real-time programming, and mUltiprocessing. No doubt future volumes of Digital Signal Processing Applications with the TMS320 Family will have more to say about this important topic. Until then, Volumes 2 and 3 have much useful information to help system designers keep up with the TMS320 Family. Ronald W. Schafer Atlanta, Georgia November 14, 1989 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 v vi Digital Signal Processing Applications with the TMS320 Family, Vol. 2 Preface With the advancement of DSP devices, the application of Digital Signal Processing has become more widespread. Areas that were considered outside the domain of DSP devices because of cost, processing power, or peripheral capabilities (such as graphics, control, and consumer products) have seen applications using digital signal processors. On the other hand, the diverse needs of the designer have been addressed in the architectures and the performance of the newer devices. Volume 2 of Digital Signal Processing Applications with the TMS320 Famity contains applications on the first and second generations of the TMS320 Family (fixed-point devices). It is a continuation of Volume 1 in the sense that it addresses the same needs of the designer. The designer still has the task of selecting the DSP device with the appropriate cost, performance, and support, developing the DSP algorithm that will solve his problem, and implementing the algorithm on the processor. This volume tries to help the designer by bringing him up to date in the applications of newer processors or in different applications of earlier processors. The objectives remain the same as in Volume 1. First, the application reports can be used as examples of device use. They can also serve as tutorials in programming the devices. Of course, the same purpose is served on a more elementary basis by the software and hardware applications sections of the corresponding user's guides. Second, since the source code of each application is provided with the report, the designer can take it intact (or extract a portion of it) and place it in his application. It is assumed that the reader has exposure to the TMS320 devices or, at least, has the necessary manuals (such as the appropriate TMS320 user's guides) that will help him understand the explanations in the reports. The reports themselves include as references the necessary background material. Additionally, the Introduction gives a brief overview of the available devices at the time of the writing, and points to sources of more information. The reports are grouped by application area. The term report is used here in a broad sense, since some articles from technical publications are also included. The authors of the reports are either the digital signal processing engineering staff of the Texas Instruments Semiconductor Group (including both field and factory personnel, and summer students) or third parties. The source code associated with the reports is also available in electronic form, and the reader can download it from the TI DSP Electronic Bulletin Board (telephone (713) 274-2323). If more information is needed, the DSP Hotline can be called at (713) 274-2320. The editor wishes to thank all the authors and the reviewers for their contribution to this volume of application reports. Panos E. Papamichalis, Ph.D. Senior Member of Technical Staff Digital Signal Processing Applications with the TMS320 Family, Vol. 2 vii viii Digital Signal Processing Applications with the TMS320 Family, Vol. 2 Part I. Introduction 1. The TMS320 Family and Book Overview 2. The TMS320 Family of Digital Signal Processors (Kun-Shan Lin, Gene A. Frantz, and Ray Simar, Jr., reprinted from PROCEEDINGS OF THE IEEE, Vol. 75, No.9, September 1987) 3. The Texas Instruments TMS320C25 Digital Signal Microcomputer (Gene A. Frantz, Kun-Shan Lin, Jay B. Reimer, and Jon Bradley, reprinted from IEEE Micro Magazine, Vol. 6, No.6, December 1986) 1 2 TMS320 Family and Book Overview Digital signal processors have found applications in areas where they were not even considered a few years earlier. The two major reasons for such proliferation are an increase in processor performance and a reduction in cost. Volume 2 of Digital Signal Processing Applications with the TMS320 Family presents a set of application reports on the first- and second-generation TMS320 devices. Organization of the Book The application reports in this book are grouped by subject area: • • • • Introduction DSP Interface Techniques Data Communications Telecommunications • Control • Tools • Bibliography The Introduction contains this overview and two review articles. The first article gives a general description of the TMS320 family and is reprinted from a special issue of the IEEE Proceedings, while the second article discusses the TMS320C25 device and is reprinted from the IEEE MicroMagazine. The overview points out how the TMS320 family has grown since the two articles were published and also introduces newer devices. The section on DSP Interface Techniques contains articles on interfacing first- and secondgeneration devices with external hardware, such as memories, NO and D/A converters, or microcontroller devices like the TMS370 series. Other articles cover. the implementation of a UART on the TMS320C25 and the power dissipation of the TMS320C25. The three articles in the Data Communications section deal with different aspects of modem implementations. A V.22 design is presented in the first article, a 300-bps FSK modem in the second, and an Automatic Gain Control (AGC) in the third. In all cases, first-generation devices are considered. The following three sections contain one article each. In the Telecommunications section, a generalized tone decoding and DTMF detection method is presented. The Control section article gives insight into the relatively new application of digital signal processors in digital control. In the Tools section, the article describes ways to debug the algorithms with the aid of spreadsheets and other packages. The Bibliography section contains a list of articles mentioning DSP implementations using TMS320 devices. The different titles are listed chronologically and are grouped by subject. The list is not exhaustive, but it gives enough pointers for pursuing practical implementations in representative application areas. Digital Signal Processing Applications with the TMS320 Family, Vol. 2 3 The TMS320 Family of Processors The TMS320 Family of digital signal processors started with the TMS32010 in 1982, but it has been expanded to encompass five generations (at the time of this writing) with devices in each generation. Figure 1 shows this progression through the generations. The TMS320 devices can be grouped in two broad categories: fixed-point and floating-point devices. As implied by Figure 1, the first, second, and fifth generations are the fixed-point devices, while the third and the fourth geAerations (the last one under development) support floating-point arithmetic. Figure 1. TMS320 Family Roadmap Floating-point DSP . Fixed-point DSP ----,-.....,...,--, * 1990 NEWTMS320 TMS320C4x *TMS320C40 TMS320C30 P m *TMS320C30·26~ e f r I f 0 0 p r 5 a C TMS320C1x / m n i e ---",--- P 5 __~_ _ *TMS320C31 TMS320C10, ·14 TMS320C10·25 TMS320C15/E15 TMS320C15·25 TMS320C17/E17 TMS320C14/E14 TMS32020 TMS320C25 TMS320E25 TMS320C25·50 *TMS320C26 *TMS320C50 *TMS320C51 Generation 4 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 The following article, "The TMS320 Family of Digital Signal Processors," by Lin, et. aI., is reprinted from the proceedings of the IEEE and gives an overview of the TMS320 family. Since additional devices have been developed from the time the article was written, this section highlights these newer devices. Table 1 shows a comprehensive list of the currently available TMS320 devices and their salient characteristics. Table 1. TMS320 Family Overview Memory .Gen 1st Device 5th RAM (ns) Integer Integer Integer Integer Intcger Integer Integer 144 144 144 256 256 256 256 256 256 256 TMS320C2S·50. TMS320E25 , TMS320C26 Integer Integer Integer Integer Integer 200 100 80 100 100 544 544 544 544 I.5K TMS320C30' Float Pt 60 TMS320C50. Integer 50 TMS32OC25~ 3rd Integer Integer Integer Time 200 160 280 160 200 . 160 200 160 200 200 TMS320ClO' TMS32OCIO·25 TMS320CIO·14 TMS320EI4 TMS320C15' TMS320C15·25 , TMS320E15' TMS320EI5·25 TMS320CI7 TMS320EI7 TMS32020' 2nd Data Type Cycle t External DMA •* External/lntemai DMA On· Chip ROM EPROM I/O OlT. Chip Parallel Serial 8xl6 8xl6 8xl6 7xl6 8xl6 8><16 8xl6 8xl6 6xl6 6xl6 16xl6 16xl6 16xl6 16xl6 256 128K 128K 128K 128K 128K I I I I 1 2K 4K 16M 16Mx32 8.5K 2K 128K 16x16 4K 4K 4K 4K 4K 4K 4K 4K 4K 4K On· Chip Package Timers 4K 4K 4K 4K 4K 4K 4K 4K 4K 4K 1.5K UK UK DMA 1 4 2 2 1 I DlPIPLCC DlPIPLCC DlPIPLCC CERQUAD DlPIPLCC DlPIPLCC DlP/CERQUAD DlP/CERQUAD DlPIPLCC DlP/CERQUAD t t t t t I I I I 1 PGA PGAlPLCC PGAlPLCC CERQUAD PLCC 2 ~ 2 PGA I t I CLCC For information on military versions of these devices, contact your local 11 sales office . Digital Signal Processing Applications with the TMS320 Family, Vol. 2 5 The additions to the first generation are the TMS320C14 and the TMS320E14; the latter is identical with the former, except that the latter's on-chip program memory is EPROM. The TMS320C141E14 devices have features that make them suitable for control applications. Figure 2 shows the components of these devices. The memory and the CPU are identical to those of the TMS320C151E15, while the peripherals reflect the orientation of the devices toward control. Figure 2. TMS320C14/E14 Key Features 16x16-bit Multiply 32-bitALU Watchdog Timer 32-bitACC 0,1 ,4-bit Shift Timer/Counter 2 16 bit I/O 32-bit P-Reg 2 Auxiliary Registers SERIAL PORT 4 level H/W Stack Event Manager Some of the key features of the TMS320C141E14 are: • 160-ns instruction cycle time • Object-code-compatible with the TMS320C15 • Four 16-bit timers - Two general-purpose timers - One watchdog timer - One baud-rate generator • • • • 16 individual bit-selectable I/O pins Serial port/USART with codec-compatible mode Event manager with 6-channel PWM D/A CMOS technology, 68-pin CERQUAD The additions to the second generation are the TMS320E25, the TMS320C25-50, and the TMS320C26. The TMS320E25 is identical to the TMS320C25, except that the 4K-word on-chip 6 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 program memory is EPROM. Since increased speed is very important for the real-time implementation of certain applications, the TMS320C25-50 was designed as a faster version of the TMS320C25 and has a clock frequency of 50 MHz instead of 40 MHz. The TMS320C26 is a modification of the TMS320C25 in which the program ROM has been exchanged for RAM. The memory space of the TMS320C26 has 1.SK words of on-chip RAM and 256 words of on-chip ROM, making it ideal for applications requiring larger RAM but minimal external memory. A new generation of higher-performance fixed-point processors has been introduced in the TMS320 Family: the TMS320C5X devices. This generation shares many features with the first and the second generations, but it also encompasses significant new features. Figure 3 shows the basic components of the first device in the fifth generation, the TMS320C50. Figure 3. TMS320C50 Key Features Serial Port Timer S/WWaitsts 16x16 Inputs 16x16 Outputs Some of the important features of the TMS320CSO are listed below: • Source code is upward compatible with the TMS320Clx/C2x devices • 50/3S-ns instruction cycle time • 8K words of on-chip program/data RAM • 2K words boot ROM • 544 words of data/program RAM • 128K words addressable total memory • Enhanced general-purpose and DSP-specific instructions • Static CMOS, 84-pin CERQUAD • JTAG serial sClm path Digital Signal Processing Applications with the TMS320 Family, Vol. 2 7 The software and hardware development tools available for the TMS320 family make the development of applications easy. Such tools include assemblers, linkers, simulators, and C compilers for software and evaluation modules, software development boards, and extended development systems for hardware. These tools are mentioned in the following paper by Lin, et. a1. The interested reader can find much more information in additional literature that is published by Texas Instruments and mentioned in the next section. In partiCular, the TMS320 Family Development Support Reference Guide is an excellent source. One important addition to the list of tools is the SPOX operating system, developed by Spectron Microsystems. SPOX permits you to write an application in a high-level language (C) and run it on actual DSP hardware. The operating-system of SPOX hides the details of the interface from you and lets you concentrate on your algorithm while running it at supercomputer speeds on the TMS320C30. References Texas Instruments publishes an extensive bibliography to help designers use the TMS320 devices effectively. Besides user's guides for corresponding generations, there are manuals for the software and the hardware tools. The Development Support Reference Guide is particularly useful because it provides information not only on development tools offered by TI, but also on those produced by third parties. Here is a partial list of the literature available (the literature number is in parentheses): • TMS320 Family Development Support Reference Guide (SPRUOllA) • TMS320Clx User's Guide (SPRU013A) • TMS320C2x User's Guide (SPRU014) • TMS320C3x User's Guide (SPRU031) • TMS320ClxlTMS320C2xAssembly Language Tools User's Guide (SPRU018) • TMS320C30 Assembly Language Tools User's Guide (SPRU035) • TMS320C25 C Compiler Reference Guide (SPRU024) • TMS320C30 C Compiler Reference Guide (SPRU034) • Digital Signal Processing Applications with the TMS320 Family, Volume 1 (SPRA012) • Digital Signal Processing Applications with the TMS320 Family, Volume 3 (SPRA017) You can request this literature by calling the Customer Response Center at 1-800-232-3200, or the DSP Hotline at 1-713-274-2320. Contents of Other Volumes of the Application Book Volume 1 Part I. Digital Signal Processing and the TMS320 Family • Introduction • The TMS320 Family Part II. Fundamental Digital Signal Processing Operations • Digital Signal Processing Routines 8 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 - Implementation of FIR/lIR Filters with the TMS32010{fMS32020 - Implementation of Fast Fourier Transform Algorithms with the TMS32020 - Companding Routines for the TMS32010{fMS32020 - Floating-Point Arithmetic with the TMS32010 - Floating-Point Arithmetic with the TMS32020 - Precision Digital Sine-Wave Generation with the TMS32010 - Matrix Multiplication with the TMS32010 and TMS32020 • DSP Interface Techniques - Interfacing to Asynchronous Inputs with the TMS32010 - Interfacing External Memory to the TMS32010 - Hardware Interfacing to the TMS32020 - TMS32020 and MC68000 Interface Part III. Digital Signal Processing Applications • Telecommunications - Telecommunications Interfacing to the TMS32010 - Digital Voice Echo Canceller with a TMS32020 - Implementation of the Data Encryption Standard Using the TMS32010 - 32K-bit/s ADPCM with the TMS32010 - A Real-Time Speech Subband Coder Using the TMS32010 - Add DTMF Generation and Decoding to DSP-~P Designs • Computers and Peripherals • Speech Coding/Recognition - A single-Processor LPC Vocoder - The Design of an Adaptive Predictive Coder Using a Single-Chip - Digital Signal Processor - Firmware-Programmable C Aids Speech Recognition • Image/Graphics - A Graphics Implementation Using the TMS32020 and TMS34061 • Digital Control - Control System Compensation and Implementation with the TMS32010 Volume 3 Part I. Introduction • Book Overview • The TMS320 Family of DSP • The TMS320C30 Floating-Point DSP Part II. Digital Signal Processing Routines • Implementation of FFT, DCT, and other Transforms on the TMS320C30 • Doublelength Floating-Point Arithmetic on the TMS320C30 • An 8 x 8 Discrete Cosine Transform Implementation on the TMS320C25 and the TMS320C30 • Implementation of Adaptive Filters with the TMS320C25 and TMS320C30 • A Collection of Functions for the TMS320C30 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 9 Part III. DSP Interface Techniques • Hardware Interfacing to the TMS320C30 • TMS320C30 - IEEE Floating-Point Format Converter Part IV. Telecommunications • Implementation of a CELP Speech Coder for the TMS320C30 Using SPOX Part V. Computers • A Digital Signal Processor Based 3-D Graphics System Part VI. Tools • TMS320C30 Applications Board Functional Description 10 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 The TMS320 Family of Digital Signal Processors Kun-Shan Lin Gene A. Frantz Ray Simar, Jr. Digital Signal Processor Products - Semiconductor Group Texas Instruments Reprinted from PROCEEDINGS OF THE IEEE Vol. 75, No.9, September 1987 11 12 The TMS320 Family of Digital Signal Processors The TMS320 Family of Digital Signal Processors KUN-SHAN LIN, MEMBER, RAY SIMAR, JR. IEEE, GENE A. FRANTZ, SENIOR MEMBER, IEEE, AND This paper begins with a discussion of the characteristics of digital signal processing, which are the driving force behind the design of digital signal processors. The remainder of the paper describes the three generations of the TMS320 family of digital signal processors available from Texas Instruments. The evolution in architec- tural design of these processors and key features of each generation of processors are discussed. More detailed information ;5 provided for the TMS320C25 and TMS320C30, the newest members in the family. The benefits and cost-performance tradeoffs of these processors become obvious when applied to digital Signal processing applications, such as telecommunications, data commu· nications, graphics/image processing, etc. DIGITAL SIGNAL PROCESSING CHARACTERISTICS Digital signal processing (DSP) encompasses a broad spectrum of applications. Some application examples include digital filtering, speech vocoding, image processing, fast Fourier transforms, and digital audio [1]-[10]. These applications and those considered digital Signal processing have several characteristics in common: mathematically intensive algorithms, Mathematically Intensive Algorithms From (1), we can see that to generate every y(n), we have to compute N multiplications and additions or sums of products. This computation makes it mathematically intensive, especially when N is large. At this point it is worthwhile to give the FIR filter some physical significance. An FIR filter is a common technique used to eliminate the erratic nature of stock market prices. When the day-to-day closing prices are plotted, it is sometimes difficult to obtain thedesired information, such as the trend of the stock, because of the large variations. A simple way of smoothing the data is to calculate the average closing values of the previous five days. For the new average value each day, the oldest value is dropped and the newest value added. Each daily average value (average (n)) would be the sum of the weighted value of the latest five days, where the weighting factors (a(i)'s) are 1/5.ln equation form, the average is determined by average (n) = ! • dIn - 1) + ! • dIn S S real-time operation, sampled data implementation, system flexibility. + To illustrate these characteristics in this section, we will use the digital filter as an example. Specifically, we will use the Finite Impulse Response (FIR) filter which in the time domain takes the general form of N y(n) = :E ali) • x(n - i) (1) i"'" where yIn) is the output sample at time n, ali) is the ith coefficient orweighting factor, and x(n - i) is the (n - i)th input sample. With this example in mind, we can discuss the various characteristics of digital signal processing: mathematically intensive algorithms, real-time processing, sampled data implementation, and system flexibility. First, let us look at the concept of mathematically intensive algorithms. Manuscript received October 6, 1986; revised March 27, 1987. The authors are with the Semiconductor Group, Texas Instruments Inc., Houston, TX 77521-1445, USA. IEEE Log Number 871&214. !5 • dIn - 3) + +!'d(n-S) S !5 • dIn 2) - 4) (2) where dIn - i) is the daily stock closing price for the (n i)th day. Equation (2) assumes the same form as (1). This is also the general form of the convolution of two sequences of numbers, ali) and xli) [5], [6]. Both FIR filtering and convolution are fundamental to digital signal processing. Rea/-Time Processing In addition to being mathematically intensive, DSP algorithms must be performed in real time. Real time can be defined as a process that is accomplished by the DSP without creating a delay noticeabletothe user. In the stock market example, as long as the new average value can be computed prior to the next day when it is needed, it is considered to be completed in real time. In digital signal processing applications, processes happen fasterthan on adaily basis. In the FIR filter example in (1), the sum of products must ©1989-IEEE. Reprinted, with pennission, from PROCEEDINGS OF THE IEEE; Vol. 75, No.9, pp. 1143-1159; September 1989. The TMS320 Family of Digital Signal Processors 13 be computed usually within hundreds of microseconds before the next sample comes into the system. A second example is in a speech recognition system where a noticeable delay between a word being spoken and being recognized would be unacceptable and not considered realtime; Another example is in image processing, where it is considered real-time if the processor finishes the processing within the !rame update period. If the pixel information cannot be updat~d within the frame update period, problems such as flicker, smearing, or missing information will occur. Sampled Data Implementation, The application must be capable of being handled as a sampled data system in order to be processed by digital processors, such as digital Signal processors. The stock market is an example of a sampled data system. That is, a specific value (c!osing value) is assigned to each sample period or day. Other periods may be chosen such as hourly prices or weekly prices. In an FIR filter as shown in (1), the output y(n) is calculated to be the weighted sum of the previous N inputs. In other words, the input signal is sampled at periodic intervals (lover the sample rate), multiplied by weighting factor a(i), and, then added together to give the output result of y(n). Examples of sampie rates for some typical sampled data applications [2], [4] are shown in Table 1. Table 1 Sample Rates versus Applications Nominal Application Control Sample Rate 1 kHz Speech processing Audio processing 8 kHz 8-10 kHz 40-48 kHz Video frame rate Video pixel rate 14 MHz Telecommunications 30 Hz In a typical DSP application, the processor-must be able to effectively handle sampled data in large quantity and also perform arithmetic computa'tions in realtime. System Flexibility The design of the digital Signal processing system must be flexible enough to allow improvements in the state of the art. We may find out after several weeks of using the average stock price as a means of measuring a particular stock's value that a different method of obtaining the daily information is more suited to our needs, e.g., using different daily weightings, a different number of periods over which to average, or a different procedure for calculating the result. Enough flexibility'in the system must be available to allow for these variations. In 'many of the DSP applications, techniques are still in the developmental phase, and therefore the algorithms tend to change over time. As an example, speech recognition is presently an inexact technique requiring continual algorithmic modification. From this example we can see the need for system flexibility so that the DSP algorithm can be updated. A programmable DSP system can provide this flexibility to the user. 14 HISTORICAL DSP SOLUTIONS Over the past several decades, digital signal processing machines have taken on several evolutions in order to incorporate these characteristics. large mainframe computers were initially used to process signals in the digital domain. Typically, because of state-of-the-art limitations, this was done in nonreal time. As the state of the art advanced, array processors were added to the processing task. Because of their flexibility and speed, array processors have become the accepted solution for the research laboratory, and have been extended to end-applications in many instances. However, integrated circuittechnology has matured, thus allowing for the design of faster microprocessors and microcomputers. As a result, many digital signal processing applications have migrated from the array processor to microprocessor subsystems (i.e., bit-slice machines) to Single-chip integrated circuit solutions. This migration has brought the cost of the DSP solution down to a point that allows pervasive use of the technology. The increased performance of these highly integrated circuits has also expanded DSP applications from traditional telecommunications to graphics/image processing, then to consumer audio processing. A recent development in DSP technology is the singlechip digital signal processor, su~h as the TMS320 family of processors. These processors give the designer a DSP solution with its performance attainable only by the array processors a few years ago. Fig. 1 shows the TMS320 family in graphical form with the y-axis indicating the hypothetical performance and the x-axis being the evolution of the semiconductor processing technology. The first member of the family, the TMS32010, was disclosed to the market in 1982 [11], [12]. It gave the system deSigner the first microcomputer capable of performing five million DSP operations per second (5 MIPS), including the add and multiply functions [13] required in (1). Today there are a dozen spinoffs from the TMS32010 in th~ first generation of the TMS320 family. Some of these devices are the TMS320Cl0, TMS320C15, and TMS320C17 [14]. The second generation of devices include the TMS32020 [15] and TMS320C25 [16]. The TMS320C25 can perform 10 MIPS [16]. In addition, expanded memory space, combined single-cycle multiplyl accumulate operation, multiprocessing capabilities, and expanded 110 functions have given the TMS320C25 a 2 to 4 times performance improvement over its predecessors. The third generation of the TMS320 family of processors, the TMS320C30 [26], [27], has a computational rate of 33 million DSP floating-point operations per second (33 MFlOPS). Its performance (speed, throughput, and precision) has far exceeded the digital Signal processors available today and has reached the level of a supercomputer. It we look closely at the TMS320 family as shown in Fig. 1, we can see that devices in the same generation, such as the TMS320Cl0, TMS320C15, and TMS320C17, are assembly object-code compatible. Devices across generations, such as the TMS320Cl0 and TMS320C25, are assembly sourcecode compatible. Software investment on DSP algorithms therefore can be maintained during the system upgrade. Another point is that since the introduction of the TMS32010, semiconductor processing technology has emerged from 3-l'm NMOS to 2-l'm CMOS'to I-I'm CMOS. The TMS320 Family ofDigital Signal Processors t------ 2.4-l'm NMOS 2.0-l'm CMOS Fig. 1. The TMS320 family of digital signal processors. The TMS320 generations of processors have also taken the same evolution in processing technology. Low power consumption, high performance, and high-density circuit integration are some of the direct benefits of this semiconductor processing evolution. From Fig. 1, it can be observed that various DSP building blocks, such as the CPU, RAM, ROM, 110 configurations, and processor speeds, have been designed as individual modules and can be rearranged or combined with other standard cells to meet the needs of specific applications. Each of the three generations (and future generations) will evolve in the same manner. As applications become more sophisticated, semicustom solutions based on the core CPU will become the solution of choice. An example of this approach is the TMS320C17/E17, which consists of the TMS320C10 core CPU, expanded 4K-word program ROM (TMS320C17) or EPROM (TMS320E17), enlarged data RAM of 256 words, dual serial ports, companding hardware, and a coprocessor interface. Furthermore, as integrated circuit layout rules move into smaller geometry (now at 2 I'm, rapidly going to 1 I'm), not only will the TMS320 devices become smaller in size, but also multiple CPUs will be incorporated on the same device along with application-specific 1/0 to achieve low-cost integrated system solutions. BASIC TMS320 ARCHITECTURE As noted previously, the underlying assumption regarding a digital signal processor is fast arithmetic operations and high throughput to handle mathematically intensive algorithms in real time. In the TMS320 family [11]-[17], [26], [27], this is accomplished by using the following basic concepts: Harvard architecture, extensive pipelining, dedicated hardware multiplier, special DSP instructions, fast instruction cycle. The TMS320 Family of Digital Signal Processors These concepts were designed inlO the TMS320 digital signal processors to handle the vast amount of data charac~ teristic of DSP operations, and to allow most DSP operations to be executed in a Single-cycle instruction. Furthermore, the TMS320 processors are programmable devices, providing the flexibility and ease of use of generalpurpose microprocessors. The following paragraphs discuss how each of the above concepts is used in Ihe TMS320 family of devices to make them useful in digital signal processing applications. Harvard Architecture The TMS320 utilizes a modified Harvard architecture for speed and flexibility. In a strict Harvard architecture [18], [19], the program and data memories lie in two separate spaces, permitting a full overlap of instruction fetch and execution. The TMS320 family's modification of the Harvard architecture further allows transfer between program and data spaces, thereby increasing the flexibility of the device. This architectural modification eliminates the need for a separate coefficient ROM and also maximizes the processing power by maintaining two separate bus structures (program and data) for full-speed execution. Extensive Pipelining In conjunction with the Harvard architecture, pipelining is used extensively to reduce the instruction cycle time to its absolute minimum, and to increase the throughput of the processor. The pipeline can be anywhere from two to four levels deep, depending on which processor in the family is used. The TMS320 family architecture uses a two-level pipeline for its first generation, a three-level pipeline for its second generation, and a four-level pipeline for its third generation of processors. This means that the device is processing from two to four instructions in parallel, and each instruction is at a different stage in its execution. Fig. 2 shows an example of a three-level pipeline operation. 15 CLKOUT1 prefetch decode execute N-2 .. N-l Fig. 2. Three-level pipeline operation. In pipeline operation, the prefetch, decode, and execute operations can be handled independently, thus allowing the execution of instructions to overlap. Duringany instruction cycle, three different instructions are active, each at a different stage of completion. For example, as the Nth instruction is being prefetched, the previous (N - 1)th instruction is being decoded, and the previous (N - 2)th instruction is being executed. In general, the pipeline is transparent to the user. (the closing price five days ago) was dropped and a new one (today's closing price) was added. Or, each piece of the old data is delayed or moved one sample period to make room for the incoming most current sample. This delay is the function olthe DMOV instruction. Another special instruction in the TMS32010 is the LTD instruction. It executes the LT, DMOV, and APAC instructions in a single cycle. The LTD and MPY instruction then reduce the number of instruction cycles per FIR filter tap from four to two. In the second-generation TMS320, such as the TMS320C25, two more special instructions have been included (the RPT and MACD instructions) to reduce the number of cycles per tap to one, as shown in the follOWing: RPTK 255 ;REPEAT THE NEXT INSTRUCTION 256 TIMES MACD ;LT, DMOV, MPY, AND APAC (N + 1) Dedicated Hardware Multiplier Fast Instruction Cycle As we saw in the general form of an FIR filter, multipli,cation is an important part of digital signal processing. For each filter tap (denoted by i), a multiplication and an addition must take place. The faster a multiplication can be performed, the higher the performance of the digital signal processor. In general-purpose microprocessors, the multiplication instruction is constructed by a series of additions, ther')fore taking many instruction cycles. In comparison, tA..bit words of on-chip program ROM and 544 16-bit words of on·chip data RAM. The RAM is divided into three separate Blocks (BO, B1, and B2). Ofthe544words, 256words (block BO) are configurable as either data or program memo ory by CNFD (configure data memory) or CNFP (configure program memory) instructions provided for that purpose; 288 words (blocks B1 and B2) are always data memory. A data memory size of 544 words allows the TMS320C25 to handle a data array of 512 words while still leaving 32 loca· tions for intermediate storage. The TMS320C25 provides 64K words of off-chip directly addressable data memory space as well as a 64K-word off-chip program memory space. A register file containing eight Auxiliary Registers (AROAR7), which are used for indirect addressing of data memory and for temporary storage, increase the flexibility and efficiency of the device. These registers may be either directly addressed by an instruction or indirectly addressed by a 3·bit Auxiliary Register Pointer (ARP). The auxiliary regIsters and the ARP may be loaded from either data memory or by an immediate operand defined in the instruction. The contents of these registers may also be stored into data memory. The auxiliary register file is connected to the Auxiliary Register Arithmetic Unit (ARAU). Using the ARAU accessing tables of information does not require the CALU for address manipulation, thus freeing it for other operations. Central Arithmetic Logic Unit (CALU): The CALU contains a 1f>..bit scaling shifter, a 16 x 1f>..bit parallel multiplier, a 32bit Arithmetic Logic Unit (AW), and a 32-bit accumulator. The scaling shifter has a 1f>..bit input connected to the data bus and a 32-bit output connected to the ALU. This shifter produces a left-shift of 0 to 16 bits on the input data, as programmed in the instruction. Additional shifters at the outputs of both the accumulator and the multiplier are suitable for numerical scaling, bit extraction, extended-precision arithmetic, and overflow prevention. The following steps occur in the implementation of a typo ical ALU instruction: 1) Data are fetched from the RAM on the data bus. 2) Data are passed through the scaling shifter and the ALU where the arithmetic is performed. 3) The result is moved into the accumulator. The 32-bit accumulator is split into two 1f>..bit segments for storage in data memory: ACCH (accumulator high) and ACCL (accumulator low). The accumulator has a carry bit to facilitate multiple-precision arithmetic for both addition and subtract instructions. Hardware Multiplier: The TMS320C25 utilizes a 16 x 1f>.. bit hardware multiplier, which is capable of computing a 32-bit product during every machine cycle. Two registers are associated with the multiplier: a 1f>..bit Temporary Register (TR) that holds one of the operands for the multiplier, and a 32-bit Product Register (PR) that holds the product. The TMS;J20 Family of Digital Signal Processors The output of the product register can be left-shifted 1 or 4 bits. This is useful for implementing fractional arithmetic or justifying fractional prpducts. The output of the PR can also be right-shifted 6 bits to enable the execution of up to 128 consecutive multiple/accumulates without overflow. An unSigned multiply (MPYU) instruction facilitates extended-precision multiplication. I/O Interface: The TMS320C25 110 space consists of 16 input and 16 output ports. These ports provide the full 1f>.. bit parallel 110 interface via the data bus on tne device. A single input (I N) or output (0 un operation typically takes two cycles; however, when used with the repeat counter, the operation becomes single-cycle. 110 devices are mapped into the I/O address space using the processor's external address and data buses in the same manner as memorymapped devices. Interfacing to memory and 110 devices of varying speeds is accomplished by using the READY line. A Direct Memory Access (DMA) to external program/data memory is also supported. Another processor can take complete control of the TMS320C25's external memory by asserting HOLD low, causing the TMS320C25 to place its address, data, and control lines in the high-impedance state. Signaling between tne external processor and the TMS320C25 can be performed using interrupts. Two modes of DMA are available on the device. In the first, execution is suspended during assertion of HOLD. In the second "concurrent DMA" mode, the TMS320C25 continues to execute its program while operating from internal RAM or ROM, thus greatly increasing throughput in data-intensive applications. TMS320C2S Software The majorityol the TMS320C25 instructions (97 out of 133) are executed in a single instruction cycle. Of the 36 instructions that require additional cycles of execution, 21 involve branches, calls, and returns that result in a reload of the program counter and a break in the execution pipeline. 'Another seven of the instructions are two-word, longimmediate instructions. The remaining eight instructions support I/O, transfers of data between memory spaces, or provide for additional parallel operation in the processor. Furthermore, these eight instructions (IN, OUT, BLKD, 8LKP, TBLR, TBLW, MAC, and MACD) become single-cycle when used in conjunction with the repeat counter. The functional performance of the instructions explOits the parallelism of the processor, allowing complex and/or numerically intensive computations to be implemented in relativeiy few instructions. AddreSSing Modes: Since most of the instructions are coded in a single 1f>..bit word, most instructions can be executed in a single cycle. Three memory addressing modes are available with the instruction set: direct, indirect, and immediate addreSSing. Both direct and indirect addreSSing are used to access data memory. Immediate addressing uses the contents of the memory addressed by the program counter. When using direct addressing, 7 bits of the instruction word are concatenated with the 9 bits of the data memory page pointer (DP) to form the 1f>..bit data memory address. With a 128-word page length, the DP register points to one of 512 possible data memory pages to obtain a 64K total data memory space. Indirect addressing is provided by the aux- 21 iliary registers (ARO-AR7). The seven types of indirect addressing are shown in Table 4. Bit-reversed indexed addressing modes allow efficient 110 to be performed for the resequencing of data points in a radix-2 FFT program. icated to distinct sections of the algorithm, throughput can be increased via pipelined execution. The TMS320C25 is capable of allocatjng up to 32K words of data memory as global memory for multiprocessing applications. . Table 4 Addressing Modes of the TMS320C25 THE THIRD GENERATION Addressing Mode Operation OPA OP' (,NARP) OP '+(.NARP) OP ,-(,NARP) OP 'O+(,NARP) OP 'O-(,NARP) direct addressing indirect; no change to AR. OP 'BRO+(.NARP) indirect; ARO is added to current AR (with reverse carry propagation). indirect; ARO is subtracted from current AR (with reverse carry indirect; current AR is incremented. indirect; current AR is decremented. indirect; ARO is added to current AR. indirect; ARO is subtracted from current AR. OP 'BRO~(.NARP) propagation). Note: The optional NARP field specifies a new value of the ARP. TMS32OC25 System Configurations The flexibility of the TMS320C25 allows systems configurations to satisfy a wide range of application requirements [16). The TMS320C25 can be used in the following configurations: a stand-alone system (a single processor using 4K words of on-chip ROM and 544words of on -chip RAM), parallel multiprocessing systems with shared global data memory, or host/peripheral coprocessing using interface control Signals. A minimal processing system is shown in Fig. 6 using external data RAM and PROM/EPROM. Parallel multiprocessing and host/peripheral coprocessing systems can be designed by taking advantage of the TMS320C25's direct memory access and global memory configuration capabilities. In some digital processing tasks, the algorithm being implemented can be divided into sections with a distinct processor dedicated to each section. In this case, the first and second processors may share global data memory, as well as the second and third, the third and fourth, etc. Arbitration logic ';'ay be reqUired to determine which section of the algorithm is executing and which processor has accesstotheglobal memory. With multiple processors ded- Of THE TMS320 FAMllV The TMS320C30 [26)-[27) is Texas Instruments third-generation member of the TMS320 family of compatible digital signal processors. With a computatiomil rate of 33 MFLOPS (million floating-point operations per second), the TMS320C30 far exceeds the performance of any programmable DSP available today. Total system 'performance has been maximized through internal parallelism, more than twenty-fourthousand bytes of on-chip memory, single 60 kHz 180 ns >20 kHz 360 ns >64 ms chip) SUMMARY High-Speed Control High-speed control applications [4J, [24J use the TMS320C17 and TMS320C25 general-purpose features for bit-test and logical operations, timing synchronization, and The TMS320 Family of Digital Signal Processors This paper has discussed characteristics of digital signal processing and how these characteristics have influenced the architectural design of the Texas Instruments TMS320 family of digital signal processors. Three generations ofthe 27 TMS320 family were covered, and their support tools necessary to develop end-applications were briefly reviewed. The paper concluded with an overview of digital signal processing applications using these devices. REFERENCES [1J l. R. Rabiner and B. Gold, Theory and Application of Digital Signal Processing. Englewood'Cliffs, NJ: Prentice-Hall, 1975. [2J A. V. Oppenheim, Ed., Applications of Digital Signal Process· ing. Englewood Cliffs, NJ: Prentice-Hall, 1978. [3] L. R. Rabiner and R. W. Schafer, Digital Processing of Speech Signals. Englewood Cliffs, NJ: Prentice-Hall, 1978. [4J K. lin, Ed., Digital Signal Processing Applications with the TMS320 Family. Englewood Cliffs, NJ: Prentice-Hall, 1987 [5J A. V. Oppenhiem and R. W. Schafer, Digital Signal Processing. Englewood Cliffs, NJ: Prentice-Hall, 1975. [&J C. Burrus and T. Parks, DFTIFFT and Convolution Algorithms. New York, NY: Wiley, 1985. [7] T. Parks and C. Burrus, Digital Filter Design. New York, NY: Wiley, 1987. [8J J. Treichler, C. Johnson, and M. larimore, A Practical Guide to Adaptive Filter Design. New York, NY: Wiley, 1987. [9J P. Papamichalis, Practical Approaches to Speech Coding. Englewood Cliffs, NJ: Prentice-Hall, 1987. [10J R. Morris, Digital Signal Processing Software. Ottawa, Ont., Canada: DSPS Inc., 1983. [11J K. McDonough, E. Caudel, S. Magar, and A. leigh, "Microcomputer with 32-bit arithmetic does high-precision number [12J crunching," Electronics, pp. 105-110, Feb. 24, 1982. S. Magar, E. Caudel, and A. leigh, "A Microcomputer with digital signal processing capabHity," in 7982 Int. Solid State Conf. Dig. Tech. Pap., pp. 32-33, 284, 285. [131 First Generation TMS320 User's Guide. Houston, TX: Texas Instruments Inc., 1987. [14J TMS320 First-Generation Digital Signal Processors Data Sheet. Houston, TX: Texas Instruments Inc., 1987. [15J TMS32020 User's Guide. Houston, TX: Texas Instruments Inc., 7985. [1&J TMS320C25 User's Guide. Houston, TX: Texas Instruments Inc., 198&. [17] TMS32011 User's Guide. Houston, TX: Texas Instruments Inc., 1985. [18] H. Cragon, liThe elements of single-chip microcomputer architecture," Comput. Mag., vol. 13, no. 10, pp. 27-41, Oct. 1980. (191 S. Rosen, "Electronic computers: A historical survey," Comput. Surv., vol. 1, no. 1, Mar. 1969. [20J M. Honig and D. Messerschmitt, Adaptive Filters. Dordrecht, The Netherlands: Kluwer, 1984. (21] R. lucky et al., Principles of Data Communication. New York, NY: MCGraw-Hili, 19&5. (22] P. Van Gerwen et al., "Microprocessor implementation of high speed data modems," IEEE Trans. Commun., vol. COM25, pp. 238-249, 1977. [23J M. Bellanger, "New applications of digital signal processing in communications," IEEE ASSP Mag., pp. &-11, July 198&. (24] Y. Wang, M. Andrews, S. Butner, and G. Beni, "Robot-controller system," in Proc. Symp. on Incremental Motion Control Systems and Devices, pp. 17-2&, June 198&. [25J TMS320 Family Development Support Reference Guide. Houston, TX: Texas Instruments Inc., 1986. [2&J R. Simar, T. leigh, P. Koeppen, J. leach, J. Potts, and D. Bla- lock, "A 40 MFlOPS digital Signal processor: The first supercomputer on a chip," in Proc. IEEE Int" Conf. on Acoustics, Speech, and Signal Processing, Apr. 1987. (27] TMS320C30 User's Guide. Houston, TX: Texas Instruments Inc., 1987. [28J B. Kernighan and D. Ritchie, The C Programming Language. Englewood Cliffs, NJ: Prentice-Hall, 1978. 28 The TMS320 Family of Digital Signal Processors The Texas Instruments TMS320C25 Digital Signal Microcomputer Gene A. Frantz Kun-Shan Lin Jay B. Reimer Jon Bradley Digital Signal Processor Products - Semiconductor Group Texas Instruments Reprinted from IEEE MICRO MAGAZINE Vol. 6, No.6, Dece,uber 1986 29 30 The Texas Instruments TMS320C25 Digital Signal Microcomputer The Texas Instruments TMS320C25 Digital Signal Microcomputer Gene A. Frantz, Kun-Shan lin, Jay B. Reimer, and Jon Bradley Texas Instruments Incorporated Capable of 10 million operations per second, the newest member of the TMS320 family can serve as an inexpensive alternative to bit-slice processors or custom ICs in digital signal processing applications. D igital signal processing encompasses a variety of applications, including digital filtering, speech vocoding, image processing, fast Fourier transforms, and digital audio. 1·5 All DSP applications have several characteristics in common. First, they employ algorithms that are mathematically intensive. An example is the finite-duration impulse response, or FIR, filter, which in the time domain takes the form N y(n) = E a(i)· x(n-i), (1) ;=1 where y(n) is the output sample at time n, a(1) is the ith coefficient or weighting factor, and x(n -I) is the (n -I)th input sample. From this equation, we can see that the FIR filter contains an abundance of multiplications and additions (that is, sums of produCts). This equation is the general form of an FIR filter 6 as well as the convolution of two sequences of numbers a(1) and x(1). 7 Both operations are fundamental to digital signal processing. Second, DSP algorithms must be performed in real time; . i.e., they must not produce a delay noticeable to the user. In a speech recognition system, for example, the algorithms must not produce a noticeable delay between a word being spoken and that word being recognized. In an image processing system, processing needs to be completed within a frame update period. Third, all DSP applications involve the sampling of a signal. Referring to Equation I, we can see that the output y(n) is calculated to be the weighted sum of the previous N inputs. In other words, the input signal is sampled at periodic intervals, and the samples are multiplied by a weighting factor a(i) and then added together to give the output result y(n). In a typical DSP application, the processor must be able to perform arithmetic computations and effectively handle sampled data in large quantities. Last, DSP systems must be flexible enough to incorporate improvements in the state of the art. Many DSP techniques are still developing, and therefore their algorithms tend to change. Speech recognition, for example, is presently an inexact technique still undergoing algorithmic modification. This implies that DSP systems need to be programmable so that they can easily accommodate revised algorithms. Over the past several decades, digital signal processing machines have taken several forms in response to application need and available technology. Array processors have long been the accepted solution for the research laboratory and have been extended to end applications in some instances. However, as integrated circuit technology has matured, digital signal processing has migrated from the array processor to the bit-slice processor to the single-chip processor. This has brought the cost of DSP solutions down to a point that allows pervasive use of the technology. The members of the TMS320 family of devices are examples of the single-chip digital signal processor. The first member of the family, the TMS320IO, was introduced to the market in 1983. 8•9 It can perform five miIlion DSP ©1989-IEEE. Reprinted, with permission, from IEEE Micro Magazine; Vol. 6, No.6, pp. 10-28; December 1986. The Texas Instruments TMS320C25 Digital Signal Microcomputer 31 operations per second, including the add and mUltiply functions 10 required in Equation I. The newest member of the family, the TMS320C25, can perform 10 million DSP operations per second, II and it combines the multiply/ accumulate functions into one single-cycle operation. • a single-cycle multiply/accumulate, • use of low-power CMOS technology with a powerdown mode, • 4K 16-bit words of on-chip masked ROM, • 544 words of on-chip data RAM, Basic TMS320 architecture The fundamental attribute of a digital signal processor is fast arithmetic operations. The members of the TMS320 family, 10-12 like many other digital signal processors, achieve fast arithmetic operations by employing • a Harvard architecture, • a fully static double-buffered serial port, • concurrent DMA that uses an extended hold operation, forms, • special DSP instructions, and • extended-precision arithmetic and adaptive filtering support, • extensive pipelining. Use of these concepts allows a digital signal processor to handle vast amount of data and execute most DSP operations in a one-cycle instruction. The TMS320 family utilizes a modified Harvard architecture for speed and flexibility. In a strict Harvard architecture, Il,I4 the program memory and data memory lie in two separate spaces, permitting a full overlap of the instruction fetch and execution. The TMS320 family's modification of the Harvard architecture allows transfers between the program space and data space, thereby increasing the flexibility of the devices in the family. This architectural modification eliminates the need for a separate coefficient ROM and also maximizes processing power by maintaining two separate bus structures (program and data) for full-speed execution. The TMS320 family's dedicated hardware multiplier employs a 16 X 16-bit organization, which yields a 32-bit result and allows multiplication to take place in a single cycle. The special DSP instructions include DMOV (data move) and RPT (repeat), which speed up DSP operations. The extensive pipelining ensures maximum throughput for real-time applications. a The TMS320C25 architecture The TMS320C25 digital signal processor is a microcomputer with a 32-bit internal Harvard architecture and a 16-bit external interface. It is a pin-compatible CMOS version of the TMS32020 microprocessor but has an instruction execution rate twice as fast and includes additional hardware and software features. The TMS320C25's instruction set is a superset of that of the TMS32010 and that of the TMS32020, and it maintains source-code compatibility with them. In addition, it is completely object-codecompatible with the TMS32020 so that TMS32020 programs can run unmodified on the TMS32OC25. Some of the major features of the TMS32OC25 are 32 • an eight-level hardware stack, • bit-reversed addressing modes for fast Fourier trans- • a dedicated hardware multiplier, • a 32-bit ALU and accumulator, • an instruction cycle time of 100 ns, • 128K words of data/program memory space, • eight auxiliary registers with a dedicated arithmetic unit, • full-speed operation of data move instructions from external memory, • an accumulator carry bit and related instructions, and • fabrication in 1.8-l'm CMOS and packaging in a 68-pin PLCC. The lOO-ns instruction cycle time provides a significant throughput advantage for many applications. Since most of the TMS320C25's instructions can execute in a single cycle, it can execute 10 million instructions per second. Most of the other features listed above also contribute to the TMS320C25's high throughput. The TMS320C25 includes instructions to perform the data transfers between program space and memory space discussed earlier. Externally, the program and data memory spaces are multiplexed over the same bus so as to maximize the address range for both spaces and minimize the pin count of the device. Internally, the TMS32OC25 architecture maximizes processing power by maintaining two separate bus structures, program and data, for full-speed execution. Program execution in the device takes the form of a three-level instruction fetch-decode-execute pipeline. This pipeline is invisible to the user except in cases in which it must be brokeri, such as for branch instructions. In this case, the instruction timing takes into account the fact that the pipeline must be emptied and refilled. Two large, on-chip data RAM blocks (a total of 544 words), one of which is configurable either as program or data memory, are provided. An off-chip, 64K-word, directly addressable data memory address space is included to facilitate implementations of DSP algorithms with large data memory requirements. Four-K words of on-chip program ROM and 64K words of off-chip program address space are available. Large programs can execute at full speed from this memory space. Programs can also be The Texas Instruments TMS320C25 Digital Signal Microcomputer A/iiii STRi AEADY OR X, 'HMO iWLDA MSC iil! AS lACK MP/"W: iN'f12-01--.L=-----J A15-AO 015·00 LEGEND: ACCH . Accumutetor high ACCL - Accumuletor low - Arithmetic logic unit ALU ARAU ~ AUIlIllerV regis.... erithmetic unit AR. AulilHary register point... buffet" AAP - AUlilliery Hlgister pointer - Date memory pege point... DP DRA - Serial port data receive regi.'er DXR . Sarial port data transmit register .0 IfA 'MA 'R Me. a'A PR PRD TIM TA Int"",,,""'9 regllter Interrupt m.lk register Instruction register Microcetlstack Queue inltruction register Product regtst ... - Period register tor timet" . Tlmar. Temporary ragister PC Pfe .M. RPTC A.A X.R ARO·AR7 5TO.ST1 Program co~ter Prefetch counter Repeet in.truc,ion counter Global i1\IImory eIIocedon Hlgiltet" Serial pori receive shit' ragister Ser'-' port transmit shift register Auxiliary registe.. Status registers Figure 1. TMS32OC25 block diagram. The Texas Instruments TMS320C25 Digital Signal Microcomputer 33 PROGRAM 01>00001 DATA PROGRAM 01>00001 INTERRUPTS AND RESERVED IEXTERNALI 311>001FI 321>00201 01>00001 INTERRUPTS AND RESERVED 10N·CHIP RaMI 311>001FI 321>00201 51>00051 61>00061 ON·CHIP ROM 40151>OFAFI 40161>OFBOI RESERVED 951>005FI 961>00601 RESERVED 409S( >OFFF) 40961 >10001 1271>007FI 1281>00801 511(>01FF) 512(>02001 EXTERNAL EXTERNAL 767( >02FF) 7681>03001 65.2791>FEFFI. __________ _ 65.2BOI > FFOOI ON·CHIP MEMORY -MAPPED REGISTERS PAGE 0 ON-CHIP BLOCK B2 RESERVED PAGES 1-3 ON·CHIP BLOCK BO· PAGES 4-5 ON·CHIP BLOCK B1 PAGES 6-7 EXTERNAL PAGES 8-511 10231 > 03FFI 1 024( >0400) ON·CHIP BLOCK 80* 65.5351>FFFFI ' -_ _ _ _ _---1 65.5351>FFFFI 65,535( > FFFFI IF MPIMl: ~ 0 IMICROCOMPUTER MODEl IF MPIMC ~ 1 IMICROPROCESSOR MODEl ·Block 80 is addressed as program memory after a CNFP Instruction, and as data memory after a CNFD Instruction. Figure 2. TMS320C25 memory maps. downloaded from slow external memory to on-chip RAM for full-speed operation. The TMS32OC25 also incorporates a hardware timer and a block data transfer capability. The diagram of the TMS32OC25 in Figure 1 shows the principal blocks and data paths within the processor. It also shows all of the TMS32OC25's interface pins. The TMS32OC25's architecture is built around the program and data buses. The program bus carries the instruction code and immediate operands from program memory. The data bus interconnects elements such as.the central arithmetic logic unit (CALU) and the auxiliary register file to the data RAM. Together, the program and data buses can carry data from on-chip data RAM and internal or external program memory to the multiplier in a single cycle for multiply laccumulate operations. A high degree of parallelism exists in the device-for example, while data are being operated on by the CALU, arithmetic operations can be implemented in the auxiliary register arithmetic unit (ARAU). Such parallelism results in a powerful set of arithmetic, logical, and bit-manipulation operations that can be performed in a single machine cycle. Memory aUocation. As mentioned above, the TMS32OC25 provides 4K 16-bit words of on-chip program ROM and S44 34 16-bit words of on-chip data RAM. The RAM is divided into three blocks, BO, BI, and B2. Of the 544 words, 256 words (block BO) are configurable as either data memory or program memory; 288 words (blocks Bl and B2) are always data memory. A data memory size of 544 words allows the TMS32OC25 to handle a data array of 512 words but still leaves 32 locations for intermediate storage. The TMS32OC25 maintains separate address spaces for program memory, data memory, and I/O. In addition to blocks BO, BI, and B2, the on-chip data memory map (see Figure 2) includes memory-mapped registers. Six peripheral registers, the serial-port registers (ORR and OXR), timer register (TIM), period register (PRO), interrupt mask register (IMR), and global memory allocation register (GREG), have been mapped into the data memory space so they can be easily modified. The TMS32OC25 has a register file containing eight auxiliary registers that can be used for indirect addressing of data memory or for temporary storage. These registers, ARO-AR7, can be either directly addressed by an instruction or indirectly addressed by a three-bit auxiliary register pointer (ARP). The auxiliary registers and the ARP can be loaded either from data memory or by an immediate operand defined in the instruction. The contents of the registers can also be stored in data memory_ The Texas Instruments TMS320C25 Digital Signal Microcomputer r+ AUXI.IARV REGISTER T /ART 18 ~ AUXILIARY REGI81ER II 1AR81(18 ....... AiIV"-'AaVlH'GI9TER S IARSI 1181 ... "N"""'" ~ ~ ~11181 ... ~-"'&DlI\llII\ ..3 r+ AUXLIARY REGISTER 2 1AR21 1181 r+ AUXIUARY REQIBTER lUAlII18 ~ 8 LBB OF IR AUXlUARY REQlBTER 0 IARO) (18) 18 ~1~ __~____~~A8______ -. f'te IINB ¥"J.' AUXlUARY REQlBTER POINTER IARP) (3) AUXLIARY REBlSTER BUFFER lARS) (3) MUX 1 0If INA'I AUXLIARY REQIBTER ARmiMETIC UNIT (ARAU) (18) AUXIUARY REGISTER FILE BUB IAFRI 3 18 SUBA Figure 3. Auxiliary register file. The auxiliary register file is connected to the auxiliary register arithmetic unit as shown in Figure 3. The ARAU can autoindex the current auxiliary register while the data memory location is being addressed. The current auxiliary register can also be indexed either by + 1/ - I or by the contents of ARO. As a result, the accessing of tables of information does not require the CALU for address manipulation, thereby freeing it for other operations. Although the ARAU was designed to support address manipulation in parallel with other operations, it can also serve as an additional general-purpose arithmetic unit since the auxiliary register file can communicate directly with data memory. The ARAU implements l6-bit unsigned arithmetic, whereas the CALU implements 32-bit two's-complement arithmetic. The ARAU also provides branches dependent on the comparison of ARO to the auxiliary register pointed to by the ARP. Central arlthmetie logic unit. The CALU contains a 16-bit scaling shifter, a 16 x l6-bit parallel multiplier, a 32-bit ALU, and a 32-bit accumulator. The scaling shifter has a l6-bit input connected to the data bus and a 32-bit output connected to the ALU. This shifter produces a left shift of 0 to 16 bits on the input data, as programmed in the instruction. The least significant bits of the output are filled with zeroes, and the most significant bits are either filled with zeroes or sign-extended, depending upon the state of the sign-extension mode bit of status register ST!. Additional shifters at the outputs of both the accumulator and the mUltiplier are suitable for numerical scaling, bit extraction, extended-precision arithmetic, and overflow prevention. Due to the pipelining in the TMS32OC2S, shifting is accomplished as part of an instruction and thus does not require additional cycles for execution. The 32-bit ALU and accumulator perform a wide range of arithmetic and logical instructions. An overflow saturation mode permits the accumulator to be loaded with the most positive or negative number (the choice depending on the direction of overflow), and it allows an overflow flag to be set whenever an overflow occurs. One of the two inputs to the ALU is always provided from the accumulator, and the other may be transferred from the product register (PR) of the mUltiplier or from the scaling shifter loaded from data memory. The implementation of a typical ALU instruction requires these steps: • data are fetched from the Rcarrn the data bus; • data are passed through the scaling shifter and through the ALU, where the arithmetic is performed; and • the result is moved into the accumulator. The 32-bit accumulator is split into two 16-bit segments for storage in data memory: ACCH (accumulator high) and ACCL (accumulator low). Shifters at the output of the accumulator provide a shift of 0 to 7 places to the left. This shift is performed while the data are being transferred to the data bus for storage. The contents of the accumulator remain unchanged. The accumulator also has an in-place onebit shift to the left or right (SFL or SFR instruction) and a rotate through carry (ROL or ROR instruction) for shifting its contents. A carry bit is provided to the accumulator, allowing more efficient extended-precision computation. ADDC (add with carry) and SUBB (subtract with borrow) are two instructions using the carry bit. Branch instructions that use the carry bit are also provided. Hardware multipUer. The TMS32OC2S uses a 16 x l6-bit hardware multiplier that can compute a 32-bit product during every machine cycle. Two registers are associated with the multiplier: a l6-bit temporary register (TR) that holds one of the operands for the multiplier, and a 32-bit product register (PR) that holds the product. The output of the product register can be left-shifted one or four bits. This is useful for implementing fractional arithmetic or justifying fractional products. The output of the PR can also be right-shifted six bits to enable the execu- The Texas Instruments TMS320C25 Digital Signal Microcomputer 35 tion of up to 128 consecutive multiply/accumulates without overflow. The multiplier performs both signed and unsigned operations. Two signed instructions, MAC (multiply/accumulate) and MACD (multiply/accumulate and data move), can process both operands simultaneously, thereby fully utilizing the computational bandwidth of the multiplier. For MAC and MACD, the two operands are transferred to the multiplier at each cycle via the program and data buses. This enables MAC and MACD to be performed in a single cycle when they are used with repeat (RPT or RPTK) instructions. The program bus can supply data from internal or external memory (RAM or ROM) and still maintain singlecycle operation. An unsigned multiply (MPYU) instruction facilitates extended-precision multiplication. It multiplies the unsigned contents of the TR by the unsigned contents of the addressed data memory location, and places the result in thePR. framing sync pulse can be generated internally or externalIy. The serial port's inaximum speed is 5 MHz. The primary enhancements of the TMS32OC25's serial port are Control operations. Control operations are provided on the TMS32OC25 by an on-chip timer, a repeat counter, three external maskable user interrupts, and internal interrupts generated by serial-port operations or by the timer. A memory-mapped 16-bit timer (TIM) register (a down counter) is continuously clocked by CLKOUTI. A timer interrupt (TINT) is generated whenever the timer decrements to zero. The timer is reloaded with the value contained in the period (PRO) register within the first cycle after it reaches zero so that interrupts may be programmed to occur at regular intervals of (PRO + I) • CLKOUTI cycles. This feature is useful for control operations and for synchronous sampling of or writing td peripherals. The repeat counter (RPTC) is loaded with either a data memory value (in the case of the RPT instruction) or an immediate value (in the case of the RPTK instruction). The repeat feature enables a single instruction to be executed up to 256 times. It can be used with instructions such as multiply/accumulates, block moves, 110 transfers, and table read/writes. Those instructions that are normally multicycle are pipelined when the repeat feature is used and effectively become single-cycle instructions. For example, the table read (TBLR) instruction ordinarily takes three or more cycles, but when it is repeated, it becomes a single-cycle instruction. The three external maskable user interrupts, INT2 to INTO, enable external devices to interrupt the processor. Internal interrupts are generated by either the serial port, the timer, or the software interrupt instruction. Interrupts are prioritized, with reset having the highest priority and the serial-port transmit interrupt the lowest. I/O interface. The TMS32OC25's I/O space consists of 16 input and 16 output ports. These ports provide a full I(i..bit parallel 110 interface via the processor's data bus. A single input (IN) or output (OUT) operation typically takes two cycles; however, when executed in the repeat mode, such an operation becomes single-cycle. The TMS32OC25 supports a range of system interfacing requirements. As previously mentioned, three separate address spaces-program, data, and I/O-provide interfacing to memory and I/O, thereby maximizing system throughput. The TMS32OC25 simplifies I/O design by treating I/O the same way it treats memory. It maps I/O devices into the I/O address space using its external address and data buses in the same way as it uses them for mapping memory devices into memory address space. The local memory interface consists of a I (i..bit paralIel data bus (DIS-DO), a I(i..bit address bus (AIS-AO), three pins for data memory, program memory, and I/O space select (OS, PS, and is, respectively), and various system control signals. The R/W signal controls the direction of a data transfer, and STRB provides a timing signal to control the transfer. When using on-chip program RAM, ROM, or high-speed external program memory, the TMS32OC2S runs at full speed without wait states. By using the READY signal, it can generate wait states so it can communicate with slower off-chip memories. The TMS32OC2S supports direct memory access to external program and data memory. Another processor can take complete control of the TMS32OC2S's external memory by asserting HOLD low, causing the TMS32OC2S to place its address, data, and control lines in the high-impedance state. Two modes are available on the device. In the first mode, execution is suspended during assertion of HOLD. In the second mode-the "concurrent DMA mode"-the TMS32OC2S continues to execute its program while operating from internal RAM or ROM, thereby greatly increasing throughput in data-intensive applications. Signaling between the external processor and the TMS320C25 can be performed through interrupts. Serial port. An on-chip serial port provides direct communication with serial devices such as codecs and serial A/D and 0/A converters. The serial port's interface requires a minimum of external hardware. The port has two memory-mapped registers-a data transmit register and a data receive register-which can be operated in either an eight-bit byte mode or a 16-bit word mode. The transmit 36 • double buffering for both receive and transmit opera- tions, • the elimination of a minimum CLKR/CLKX frequency (fmin = 0 Hz), and • the provision of a frame sync mode (FSM) bit, which allows continuous operation with no frame sync pulses. The FSM is useful for communicating on pulse-codemodulated telephone system highways. As a result the TMS32OC25can communicate directly on PCM highways such as AT&T T-I and CCITT 0.7111712 by counting the transmitted and received bytes in software and performing the instructions needed to set (SFSM) and reset (RFSM) the FSMbit. The Texas Instruments TMS320C25 Digital Signal Microcomputer Ta17Ie'l; , TMS320C25 instructions. ACCUMULATOR MEMORY REFERENCE INSTRUCTIONS NO. WORDS DESCRIPTION MNEMONIC accumulator "BS Absolute' value of "DO Aobcl Add to accumulator with carry "DOH ~dd AiloKI ' Add to accumulator short immediate "DDS • OPERATION II"CCII.,. "CC IACCl + Iidma) x,28M'1 ,. "CC I"CC) + Idma) + IC) ~ "CC lAce) + Hdma) x 2'61 ~ ACC IACCI + 8-bit constant ~ ACC IACC) + Idmal '.• ACC "dd to accumulator with shilt to high accumulatOr Add to low accumulator with sign extension suppressed "DDT 1 IACCI <- Ild",alx 2 ITrOg'1 ~ "Ct Add to accumulator with shift specified by T register to accumulator long immediate with shift "OLKt A~d "NO AND with accumulator AND CMPL! LAC LACK !.ACT! LALKI im"'ediat~ ~ith accumulator with :shift Complement accumulator Loao accumulator with'shift Load accumulator fmmediate short S-bit tonstant - Ace Load accumulat~ ~jth shift specified by T register Load accumulator long immediate with shift Negate accl:Jr:nuIStor Idma) x 2 IT ~ ACC 06-bit cOhsiant) x 2 16 ~ "CC IACel '- ACC NEG!, IiIORMt Normalize contents o'f accumulator Of! oRKt OR immediate with accumulator with shift IAre) - ACC (dma) x 2shift - OR with accumulator ftPIli , , ' ~CH' 'Store high a"c"",al,ator With shift SACL, SBLlCt 'Sflt' Store low accumulator with shift , Subtract fr6~ a~cumul8to, long 'immediate'. with shift sU~ SUBIi* Shilt ,accumutator tait Shilt 'accumulaiol ~9h; '~btr8Ct "9' I"CCI15·01l,OR,ldnlal- ACC115-01 2""""1 ~ IACCI30·011_0R'.116·bit coristant ACCI30,OI I"CCI30-011 ~ ACCI31-11. ICI ~ "CCIOI. I"CCI3111 .• C IACC131·111 - "CCI3D·01.lel - ACCI31I. I"CCIOll"; C HACCI x 2shif, I ~ 'dma, )lACCLI x 2 shilt I .. dma I"cel' - p 6-bit cOnstarit x 2 0hifiJ ~,"CC' ("CtlSO-OIi ~ACCI31-11, 0 -. "tCIOI IActla1"lII ~ ACC130-01. IACCj31l1 - ACCI311 ' IACC) - Idmal x' 2shilt l - Ace . IACCI - Idmal - '1l!1 ~ ACC. i nom acc~mulator with "hift Subtract Jrom 8I?cumulator. with borrow ,SUBC, ' , Condltiol"l81 subtract 'sueH Subtract from high accumu!ator Subtract from aecloimul8tor shan iI:n~diate . 'SUbtraCt from low ,accumulator w~th slg~ !3UsKf SUBS: ACe x , -Rotate accumulator left SI'Rt I"CCI • 11S-bit constant x 2 Shilt /. ~ "CC IACCI15-OII,ANO.ldmal ~ ACCI15·01. o ~ ACCI31·,6) I"CCI30·01l,"NO,116-bit constant x 2 shi',! "CCI30·0J. 0 ~ ACCI,30·01 ' suppressed from accumulator With' shif't specified' by T rGgister ' . Exciusfve-OR with aCcumulator lACe) Iidmol 'x 2'61 ~ ACC lACe) ,-S-b;! constant - "CC I"CCI "Idnial, -. ACC extension SUIiT!' Subtract 'z.'ro ~u",ulator ZAtH, zA~RI Zero low accumulator and load high acc",m~tator 'Zero 16w accumulator and"oad high aceUA'lul~tor ~th ;ounding , , ,("CCI - Iidma) x 2 IT ""I_ "CC "CC05-~) I"CCI15-CIll,XOR,ldmal IACCISO-Oll.XOR,ll!1-bit constani 'x '2shU'1 ACCI30-0) -ACC .Idmal' x 2'6 ~ "CC idmal x 2'6. >aooo'-. ACC o " , ~ero a~muI8,tor .a.n,d lead tow accumulator-with . "SiQf1 eXlen$ip l6·bit con.t8ni' ~ AAn IAAnI -i <1m. .lAAnI -' 8-1>11 constant .... ,AAn Store ""xlliary regiater SUbtract from auxiliary regiater short immediate SBAK* ' , . '. 3-!Jjt c:Ohstant -': ARP, 1AAP\ ..;; MIl, T REGISTER, P REGISTER, AND MULTIPLY INSTRUCTIONS MNEMONIC APAC lPHt LT LTA' LTD LTI" LTSt MACt !",ACDt MPV ,MPVA* NO, DESCRIPTION OPERATION WORDS Add P reglster to' accumulator lo8d high P, regist.. Load T register .Load T register arid accumulate previous product Load T regis.ter, accumulate previous product. ai1d move data L:oad T l:8Qister and store P register in aocu":lulator Load T register and sUbtract previous product Multiply and accumulate IACCI + (shift 1'r99! ,~ ACe (dmal ~ pieg (3HlIi ' (dmol ..; Treg , (dinal ~Tr.g" lACe. + Iilhlftad (dma) -.T~~,.ftt.~a). =-+.dhia:f; ":'. (ACel + (shifted P'Ofg),,I 1 MPVS' , MPYU I ' (pmol ~ Id";'i :.. P";9 (ACCI + (shifted Pro9i .... AC,C" Ipmal '~ I_I ~'I'r99. (dina" .... _ , Multiply and accumulate with -data move Multiply Iwilh ,T register, store prequel In P register) Multiply lAd '8ccumUtata previous product ,ftregl x fdm.l' ~ ~J19 " '... (ACCI + (ahlftildPr.;gi ... ' ACii:;: ' (dmal~' ;.,..~ " 13.~~ii const!mt':' Pr;g', (ACCL-'!shift8c\ Pr8g) ... ,A(le, Multiply immadlate :'M~h1PIY a..daubt.eet previous prOduct ITrogl' (Tregl x idMjti-Plieg ",' , U~ idmal :..Ptitg: Ishlfted ;;regj - reui..:. ACC PC PM pma P.eg ~PTC STn SXM T TC TOS MEANING POll address {PAO Ihrough PAIS d'e pr~dellned assembler symbol, equal 10 0 Ihlough 15 'e,pe<;llvely I P.og,am<;ounler 2 b'I/'eldspllclfVmgP'B9'Sleroulpulsh,ltcodll Program memo.y address Product.eglster Repeal counle. SlalllS Re-g,sle.n (STOorSTlI S,gn extensIOn mode bll TemporOlryrB9'S1" TeSI control bl! Top 01 slack Tempo,arvreglsler T.ansmllmodebl! Uns'gned vOllu~ XFpmslalushI! Is aSSIgned to An absolulevalue The Texas Instruments TMS320C25 Digital Signal Microcomputer MNEMONIC DESCRIPTION to edIIreIa specified. 1iV. accumulator on ~~~lary register not ~ro , .ir.lfTcIilI,oO Ikliinl>hitfCbll '" PC: . ... ' "',. , _:"pc;.docl·+ ~.;.:. .. If (TCl* l.tlNn"",*'" " (TC) ,; then 0: 0 1It~!lri.~1IY .....0Ii If accumulator ~ 0 ...... N~lIor>O· ...... ·onl/O.iatua" 0 '1IIii.lti If 8ck:umulaior :s6 ··._If.,_ '.~.;.: :.~:.~".:' 1'It'.1I'tt ;-;~. 41i6. Ii ICI.I.IMirp,n. :..PCV_iPeJ .... ·2..; If (ACel ~ O.then _ ~ ~~,,*.O>t~' + . " (ACC) > 6.11Wn .;/'Cf·.... 11'C.. 1.: .,..;a . (1IRJ1 =0; then pi,-i.:.':' PIf1: .... CPCI: .. 2,:",pc If IACCI :$ O. theIIpme -~; • (Pc! + '2 ':"iIC If IACC) < then ~ .. Pc; ..... II'I;I·~2.:... Pe- if 0: If Ie) ;'0. -then,.,...:'" PC:"':iPC) ~~ ~Pc : " IOVI .,. O. then ""'" - PC,.1PCI + 2 .. PC " (ACCI ~ O.then pme ... PC; eti8.I!'<:) 2"roVI .. O.lhen_ -'PC; else fPCl ... PC . If f.ACCI ~ O. then ""'" -'Pc; "·fPCI +', .:..·.FIt. (ACe(16·on - PC. CPCI + 1 4.T06· . + 2- OPERATION (dma). adilresaeq bv PC) .... ~2 fpma. addrossed.1iv PCI ..; _ IdRlII - dma + 1 1·bit con.tanl .... fdala bus. adcires86d1iy PAl."; ~ 1'0 .. idma) ... datal>\li,:.dd,.i!'jj.j;i'~· , .' O- -. T)(M 0'" )cf 1":FSJ( The Texas Instruments TMS320C25 Digital Signal Microcomputer 39 The TMS32OC2S's conditions and modes are stored in two status registers, STO and ST!. Instructions are provided to allow these registers to be stored in or loaded from data memory. This capability allows the current status' of the device to be saved during interrupts and subroutine calls. TMS320C25 software Earlier, we characterized digital signal processing as the real-time processing of mathematically intensive algorithms. This characterization equates to a requirement for highspeed, multiply/accumulate capability in a processor. The performance of a signal processor is therefore measured in terms appropriate to this requirement-that is, it is measured in terms of the speed of execution of individual instructions, the power of the instruction set, and the I/O capabilities. The speed is given as the basic instruction cycle time and the number of cycles required to complete any instruction. As we noted earlier, pipelining of instruction fetching, decoding, and execution provides an instruction cycle time of only 100 ns. The overwhelming majority of the TMS32OC2S's instructions (97 out of 133) are executed in a single instruction cycle. Of the 36 instructions requiring additional cycles for execution, 21 involve branches, calls, and returns that result in a reload of the program counter and a break in the execution pipeline. Another seven of 40 the instructions are two-word, long immediate instructions. The remaining eight-IN, OUT, BLKD, BLKP, TBLR, TBLW, MAC, and MACD-support I/O and transfers of data between memory spaces, or provide for additional parallel operation in the processor. Furthermore, these eight instructions become single-cycle when used in conjunction with the repeat counter. The instruction set of the TMS32OC2S exploits the parallelism of the processor, allowing complex or numerically intensive computations to be implemented in relatively few instructions. Table I lists the TMS32OC2S's instructions. Addressing modes. Most TMS32OC2S instructions are coded in a single l6-bit word-the reason most can be executed in a single cycle. The 16-bit word comprises an eightbit opcode and an eight-bit address. Three memory addressing modes are available: direct, indirect, and immediate (Table 2). Both direct and indirect addressing are used to access data memory. Immediate addressing uses the contents of the memory addressed by the program counter. Figure 4 illustrates operand addressing in the direct, indirect, and immediate modes. In direct addressing, seven bits of the instruction word are concatenated with the nine-bit data memory page pointer (OP) to form the 16-bit data memory address. The DP register points to one of SI2 possible data memory pages, each, 128 word in length, to obtain a 64K total data memory space. The seven-bit address in the instruction The Texas Instruments TMS320C25 Digital Signal Microcomputer instructions, the word following the instruction opcode is used as the immediate operand. MPYK is an example of an immediate instruction; it multiplies the contents of the T register by a signed I3-bit constant. Seventeen immediate operand instructions are included in the instruction set (see Table 1 again). points to the specific location within the data memory page. Indirect addressing is provided by the eight auxiliary registers ARO-AR7. These registers can be used to indirectly address data memory, as loop counters, or for temporary data storage. Indirect auxiliary register addressing (Figure S) allows placement of the data memory address of an instruction operand into one of the eight auxiliary registers. These registers are pointed to by a three-bit auxiliary register pointer (ARP) that is loaded with a value from 0 through 7 designating ARO through AR7, respectively. The auxiliary registers and the ARP may be loaded either from data memory or by an immediate operand defined in the instruction. Furthermore, the contents of the auxiliary registers may be stored in data memory. There are seven types of indirect addressing (see Table 2 again): indexing with increment, indexing with decrement, indexing by adding the contents of ARO, o indexing by subtracting the contents of ARO, o indexing by adding the contents of ARO with the carry propagation reversed (for bit-reversing an FFT), • indexing by subtracting the contents of ARO with the carry propagation reversed (also for bit-reversing an FFT), and o no indexing. o o o All indexing operations are performed on the current auxiliary register in the same cycle as the original instruction, with loading of a new ARP value available as an option. The operations performed in the ARAU can even be performed during branch instruction execution, allowing efficient control with conditional looping. Bit-reversed indexed addressing modes allow efficient 110 to be performed for the resequencing of data points in a radix-2 FFT program. The direction of carry propagation in the ARAU is reversed when this mode is selected, and ARO is added to or subtracted from the current auxiliary register. In immediate addressing, the instruction word contains the value of the immediate operand. Both single-word (8-bit and I3-bit constant) short immediate instructions and twoword (l6-bit constant) long immediate instructions are included in the instruction set. In the case of long immediate Instruction set paraUelism-an example. The MACD (multiply/accumulate and data move) instruction serves as an informative example of the parallelism designed into the TMS32OC2S instruction set as well as into the TMS32OC2S architecture. As shown in Equation I, the requirement for parallelism exists in common DSP operations such as convolution and filtering. 6.7 Parallelism in the execution of instructions enables a complete multiply/accumulate/data move operation to be completed in a single lOO-ns instruction cycle. The execution of the MACD involves the following steps: I) The contents of the 32-bit P register are shifted (scaled) by an output shifter. 2) The n-bit ALU accumulates the shifted result of the n-bit P register with the current contents of the 32-bit accumulator. 3)-The 16-bit contents of a data memory location (usually addressed indirectly via one of the auxiliary registers) are loaded into the T register. 4) The 16-bit contents of a program memory location (addressed via the prefetch counter PFC) are introduced to the multiplier and a 16 x 16-bit multiply is executed, resulting in a new 32-bit product. The product is placed in the P register to be accumulated during the next cycle. S) The 16-bit contents of the data memory location are copied to the next higher data memory address. 6) The carry and overflow status bits are set, as appropriate, in the status registers. 7) The 16-bit contents of the auxiliary register pointed to by the ARP are modified (typically decremented) in preparation for the use of the data memory address on the next cycle. 8) The 16-bit contents of the PFC are incremented in preparation for the use of the program memory address on the next cycle. 9) The repeat counter is decremented. As can be seen from the above, one of the data values is taken from data memory while the other is taken from program memory. A single-cycle execution and data move is accomplished when the data memory being addressed is the on-chip data memory. The program memory location can be either on or off chip and, if on chip, can come from either ROM or the reconfl8urable memory block BO. Parallel operation of certain subsets of TMS32OC2S functions is also available. These subsets include loading the T register in combination with addition (LTA), subtraction (LTS), or a move of the P register's contents to the accumulator (LTP). The accumulation can be supplemented by the data move function (LTD). Another combination (MPYA/MPYS) provides the accumUlation of the previous The Texas Instruments TMS320C25 Digital Signal Microcomputer 41 INSTRUCTION DIRECT ADDRESSING IOPCCXE 1 en 1DP l/7 ttle .1 10PC A, F DATA MEMORY MAP LOCATION >OOOO~ := INTERNAL 6 1 _ >FF311 AR.. I " BI ARS'> Iii ~ >FFFF M71)B4IDI Figure 5. Example of indirect auxiliary register addressing. The Texas Instruments TMS320C251Jigital Signal Microcomputer TBP38L185 '-15-1<0 ~1 ADDRESS BUS PS 5V + T A10-1<0 01S-D8 G1 ~ G2 G3 TMS32OC25 TBP38L185 A10-1<0 07-00 ~ G1 "~il READV USC W T 5V + 18 G2 18 G~ DATA BUS 7..ALS32 Figure 6. Minimal configuration for external program memory. System configurations. The flexibility of the TMS32OC25 allows systems configurations that satisfy a broad range of application requirements. The TMS32OC25 can be configured as • a stand-alone system (that is, as a single processor using 4K words of on-chip ROM and 544 words of on-chip RAM), • part of a parallel multiprocessing system (two or more TMS32OC25s) with shared global data memory, or • a coprocessor for a host processor. The stand-alone system interface consists of a 16-bit parallel data bus, a 16-bit address bus, three pins for memory space select, and various system control signals. In Figure 6, an external data RAM and a PROM/EPROM have been added to the basic stand-alone system. The READY signal is used for wait-state generation for communicating with slower off-chip memories. AU the memories and I/O devices are directly controlled by the TMS32OC25, thus minimizing external hardware requirements. Parallel multiprocessing and host/coprocessor systems take advantage of the TMS32OC25's direct memory access and global memory configuration capabilities. Direct memory access. The TMS32OC25 supports direct memory access to its external program/data memory and 110 space through its HOLD and HOLDA signals. Direct memory access can be used for multiprocessing: Execution on one or more processors can be temporarily halted to allow another processor to read from or write to the halted processor's local off-chip memory. Here the multiprocessing is typically performed in a master/slave configuration. The master can initialize the slave by downloading a program into its program memory space or provide the slave with the data needed to complete a task. In a direct memory access scheme, the master may be a general-purpose CPU, a TMS32OC25, or perhaps even an A/D converter. A master TMS320C25 takes complete control of the slave's external memory by asserting HOLD low through its externaillag (XF). This causes the slave to place its address, data, and control lines in a high-impedance state. By asserting RS in conjunction with HOLD, the master processor can load the slave's local program memory with the necessary initialization code on reset or power-up. The two processors can be synchronized through use of the SYNC pin to make the transfer over the memory bus faster and more efficient. After control of the slave's buses is given to the master processor, the slave alerts the master by asserting HOLDA. This signal can be tied to the master's BIO pin. The slave's XF pin can be used to indicate to the master when the slave has finished performing its task and needs to be reprogrammed or given additional data to continue processing. In a multiple-slave configuration, the priority of each slave's task can be determined by tying the slave's XF signals to the appropriate INT pin on the master. A PC environment provides an example of a direct memory access scheme in which the system bus is used for data transfer. In this configuration, either the master CPU or a disk controller may place data on the system bus for downloading into the local memory of the TMS32OC25. Here the TMS32OC25 acts like a peripheral processor with multifunction capability. In a speech application, for example, the master can load the TMS32OC25's program memory with algorithms to perform tasks such as speech analysis, synthesis, or recognition, and its data memory with the required speech templates. In a graphics application, the TMS32OC25 can serve as a dedicated graphics engine. programs can be stored in ROM or downloaded via the system bus into program RAM. Again, data can come from PC disk storage or be provided directly by the master CPU. In this configuration, decode and arbitration logic is used to control the direct memory access. When the address on the system bus resides in the local memory of the peripheral TMS32OC25, this logic asserts the HOLD signal While sending the master a not -ready indication to allow wait states. After the TMS32OC25 acknowledges the direct memory access by asserting HOLDA, READY is asserted and the information is transferred. Global memory. In some digital signal processing tasks, the algorithm being implemented can be divided into sections and a processor dedicated to each. In this case, the The Texas Instruments TMS320C25 Digital Signal Microcomputer 43 flTst and second processors can share global data memory, as can the second and third, the third and fourth, and so on. Arbitration logic may be required to determine which section of the algorithm will execute and which processor will have access to the global memory. The dedication of each processor to a distinct section of the algorithm makes pipelined execution-and thus higher throughput-possible. External memory can be divided into global and local sections. Special registers and pins on the TMS320C25 allow multiple processors to share up to 32K words pf global data memory. This facilitates efficient "shared data" multiprocessing, in which data are transferred between two or more processors. Unlike a direct memory access scheme, reading or writing global memory does not require one of the processors to be halted. TMS320C25 development tools and support A digital signal processor is essentially an applicationspecific microprocessor or microcomputer. Like any microprocessor, it needs good development tools and technical support-no matter how impressive its performance or how easy its interfacing to other devices, it cannot be easily designed into systems without such tools and support. In developing an application, a designer encounters problems can be executed by the simulator, emulator, or the TMS32OC25 processor. The macro assembler/linker is currently available for the VAX/VMS, TI PC/MS-DOS, and IBM PC/PC-DOS operating systems. Simulator. The simulator is a software program that simulates TMS320 operations to allow program verification. Its debug mode enables the user to monitor the state of the simulated TMS320 while his program is executing. The simulator uses the object code produced by the macro assemblerllinker. During program execution, the iilternal registers and memory of the simulated TMS320 are modified as each instruction is interpreted by the host computer. Once program execution is suspended, the internal registers and the program and data memories can be inspected and modified. The simulator is currently available for the VAX/VMS, TI PC/MS-DOS, and IBM PC/PC-DOS operating systems. Hardware tools. Toois are provided for in-circuit emulation and hardware program debugging such as breakpointing and tracing so that DSP algorithms can be developed and tested in a real-product environment. Evaluation module. The evaluation module, or EVM, is a stand-alone board that contains all the hardware tools No matter how impressive its performance or how easy its interfacing to other devices, a digital signal processor cannot be designed into systems without good development tools and vendor support. and needs to ask questions. Often the tools and vendor support given him are the difference between the success and failure of his project. The TMS32OC25 is supported by many development tools. 16 These tools range from inexpensive modules for application evaluation and benchmarking to an assembler/ linker and software simulator to a full-capabillty hardware emulator. Software tools. An assembler/linker and software simulator that enable users to develop and debug TMS320 DSP algorithms are available for the TI PC, IBM PC, and VAX. Assembler/linker. The macro aSsembler translates assembly language source code into executable object code. It allows the programmer to work with mnemonics rather than hexadecimal machine instructions and to reference memory locations with symbolic addresses. It supports macro calls and definitions along with conditional assembly. The linker permits a program to be designed and implemented in separate modules that are later linked to form the complete program. The linker resolves external definitions and references for relocatable code, creating an object file that 44 needed to evaluate the TMS32OC25 and that provides incircuit emulation of it. The EVM's firmware package contains a debug monitor, an editor, an assembler, a reverse assembler, and software communication to two EIA ports. These ports allow the EVM to be connected to a terminal and to either a host computer or a line printer. The EVM accepts either source or object code downloaded from the host computer. Its resident assembler converts incoming source text into executable code in just oile pass by automatically resolving labels after the first assembly pass is completed. When a session is finished, code is saved via the host computer interface. Software development system. The SWDS is a plug-in card for the TI PC and IBM PC that provides the same functionality as the EVM. Emulator. The XDS (Extended Development System) is an emulator providing full-speed in-circuit emulation with real-time hardware breakpointing and tracing and program execution capability from target memory. The XDS allows integration of hardware and software modules in the debug mode. By setting breakpoints based on internal conditions The Texas Instruments TMS320C25 Digital Signal Microcomputer or external events, the XDS user can suspend execution of the program and give control to the debug mode. In the debug mode, he can inspect and modify all registers and memory locations. Single-step execution is available. Fulltrace capabilities at full speed and a reverse assembler that translates machine code back into assembly instructions also increase debugging productivity. The XDS system is desighed to interface with either a terminal or a host computer. Object code generated by the assembler/linker can be downloaded to the XDS and then controlled through a terminal. Ana/og interface board. The AlB is an analog-to-digital (A/D) and digital-to-analog (D/A) conversion board that can be used in conjunction with the EYM or XDS. It can also be used in an educational environment to help familiarize the user with real-world digital signal processing techniques. The AlB includes A/D and D/A converters with 12-bit resolution as well as antialiasing lind smoothing filters that have a cut-off frequency programmable from 4.7 kHz to 20kHz. In addition to the above design tools, development support includes • the Digital Filter Design Package, which runs on both TI and IBM PCs and which allows the user to design digital filters (low-pass, high-pass, band-pass, and band-stop types) using a menu-driven approach, • TI Regional Technology Centers staffed with qualified engineers who provide technical support and design services, • access to third parties with DSP expertise in various application areas, • a series of DSP books covering DSP theory, algorithms, and applications and TMS320 implementations, 4,5,7 • documentation such as user's guides, 1().12 data sheets, a development support reference guide, 16 and comprehensive application reports, 4 and • a technical support hotline and a bulletin board service. TMS320C25 applications The TMS32OC25 is designed for real-time DSP and other computation-intensive tasks in telecorninunications, graphics, image processing, high-speed control, speech processing, instrumentation, and numeric processing. In these applications, the TMS32OC25 provides an excellent means for executing signal processing algorithms such as fast Fourier transforms (FFfs), digital mters, frequency synthesizers, correlators, and convolution routines. It can also execute general-purpose functions since it includes bit-manipulation instructions, block data move capabilities, large program and data memory address spaces, and flexible memory mapping. Since digital filters are used in so many DSP applications, let us examine them as a prelude to our discussion of TMS32OC25 applications. DighaJ filtering. Filters are often implemented in digital signal processing systems. Such filters fall into two categories: finite impulse response (FIR) filters and infinite impulse response (I1R) filters. 4•6 For bolh types of filter, the coefficients of the filter (weighting factors) may be fixed or adapted during the course of the signal processing. The TMS32OC2S reduces the execution time of all filters by virtue of its I()().ns instruction cycle time and optimized in· structions for filter operations. As we stated earlier, the FIR filter is simply the sum of products in a sampled data system (see Equation I again). A simple implementation of the FIR filter uses the MACD instruction (multiply/accumulate and data move) for each filter tap and the RPT /RPTK instruction to repeat the MACD for each tap. Thus, a 256-tap FIR filter can be implemented as RPT( HACD 255 *-, COEFFP Here, the coefficients can be stored anywhere in program memory (in the reconfigurable on-<:hip RAM, in the on-<:hip ROM, or in external memories). When the coemcients are stored in on-<:hip ROM or externally, the entire on-<:hip data RAM can be used to store the sample sequence. This allows filters of up to 512 taps to be implemented. Execution of the filter will be at full speed, or 100 ns per tap, as long as the memory (either on-<:hip RAM or high-speed external RAM) supports full-speed execution. Up to this point, we have assumed that the filter coefficients are fIXed from sample to sample. If the coefficients are adapted or updated with time, as they are in adaptive filters for echo cancellation, 4,15 the DSP algorithm requires a greater computational capacity from the processor. To adapt or update the coefficients, usually with each sample, the TMS32OC25 uses three instructions-multiply and add/substract previous product to/from accumulator (MPYA/MPYS), zero-out low-order accumulator bits and load high-order accumulator bits with data (ZALR), and store high-order bits of accumulator to data memory (SACH). The method it uses to adapt the coefficients is the least-mean-square, or LMS, algorithm, which can be expressed as bk(i+ I) = bk(i) + 2B [e(i) . x(i-k)], (2) where b k(i + I) is the weighting coefficient for the next sam pie period, bk(i) is the weighting coefficient for the present sample period, B is the gain factor or adaptation step size, e(i) is the error function, and x(i-k) is the input ofthe filter. In an adaptive filter, the coefficients b k (i) must be updated to minimize the error function e{i), which is the difference between the output of the filter and a reference signal. Quantization errors arising during coefficient updating can strongly affect the performance of the filter, but these errors can be minimized if the updated values are obtained by rounding rather than truncating. For each coefficient in the filter at a given point in time, the factor The Texas Instruments TMS320C25 Digital Signal Microcomputer 45 TITL DEF DEF 2*B*e(i) is a constant. This factor can be computed once and stored in the T register for each of the updates. This reduces the computational requirement to one multiply/accumulate plus rounding. Without the new instructions, the adaptation of ~ach coefficient would take five instructions corresponding to five clock cycles, as the following instruction sequence shows: LRLK LiLl LARP LT AR2,COEFFD AR3,LASTAP AR2 ERRF errf • 2*B*e(i) ZiLH ADD MPY APAC *,AR3 ONE,15 ACC - bk(i)*2·*16 ACC _ bk(1)*2**16 + 2*·15 SACH *-,AR2 *+ LOAD ADDRESS OF COEFFICIENTS. LOAD ADDRESS OF DATA SAMPLES. ACC _ bk(1)*2**16 + errf*x(i-k) + 2**15 SAVE bk(i+l). When the MPYA and ZALR instructions are used, the adaptation reduces to three instructions corresponding to three clock cycles, as shown below: LRLl LRLl LARP LT AR2,COEFFD AR3,LASTAP AR2 ERRF ZALR HPYA *,AR3 *-.AR2' SACH *+ * THIS 256-TAP ADAPTIVE FIR FILTER USES ON-CHIP MEMORY BLOCK BO FOR COEFFICIENTS AND BLOCK Bl FOR DATA SAMPLES. THE NEWEST ~NPUT SHOULD BE IN MEMORY LOCATION X WHEN CALLED • • THE OUTPUT WILL BE IN MEMORY LOCATION Y WHEN RETURNED. * ASSUME THAT THE DATA PAGE IS 0 WHEN THE ROUTINE IS CALLED. COEFFP EQU COEFFD EQU )FFOO )0200 ONE BETA ERR ERRF Y )7A EQU EQU EQU EQU EQU EQU X FRSTAP EQU LASTAP EQU (DP.O) CONSTANT ONE ADAPTATION CONSTANT (DP_O) (DP_O) SIGNAL ERROR ERROR FUNCTION (DP-O) FILTER OUTPUT (DP.O) NEWEST DATA SAMPLE (Dr-O) NEXT NEWEST DATA SAMPLE OLDEST DATA SAMPLE )7B )7C )70 )7E )7F )0300 )03FF (FIR) FILTER. CONFIGURE BO AS PROGRAM: Clear the .p register. Load output rounding bit. Point to the oldeat S8l1.ple. 2S6-tap FIR filter. CONFIGURE BO AS DATA: Store the filter output. Add the newest input. orr(1) • x(1) - 1(1) " LNS ADAPTATION OF FILTER COEFFICIENTS. LT MPY PAC ADD SACH errf • 2*B*e(i) Ace. bk(1)*2 •• 16 + 2*.15 ACC _ bk(1)*2**16 + errf*x(i-k) + 2**15 PREG • errf*x(i-k+l) SAVE bk(i+l). ADAPT 46 BO PROGRAM MEMORY ADDRESS I 80 DATA MEMORY ADDRESS .. FINITE IMPULSE RESPONSE * ADPFIR CNFP MPH 0 ONE,14 LAC LARP AR3 LRLl AR3,LASTAP FIR QPTl 255 HACD COEFFP, .CNFD APAC SACH Y,I NEG X,15 ADD SACH ERR,I LOAD ADDRESS OF COEFFICIENTS. LOAD ADDRESS OF DATA SAMPLES. Note that the processing order has been slightly changed to incorporate the use of the MPYA instruction. This is due to the fact that the accumulation performed by the MPYA is the accumulation of the previous product. We have now seen the basic code for a FIR filter tap and a coefficient update. Figure 7 shows a routine to filter a signal and update the coefficients for a 2S6-tap adaptive FIR filter. Note that for each tap one instruction cycle is needed to perform the FIR filter (i.e., to execute a MACD), three instruction cycles are needed to update the filter coefficients, alld 33 instruction cycles are needed for overhead. Therefore, the total number of execution cycles needed for the routine is 33 + 4n, where n is the filter length. Also, note that data memory and program memory requirements are 5 + 2n and 30 + 3n words, respectively. For adaptive filters, the filter length is restricted by both execution time and memory. There is obviously more processing to be completed per sample due to the adaptation, and the adaptation 'ADAPTIVE FILTER I ADPFIR X, Y ERR QETA ONE,14 ERRF,l errf(!) • beta. err(i) ROUND THE RESULT. MAR LAC SACL *. LRLl LRLl LT MPY AR2,COEFFD AR3, LASTAP ERRF ·-,AR2 POINT TO THE COEFFICIENTS' POINT TO THE DATA SAMPLES. ZALR MPH ",AR3 "-.AR2 SACH *. LOAD ACCH WITH b255( 1) & ROUND. b255(1.1) _ b255(1) + P P • 2*beta.err(i)"x(1-254) STORE b255( 1+1). ZALR MPH *,AR3 "-,AR2 SACH '+ ZALR MPH *,AR3 *-,AR2 SACH *+ ZALR *,AR3 *-.AR2 LOAD ACCH WITH bl(1) & ROUND. bl(1.1) _ bl(1) • P P • 2*beta*err(i)*x(1-0) STORE bl(1+1). *,AR3 *-.AR2 *. LOAD ACCH WITH bO( 1) & ROUND. bO(i+1) _ bO(i) + .P STOQE bO(1.1). MPH. SACH ZALR APAC SACH X INCLUDE NEWEST SAMPLE. * '. RET Figure 7. 256-tap adaptive P • 2*beta"err(i)"x(i-2SS) LOAD ACCH WITH b254(1) & QOUND. b254(1.1) - b254(1) + P P • 2"beta"err(i)"x(1-253) STORE b254( 1+1). LOAD ACCH WITH b253(t) & ROUND. b253(i+1) _ b253(1) + P P • 2*beta*err( 1 )*x( 1-252) STORE b253( 1+1). RETURN TO CALLING ROUTINE. FIR filter routine. The Texas Instruments TMS320C25 Digital Signal Microcomputer itself dictates that the coefficients be stored in the reconfigurable block of on-chip RAM. Thus, an adaptive filter with no external data memory is limited to 256 taps. Telecommunications applications. Digital signal processing will be more extensively used in telecommunications as it evolves toward all-digital networks. 17 Below, we discuss several typical uses of the TMS32OC2S in telecommunications applications. Echo cancellation. In echo cancellation, an adaptive FIR filter performs the modeling routine and signal modifications needed to adaptively cancel the echo caused by impedance mismatches in telephone transmission'lines. The TMS32OC2S's large on-chip RAM of S44 words and onchip ROM of 4K words allow it to execute a 2S6-tap adaptive filter (32-ms echo cancellation) without external data or program memory. High-speed modems. For high-speed modems, the TMS32OC25 can perform functions such as modulation and demodulation, adaptive equalization, and echo cancellation. 18.19 Voice coding. Voice-coding techniques such as full-duplex, 32,OOO-bit-per-second adaptive differential pulse-code modulation (CCITT 0.721), CVSD, 16,OOO-bit-per-second subband coding, and linear predictive coding are frequently used in voice transmission and storage. The spted of the TMS32OC25 in performing arithmetic and its normalization and bit-manipulation capabilities enable it to implement these functions, usually within itself (i.e., with no external devices). Graphics and Image processing appHcatlons. In these applications, a signal processor's ability to interface with a host processor is important. The TMS32OC2S multiprocessor interface enables it to be used in a variety of host/coprocessor configurations. Oraphics and image processing applications can use the TMS32OC2S's large directly ad!Jressable external data space and global memory capability to allow graphical images in memory to be shared with a host processor, thus minimizing data transfers. The TMS32OC2S's indexed indirect addressing modes allow matrices to be processed row by row when matrix multiplication is performed for 3-D image rotation, translation, and scaling. . High-speed control applications. These applications use the TMS32OC2S's general-purpose features for bit-test and logical operations, timing synchronization, and fast data transfers (10 million l6-bit words per second). They use the TMS32OC2S in closed-loop systems for control signal conditioning, filtering, high-speed computing, and multichannel multiplexing. The following examples demonstrate typical control applications. Disk control. In disk drives, a closed-loop actuation mechanism positions the read/write heads over the disk surface. Accurate positioning requires various signal conditioning tasks to be performed. The TMS320C2S can replace costly bit-slice, custom, and analog solutions in performing such tasks as compensation, filtering, and fine/coarse tuning. Robotics. The TMS32OC2S's digital signal processing and bit-manipulation power, coupled with its host interface, allow it to be useful in robotics control. The TMS32OC2S can replace both the digital controllers and the analog signal processing hardware a robot needs to communicate to a central host processor, and it can perform the numerically intensive control functions typical of robotic applications. InStrumentation. Instruments such as spectrum analyzers often require a large data memory space and a processor capable of performing long-length FFTs and generating high-precision functions with minimal external hardware. The TMS32OC2S fulfills these requirements. Numeric processing applications. Numeric and array processing applications benefit from the TMS320C2S's performance. The device's high throughput and its multiprocessing and data memory expansion capabilities make it a low-cost, easy-to-use replacement for a typical bit-slice array processor. Benchmarks. The TMS32OC2S has demonstrated impressive performance of benchmarks representing common DSP routines and applications. Table 3 shows this performance. T he TMS32OC2S digital signal processor is the newest member of the TMS320 family. It is a pincompatible, CMOS version of the TMS32020 but offers several enhancements of that device-a 1000ns instruction cycle time, 4K words of on-chip masked ROM, eight auxiliary registers, an ~ight-Ievel hardware stack, and a double-buffered serial port. It also enhances the TMS32020 instruction set to support adaptive filtering, extendedprecision arithmetic, bit-reversed addressing, and faster I/O. The TMS32OC2S's multiprocessor capability, large memory spaces, and general-purpose features allow it to be used in a variety of systems, including ones currently employing costly bit-slice processors or cllStom ICs. • The Texas Instruments TMS320C25 Digital Signal Microcomputer 47 References I. L. R. Rabiner and B. Gold, Theory and Application of Digital Signal Processing, Prentice-Hall, Englewood aiffs, N.J., 1975. 2. A. V. Oppenheim, ed., Applications of Digital Signal Processing, J>rentice-HaIl, Englewood Cliffs, N.J., 1978. 3. L. R. Rabiner and R. W. Schafer, Digital Processing 0/ Speech Signals, Prentice-Hall, Englewood aiffs, N.J., 1978. Tech. Papers-1982 IEEE Int'l Solid-State Circuits Con/., pp. 32-33 and 284-285. 10. TMS32010 User's Guide, Texas Instruments Inc., 1983. II. TMS32OC25 User's Guide, Texas Instruments Inc., • 1986. 12. TMS32020 User's Guide, Texas Instruments Inc., 1985. 13. H. G. Cragon, "The Elements of Sjngle-Chip Microcomputer Architecture," Computer, Vol. 13, No. 10, Oct. 1980, pp. 27-41. . 5. R. Morris, Digital Signal Processing Software, DSPS Inc., Ottawa, Ont., 1983. 14. S. Rosen, "Electronic Computers: A Historical Survey," Computing Surveys, Vol. I, No. I, Mar. 1969. 15. M. Honig and D. Messerschmitt, Adaptive Filters, Kluwer Academic Publishers, Hingham, Mass., 1984. 6. A.V. Oppenheim and R.W. Schafer, Digital Signal Processing, Prentice-Hall, Englewood Cliffs, N.J., 1975. 16. TMS320 Family Development Support Reference Guide, Texas Instruments Inc., 1986. 7. C. Burrus and T. Parks, DFTIFFT and Convolution Algorithms, John Wiley & Sons, New York, 1985. 8. K. McDonough, E. Ca:udel, S. Magar, and A. Leigh, "Microcomputer with 32-bit Arithmetic Does HighPrecision Number Crunching," Electronics, Feb. 24, 1982, pp. 105-110. 17. M. Bellanger, "New Applications of Digital Signal Processing in Communications," IEEE ASSP Magazine, July 1986, pp. 6-11. 4. Digital Signal Processing Applications with the TMS320 Family, Texas Instruments Inc., 1986. 9. S. Magar, E. Ca:udel, and A. Leigh, "A Microcomputel with Digital Signal Processing Capability," Digest of 48 18. R. Lucky et aI., Principles of Data Communication, McGraw-Hili, New York, 1965. 19. P. Van Gerwen et al., "Microprocessor Implementation of High Speed Data Moderns," IEEE Trans. Communications, Vol. COM-25, 1977, pp. 238-249. The Texas Instruments TMS320C25 Digital Signal Microcomputer Gene A. Frantz has been Texas Instruments' applications manager for digital signal processing products since 1984. He is also a senior member of the Technical Staff at TI. He joined TI in 1974 as a system design engineer and worked on calculators in TI's Consumer Products Division. In 1976 he was assigned to the Li'l Professor design team. He was next assigned to the Speak & Spell project, where he served as program manager. Since then, he has been involved with every speech·related consumer product developed at TI. Frantz received a BSEE from the University of Central Florida in 1971, an MSEE from Southern Methodist University, and an MBA from Texas Tech University. Kun...shan Lin has been involved in digital signal processing applications in the TI Semiconductor Group since 1984. He is a senior member of the TI Technical Staff. He joined Texas Instruments in 1979 and was assigned to the Consumer Products Division, where he developed speech techniques for learning aids. Prior to joining TI, he was an assistant professor of electrical engineering at Tennessee State University and an adjunct assistant professor of EE at the University of New Mexico. Lin received his PhD from the University of New Mexico in 1976. Jay Reimer, a member of the TI Technical Staff, handles DSP applications engineering for the TMS320 family of products. He joined TI in J979 to work with speech products in the company's Consumer Products Division. In 1984, he transferred to the Semiconductor Group to work with digital signal processors. His responsibilities include software development for the TMS320 family and applications assistance for customers using the processors. Reimer received a BS in physics from Fort Hays State University, Kansas, in 1975 and an MS in physics from the University of Kansas in 1977. Jon Bradley is an applications engineer for the TMS320 family. He joined Texas Instruments in 1976 and has been an applications engineer for most of TI's microprocessor and peripheral products, starting with the TMS9900 family. His responsibilities have included microprocessor system design, digital and analog circuit design, integrated circuit design, test engineering, and programming. Bradley received a BSEE from Worcester Polytechnic Institute, Massachusetts, in 1976. The Texas Instruments TMS320C25 Digital Signal Microcomputer 49 50 The Texas Instruments TMS320C25 Digital Signal Microcomputer Part II. Digital Signal Processing Interface Techniques 4. Hardware Interfacing to the TMS32OC2x (George Troullinos and Jon Bradley) 5. Interfacing the TMS320 Family to the TLC32040 Family (Linear Products - Texas Instruments) 6. ICC Requirements of a TMS32OC25 (Dave Zalac) 7. An Implementation of a Software UART Using the TMS32OC25 (Dave Zalac) 8. TMS32OC17 and TMS37OCOlO Serial Interface (Peter Robinson) 51 52 Hardware Interfacing to the TMS320C2x George Troullinos Jon Bradley Digital Signal Processor Products - Semiconductor Group Texas Instruments 53 54 Hardware Interfacing to the TMS320C2x Introduction Each member of the TMS320 Second-Generation Digital Signal Processors family has the power and flexibility to satisfy a wide range of system requirements. The second-generation TMS320 line includes the TMS32020, TMS320C25, TMS320C25-50, TMS320E25, and TMS320C26. Please refer to the Second-Generation TMS320 User's Guide[l] for details on device-to-device variation. All TMS320 second-generation DSPs are pin-compatible and thus have the same set of external interface signals. For convenience, the following notation will be used throughout this report: Second-generation TMS320 devices refer to all members of this family, TMS320C2x refers to all members of the second-generation family except the TMS32020 (i.e., TMS320C25, TMS320C25-50, TMS320E25, and TMS320C26). In other TI literature, TMS320C2x normally refers to the entire second-generation family. This report will focus on TMS320C2x hardware interfacing. All second-generation TMS320 devices can address 64K 16-bit words in data space, 64K words in program space, and 16 16-bit wide I/O ports. The 128K-word address space for program and data memory can be utilized in applications that require large amounts of memory by interfacing external memories using the control signals of second-generation TMS320 devices. In other applications, the internal program and data resources of second-generation TMS320 devices can be used to implement single-chip solutions. Peripheral devices can be interfaced to second-generation TMS320 devices to perform analog signal acquisition at different levels of signal quality. This report suggests hardware design techniques for interfacing memories and peripherals to the TMS320C2x. Differences between the TMS320C2x and the TMS32020 are pointed out when appropriate. The first section presents the design interfaces of PROMs, EPROMs, and static RAMs (SRAM) to the TMS320C2x. Timing requirements of the processor and external memories are considered. The second section discusses the interface of a combo-codec (PCM coder-decoder), an analog-to-digital converter, and a digital-to-analog converter to the TMS320C2x. All interfaces in this report have been built and tested to verify their operation. Ready Generation Techniques This section describes techniques for generating the READY input signal for the TMS320C2x. READY can be used to extend external bus cycles by an integer number of machine cycles. The READY input thereby provides a means of interfacing the TMS320C2x to external devices that cannot be accessed at full speed, such as memory devices having access times longer than those required by the TMS320C2x. The access time (t a) of a given device determines the number of dormant cycles (wait-states) required for each access of that device. In general, N wait-states are required for a particular access if [ te(C) * (N-I) + ta(A) ] < ta < [ te(C) * N + ta(A) ] , N > 0 where te(C) is the period of CLKOUTl/2 (the reciprocal ofthe machine rate) and ta(A) is the access time from address specified in the appropriate second-generation TMS320 device electrical specification, Table 1 gives appropriate values ofN for several ranges ofta for a TMS320C25 operating Hardware Interfacing to the TMS320C2x ss with a 100 ns instruction cycle time and a TMS320C25-50 operating with a 80 ns instruction cycle time. Table 1. Number of Wait-States Required for a Memory or Peripheral Access TMS320C2S-S0 TMS320C2S Access Time Number of Wait States Required Access Time Number of Walt States Required 40 os 0 ta < 29 os 0 40 os < I. < 140 os 1 29 os < I. < 109 os 1 I. < 140 os < I. < 240 os 2 109" os < I. < 189 os 2 240 os < I. < 340 r.s 3 189 os < I. < 269 os 3 340 os < I. < 440 os 4 269 os < I. < 349 os 4 The timing requirements for generation of the READY signal are specified in the TMS320C25 electrical specifications by tsu(A) and td(SL-R) or td(C2H-R)' Figure 1. Ready Timing Requirement \"-------'/ / \ CLKOUT2 --------------J;ifI I \l ~I--------------" ~ I _ _ A1S-AJ1 RS,DS,LS,R/W t4- tSU(A) ~---)@(- READY~ READY (see Figure 1) must be valid no later than tsu(A) + td(SL-R) after the address bus and interface control signals (except STRB) become valid. This evaluates to tsu(A) + td(SL-R) =(0-11) + (0-20) =9 ns for a TMS320C25-50 operating with an input clock frequency of 50.0 MHz, and tsu(A) + td(SL-R) =(Q-12) + (Q-20) == 18 ns for a TMS320C25 operating with an input clock frequency of 40.0 MHz. Note that for bus cycles with wait-states, CLKOUT2 serves as'the timing reference, whereas for no-wait cycles either STRB or CLKOUT2 can be used as the timing reference. Any skew between these two signals may be disregarded as td(SL-R) and td(C2H-~) are guaranteed independently. 56 Hardware Interfacing to the TMS320C2x If all external bus cycles are to occur with no wait-states, READY can simply be tied high with a pull-up resistor. Extending all external bus cycles with one wait-state can easily be accomplished by connecting the MSC output to READY as shown in Figure 2. Figure 2. Connection for One Wait-State External Accesses 66 READY 1---....., TMS320C25-50 MSC 1 - - - ' 59 Similarly, MSC and the PS, DS, and IS signals can be used to generate wait-state mixes such as that resulting from the circuit in Figure 3. With this circuit, all program space accesses are one wait-state accesses while all data space and I/O accesses occur at full speed. Figure 3. Ready Generation for One Wait-State Program Space Accesses READY 1 - - - - - - , TMS320C25-50 Hardware Interfacing to theTMS320C2x 57 Applications having sufficiently simple address partitioning can make use of one or more levels of standard logic gates to generate READY. The circuit shown in Figure 4 has the following wait-state map: External Space Program Address Range Number of Walt-States OOOOh-7FFFh 1 Program 8000h-FFFFh 0 Data OOOOh-FFFFh 0 I/O OOOOh-OOOFh 1 Figure 4. Ready Generator with Simple Address Partitioning TMS320C25-50 1/374AS10 MSC 1 - - - - - 1 OS 1 - -......-------1 is 1-----1 A151--...J REAOYI----------------~ Note that this circuit just meets the READY specification of the TMS320C2S-S0 with READY guaranteed valid no later than 9 ns from address valid. TMS320C2S-S0 applications requiring more extensive address decoding will in most cases require the use of a high-speed programmable logic device to generate READY sufficiently fast. Two such devices are listed in Table 2. Table 2. High-Speed Programmable Logic Devices Manufacturer Part Number tpd (ns) TI TIBPAL16L8-7 PAL16L8-7 7.S .AMD 7.5 The wait-state generator shown in Figure 5 can be used to generate the READY signal for a TMS320C25 interfaced to external devices requiring up to 2 wait-states. A timing diagram for this circuit is shown in Figure 6. 58 Hardware Interfacing to the TMS320C2x Figure 5. 1\\'0 Wait-State Generator Design 1 kQ +5V-.~--~----------------------. '1~9 1/274ALS20A Q t-=6'---_-' 2 K 10 1/274ALS114A J 11 Q r------'::'-<\ Q 9 K CLR 1/274ALS114A FROM TMS320C2x: PR~ 8 CLR 8 READY § TO TMS320C2x CLKOUT2------~----r-------~ RS-------~----------~ t § Connections to other devices in the system that require two wait states. (Inputs not used by other devices should be pulled up.) Connections to other devices in the sysiem that require one wait state. (Inputs not used by other devices should be pulled up.) Connections to other devices in the system that require zero wait states. (Inputs not used by other devices should be pulled up.) Figure 6. Timing Diagram for 1\\'0 Wait-State Generator Design CLKOUT1 CLKOUT2 ps~b~~I~ ~ I ! : :VALID I I I I ==-=-----I~\LI MEMSEL I I I READY t1 I ONE WAIT STATE I I J J-l r- t3 -l 't-/r-~-. . . \. . . . ___ A15-A.Q., ~_______________ VALID ~ PS, OS, IS ...../VY\ ~ MEMSEL \'~------------~I 1 \.'---- TWO WAIT STATES READY _ _ _ _ _ _ _ _---J With this arrangement, READY is driven by a multiple-input NAND gate. This can be a standard gate such as a 74AS30 or can be part of the logic implemented by a high-speed programmable logic device. The output of this gate is low unless at least one of the inputs is low. The propagation delay of READY decode logic selecting zero wait-state devices in addition to the NAND delay Hardware Interfacing to the TMS320C2x 59 must be short enough to satisfy the READY specification discussed above. For zero wait-state accesses, the flip-flop J inputs are low, the Q outputs are high and neither flip-flop switches state. Now consider the circuit operation when a one or two wait-state device is selected. The Q output of each JK flip-flop is high at the start of the access, which can be considered to begin with the falling edge of CLKOUT2. All the inputs to the NAND gate generating READY are high and thus READY is low during the first cycle and the TMS320C25 inserts one wait-state. If a one wait-state device is decoded, the J input of the first flip-flop goes high. The 0 output goes low on the next falling edge of CLKOUT2 and READY goes high. If a two wait -state device is decoded, the J input of the second flip-flop goes high. Two cycles are required for this signal to propagate to the READY line. For each cycle, one wait-state is inserted. Referring to Figure 6, the following two inequalities must be satisfied in order for the setup time specification of the flip-flops to be met: 1) 2) t(decode) + t(NAND) + tsu(74ALS114A) < tsu(A) + 20 tp(74ALS114A) + t(NAND) + tsu(74ALS114A) < 40 where t(decode) is the pr?pagation delay of the decode logic for the selected device, t(NAND) is the delay associated with the NAND gate at the flip-flop input, tsu(74ALS114A) and tp(74ALS114A) are the data setup time and prop delay of the 74ALS114A, respectively, and 0 l/4tc(C). In Figure 6, = t1 = t(decode) t2 = t(NAND) + tsu(74ALS114A) and t3 tp(74ALS114A) + t(NAND)' = A third inequality must be satisfied for the READY specification to be met: 3) tp(74ALS114A) + t(NAND) < td(C2H-R) + 20 For a TMS320C25-50 operating at 50 MHz, inequality (1) evaluates to 1) t(decode) + 5 ns + 22 ns < 9 ns + 40 ns or t(decode) < 22 ns This inequality specifies the maximum decode time in order for the setup time specification of the pertinent flip-flop to be met. The remaining two inequalities are satisfied: 2) 19ns + 5ns + 22ns < 80ns 3) 19ns + 5ns < Ons + 40ns All three of these inequalities should be considered if different flip-flops and/or gates are used to implement the wait-state generator. Note that special considerations should be made with respect to READY timing ifthe TI Extended Development Support (XDS) in-circuit emulator is used. Please refer to TMS320 Second-Generation User's Guide[l] and/or Extended Development Support Products User's Guide (literature number SPYF001) for further details on READY timing requirements. 60 Hardware Interfacing to the TMS320C2x Interfacing Memories to the TMS320C25 This section describes interfaces of external memory devices to the 40 MHz speed version of the TMS320C25. Interfaces to PROMS, EPROMs, and SRAMS are included. Aseparate section is included in this document to describe memory interfaces to the TMS320C25-50. The TMS320C2x offers 544 words of RAM and 4K words of masked ROM. For prototyping and/or system expansion, however, external memories may be required. The speed, cost, and power limitations imposed by a particular application determine the selection of a specific memory device. If speed and maximum throughput are desired, the TMS320C2x can run with no wait-states. In this case, memory accesses are performed in a single machine cycle. Alternatively, slower memories can be accessed by introducing an appropriate number of wait-states or by slowing down the system clock. The latter approach is more appropriate when interfacing to memories with access times slightly longer than those required by the TMS320C2x at full speed. When wait-states are required, the number of wait-states depends on the memory access time (see Table Ion page 2). With no wait-states, the READY input to the TMS320C2x can be pulled high. If one or more wait-states are required, the READY input must be driven low during the cycles in which the TMS320C2x enters a wait-state. The TMS320C2x implements two separate and distinct memory spaces: program space (64K words) and data space (64K words). Distinction between the two spaces is made through the use of the PS (program space) and DS (data space) pins. A third space, the I/O space, is also available for interfacing with peripherals. This space is selected by the IS (I/O space) pin, and is discussed in the Interfacing Peripherals section of this report. The following brief discussion describes the TMS320C2x read and write cycles. A more complete discussion is contained in the Second-Generation TMS320 User s Guide. [1] Throughout this report, Q is used to indicate the duration of a quarter-phase of the output clock (CLKOUTI or CLKOUT2). Memory interfaces discussed in this report assume that the TMS320C2x is running at 40 MHz; i.e., Q = 25 ns. The memory read and write timings are shown in Figure 7. In a read cycle, the following sequence occurs: 1) Nearthe beginning of the machine cycle (CLKOUTI goes low), the address bus and one of the memory select signals (PS, DS, or IS) becomes valid. R/W goes high to indicate a read cycle. 2) STRB goes low in not less than tsu(A) =(Q -12) ns after the address bus becomes valid. 3) Early in the second half of the cycle, the READY input is sampled. READY must be stable (low or high) at the TMS320C2x no later than td(SL-R) = (Q - 20) ns after STRB goes low. 4) With no wait-states (READY is high), data must be available no later than ta(SL) = (2Q - 23) ns after STRB goes low. The sequence of events that occurs during an external write cycle is the same as the above, with the following differences: 1) R/W goes low to indicate a write cycle. 2) The data bus begins to be driven approximately concurrently with STRB going low. 3) The data bus enters a high-impedance state no later than tdis(D) = (Q + 15) ns after STRB goes high. Hardware Interfacing to the TMS320C2x 61 Figure 7. Read and Write Timings CLKOUT1 \ . . . ___--'1 '-- _A15-A.Qz ~ ______________ VALID \.fX\l')0 PS, OS, IS _ _ _I\l:L/"\ ~ lootI tSU(A) I --, STRB I: -------+--IX I I I I RiW~1 :-j I I I ~ 1 td(SL.R) : READY~~ : J-- ta(SL) -l 015-00 ! 1 I I I I ( ! DATA IN RiW~i --, READY )..------- I ~ :--td( LoR Am I . ~~~~~~~~ 015-00 ~ READ CYCLE DATA oU:-- tdIS(D) >@- WRITE CYCLE Interfacing with a PROM A convenient means of implementing program memory in a TMS320C2x system is provided through the use of PROMs. Two separate approaches for interfacing PROMs to the TMS320C2x are considered. The first approach does not require address decoding since the system contains only a small amount of one type of memory. The second approach illustrates an interface that utilizes address decoding to distinguish between two or more memory types with different access times. Direct PROM Interface An example of a no wait-state memory system is the direct PROM interface design shown in Figure 8. In this design, the TMS320C2x is interfaced with the Texas Instruments TBP38L165-35, a low-power, 2K x 8-bit PROM. The interface timing for the design of Figure 8 is shown in Figure 9. 62 Hardware Interfacing to the TMS320C2x Figure 8. Direct Interface of the TBP38L165-35 to the TMS320C2x TBP38L165-35 8 AO A1 A2 A3 A4 A5 AS A7 A8 A9 A10 xN U 0 N M (/) :::e I- PS STRB RiW 74ALS04 J10 00 01 02 03 04 05 06 07 AO A1 A2 A3 A4 20 G2 18 G3 19 18 G2 19 G3 00 01 02 03 04 05 OS 07 9 10 11 13 14 15 16 17 DO 01 02 03 04 05 06 07 H10 H11 +5 V 1k Q READY DO 01 02 03 04 05 OS 07 08 09 010 011 012 013 014 015 Hardware Interfacing to the TMS320C2x 20 G1 AO A1 A2 A3 A4 A5 AS A7 A8 A9 A10 9 08 10 09 11010 13011 14012 15013 16014 17015 TBP38L 1S5-35 63 Figure 9. Interface Timing of the TBP38L165-35 to the TMS320C2x CLKOUT1 I \ STRB -.,I 1 A15-~ PS ~ A \ 1 : . - tsu 1 VALID : I" 015-00 "---- tats) .. ' I ( :I" OATA'IN .. I 1 ~ t dls ) As discussed earlier, the TMS320C2x expects data to be valid no later than (20 - 23) ns after STRB goes low; this is 27 ns for a TMS320C2x operating at 40 MHz. The access times of the TBP38L165-35 are 35 ns maximum from address (ta(A», and 20 ns maximum from chip enable (taCS»· On the TMS320C2x, address becomes valid a minimum of tsu = (0 - 12) ns = 13 ns before STRB goes low (see Figure 1). The memory is not enabled, however until STRB goes low. Therefore, the data appears on the data bus within 27 ns after STRB goes low, as required by the TMS320C2x. Bus conflict may occur when a TMS320C2x write cycle is followed by a memory read cycle. In this case, the TMS320C2x data lines must enter a high-impedance state before the memory starts driving the data bus. In a write cycle, the TMS320C2x enters a high-impedance state no later than 15 ns after the beginning of the next cycle. Since the design of Figure 8 utilizes STRB to enable the TBP38L165s, these memories cannot drive the data bus before STRB goes low, i.e., 0 ns after the beginning of the cycle. Therefore, bus conflict is avoided since 25 ns > 15 ns. Note that the TMS320C2x R/W line is connected to the G2 enable line on both TBP38L165s. Therefore, the PROMs are disabled whenever R/W goes low, even ifSTRB is active. This prevents the bus conflict that occurs if the PROMs are written to when using the TBLW instruction, which transfers data from the data memory space to the program memory space. [1] Such transfers, however, were intended to be made only when RAMs are used in the program space. 64 Hardware Interfacing to the TMS320C2x The most critical timing parameters of the TBP38L165-35 direct interface to the TMS320C2x are summarized in Table 3. Table 3. Timing Parameters of the TBP38L165-35 Direct Interface to the TMS320C2x Description Address setup time TBP38L165-35 access time from chip enable TBP38L165-35 disable time Symbol Used In Figure 9 Value tsu t.(S) tdis 13 ns (min) 20 ns (max) 15 ns (max) PROM Interface with Address Decoding The second design example considers the interface of PROMs to the TMS320C2x using address decoding. A major issue when designing an interface with address decoding is that the TMS320C2x requires the READY signal to be stable no later than (0 - 20)ns after STRB goes low. Since the setup time for the address is (0 -12) ns, the TMS320C2x requires (worst case) a stable READY at least (20 - 32) ns after the address has been stabilized. This is 18 ns at 40 MHz. Proper address decoding may require two levels of gating. A third level of gating is required when more than one type of memories or peripherals with different numbers of wait-states is used. Using 'AS interface logic (the fastest currently available), these three levels of gating have a total propagation delay of 15 ns (worst case). Using a 74AS138 three-to-eight-line decoder to implement the first two levels of gating does will not result in any significant improvement in the propagation delay. (The 74AS138 has a maximum propagation delay of 9.5 ns for a high-to-low transition.) An approach that can be used to meet the READY timing requirements is shown in Figure 10. This design utilizes one address decoding scheme to generate READY, and a second address decoding scheme to enable the different memory banks. In this design, the memories with no wait-states are mapped at the upper half (upper 32K) of the program space. The lower half is used for memories with one or more wait-states. This decoding is implemented with the 74AS20 four-input NAND gate. The output of this gate is low when the following are true: 1) Address line A15 is high; i.e., the upper 32K words are selected. 2) DS and IS are high; i.e., an external program memory cycle is in progress. Hardware Interfacing to the TMS320C2x 65 Figure 10. Interface of the TBP38L165-35 to the TMS320C2x TMS320C2X AO A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A13 A14 A15 PS RiW TBP38L 165-35 K1 is READY STRB DO 01 02 03 04 05 06 07 08 09 010 011 012 013 014 015 66 00 01 02 03 04 05 06 07 A4 K7 L9 K9 L10 J10 H11 1 2 3 4 6 1 kQ KiO OS AO A1 A2 A3 74AS138 A G2B B C G2A Y4 G1 A5 A6 A7 A8 A9 A10 G1 20 5 G2 18 9 10 11 13 14 15 16 17 DO 01 02 03 04 05 06 07 G3 19 -: 11 MEMSE +5 V +5V 1 kQ J11 B8 H10 20 G1 AO A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 18 G2 19 G3 00 01 02 03 04 05 06 07 9 08 10 09 11 010 13 011 14012 15013 16014 17015 TBP38L 165-35 Hardware Interfacing to the TMS320C2x The timing of READY is shown in Figure 11. READY goes high 10 ns (worst case) after the address has become valid. Figure 11. Interface Timing of the TBP38L165-35 to the TMS320C2x (with Address Decoding) CLKOUT1 \ "- / \ / CLKOUT2 \ MEMSTRB I I I I I I I: I: ~ ~ -., MEMSEL I I I -.j READY I I I I I r4-t1 ~ I t4-t1 ~ : ~t2 X r I I :--t3 II / -.j ( 14- t dls \. I I I+-- t4 ~ 015-00 \ VALID I I I I I I I I DATA IN ) Address decoding is implemented by the 74AS138. This decoding separates the program space into eight segments of8K words each. The first four of these segments (lower 32K of address space) are enabled by the YO, Y1, Y2, and Y3 outputs of the 74AS138. These segments are used for memories with one or more wait-states. The other four segments select memories with no wait-states (the TBP38L165s are mapped in segment #5 starting at address 8000h). Note that in Figure 10, RIW is used to enable the 74AS138. This prevents a bus conflict from occurring if an attempt is made to write to the PROMs. In Figure 10, MEMSEL goes low no later than 10 ns (time t2 in Figure 11) after address is valid. The PROMs are not enabled, however, until MEMSTRB goes high, i.e., a minimum of 5 ns after STRB goes low (time t1 in Figure 11). Valid data appears on the data bus within 25 ns later. This meets the 27 ns or (20 - 23) ns access time required from STRB low by the TMS320C2x. Note that in the design of Figure 10, STRB is used to enable the PROMs so that no bus conflict occurs Hardware Interfacing to the TMS320C2x 67 if the memory read cycle is followed by a write cycle. As seen in Figure 11, the memory enters a high-impedance state within (t1 + tdis) =20 nsafter STRB goes high. Therefore, if a memory read cycle is followed by a write cycle, no bus conflict occurs since the TMS320C2x starts driving the data bus no earlier than Q ns after the beginning of the write cycle. The most critical timing parameters of the TBP38L165-35 interface with address decoding to the TMS320C2x are summarized in Table 4. Table 4. Timing Parameters of the TBP38L165·35 Interface with Address Decoding to the TMS320C2x Description Symbol Used in Figure 11 Propagation delay through the 74AS04 Propagation delay through the 74AS138 Address valid to READY TBP38L165-35 disable time 11 t2 t3 tdis Value 5 ns (max) 10 ns (max) 10 ns (max) 15 ns (max) In summary, when interfacing to PROM memories with the TMS320C2x, two different approaches can be taken depending on whether or not any of the memories in the system require wait-states. When no wait-states are required for any of the memories, READY can be tied high, and the interface to the PROMs becomes a direct connection. When some of the system memories require wait-states, address decoding must be performed, and a valid READY signal that meets the TMS320C2x timing requirements must be provided. An efficient method of accomplishing this is to use one section of circuitry to generate the address decode, and a second, independent section to generate the READY signal. EPROM Interfacing EPROMs may be used to debug TMS320C2x algorithms. Three different EPROM interfaces to the TMS320C2x are presented in this subsection. First, the direct interface of an EPROM that requires no wait-states is discussed. This is followed by descriptions of EPROM interfaces that require one and two wait-states. Direct EPROM Interface with No Wait·States A Texas Instruments TMS27C292-35 EPROM can interface directly to the TMS320C2x with no wait-states, as shown in Figure 12. The TMS27C292-35 is a CMOS EPROM with access times of 35 ns from valid address and 25 ns from chip select. The timing of the interface is shown in Figure 13. 68 Hardware Interfacing to the TMS320C2x Figure 12. Direct Interface of the TMS27C292-35 to the TMS320C2x TBP38L165-35 AO A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 00 01 02 03 04 05 06 07 A2 A3 A4 STRB~H~1~0~__________+-____-4 20 G2 18 9 10 11 13 14 15 16 17 DO 01 02 03 04 05 06 07 G3 19 J10 74AS04 PS~~------~ ~~+------+--~ +-__~__~ R~~H~1~1__________-4~____ +5 V 1 kQ 20 G1 AO A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 18 G2 19 G3 00 01 02 03 04 05 06 07 9 08 10 09 11010 13011 14012 15013 16014 17015 TBP38L 165-35 Hardware Interfacing to the TMS320C2x 69 Figure 13. Interface Timing of the TMS27C292-35 to the TMS320C2x CLKOUT1 \ / STRB -..,J I A15-~ PS \ A I I I r4- tsu ~ : r-- 015-00 'VAllO ta(S) :!4- --+l ( OATAIN ~ t dis ---: ) As shown in Figure 13, the EPROMs are not enabled until STRB goes low. Since the address has been valid for at least tsu = 13 ns before STRB goes low, valid data appear on the data bus ta(S) =25 ns (max) later. The EPROMs are disabled with STRB going high, and their output buffers enter a high-impedance state, tdis =25 ns (max) later. Therefore, no bus conflict occurs even if the memory read cycle is followed by a write cycle. The most critical timing parameters of the TMS27C292-35 direct interface to the TMS320C2x are summarized in Table 5. Table 5. Timing Parameters of the TMS27C292-35 Direct Interface to the TMS320C2x Description Address setup time TMS27C292-35 access time from chip enable TMS27C292-35 disable time Symbol Used in Figure 11 Value tsu tatS) tdis 13 ns (min) 25 ns (max) 25 ns (max) EPROM Interface with One Wait-State The hardware interface of the Wafer Scale WS57C64F-12 (8K x 8-bit EPROMs) to the TMS320C2x is shown in Figure 14. The WS57C64F-12s are mapped at address 2000h. The interface timing diagram is provided in Figure 15. 70 Hardware Interfacing to the TMS320C2x Figure 14. Interface of the WSS7C64F-12 to the TMS320C2x WS57C64F-12 11 00 12 01 13 02 15 A3 03 16 04 17 05 18 06 19 07 DO 01 02 03 04 05 06 07 +5V 1 2 3 4 6 74AS138 A B 14 MEMSEL Y1 C G2A G2B 5 G1 WAIT-STATE GENERATOR OF FIGURE8 (ONE WAIT STATE) 74AS30 A10 1 kQ 23 2 A11 PGM 27 A12 CE OE 22 20 OTSTR 08 09 010 011 012 013 014 015 13 15 16 04 17 05 18 06 19 07 +5V 1 kQ WS57C64F-12 Hardware Interfacing to the TMS320C2x 71 Figure 15. Interface Timing of the WS57C64F-12 to the TMS320C2x CLKOUT1 \ / / CLKOUT2 \ STRB \ I ~ / \' I: :1 I I I '-- t2 \J.. OTSTR "-- / \ I PS/RW. A15-AO ~ I ~ I MEMSEL READY I I I I I I I I : ~ VALID I I I I I I I '-- t1 \J.. i I I. ~' t3 I ( 015-00 I I I r \ ...-- t4 VALID --: )- The WS57C64-12 access times from valid address, chip select, and output enable are ta(A) = 120 ns (max),ta(CE) 120 ns (max), and ta(OE) ~ns (maxh!espectively. As shown in Figure 14, the 74AS138 is used for address decoding. PS and R/W are used to drive the G2A and G 1 enable.inputs of the 74AS 138, respectively. The latter prevents any bus conflict resulting from an accidental write (using the TBLW instruction) to the program space. MEMSEL going low t1 =10 ns (max) after address valid (see Figure 15) is used for two purposes: 1) to drive the wait-state generator, as discussed earlier; and 2) to generate a strobe signal, DTSTR, that activates the output buffers of the WS57C64-12s. = = Time t3 in Figure 15, is the time from valid address to valid data on the data bus, i.e., t3 =t1 + ta(CE) =130 ns (max). Since 40 ns < t3 < 140 ns, one wait-state is required. The wait-state generator of Figure 14 may be used to implement this wait-state. Also, note that the WS57CF64-12 is the slowest member of the WS57C64F EPROM series, and still meets the specifications for one wait-state. With STRB going high, the read has been completed. DTSTR is then used to turn off the memory output buffers. The output disable time of the WS57C64F-12 is tdis =35 ns (max). Time t4 in Figure 15 is used to indicate the time from STRB high to output entering a high-impedance state. With a propagation delay of tp =5.8 ns (max) through the 74AS32, t4 =tp + tdis =40.8 ns (max). Since this time is less than 50 ns (the earliest the TMS320C2x can start driving the data bus when the next instruction is a write). there is no bus conflict. 72 Hardware Interfacing to the TMS320C2x Table 6 summarizes the most critical timing parameters of the WS57C64F-12 interface to the TMS320C2x. Table 6. Timing Parameters of the WSS7C64F-12 Interface to the TMS320C2x Description Address valid to MEMSEL low STRB to DTSTR low TMS320C2x address valid to WS57C64F·12 data valid STRB high to WS57C64F-12 output disable Hardware Interfacing to the TMS320C2x Symbol Used in Figure 11 t1 t2 t3 t4 Value to.5 5.8 130.0 40.8 ns (max) ns (max) ns (max) ns (max) 73 EPROM Interface with Two Wait-States The interface of the TMS27C64-20 to the TMS320C2x is shown in Figure 16. The TMS27C64-20 is a CMOS 8K x 8-bit EPROM with an access time of 200 ns. The timing diagram is shown in Figure 17. Figure 16. Interface of the TMS27C64-20 to the TMS320C2x AO ~ A1 ~ A2 ~ A3 ~ A4 ~ A5 ~ L5 / A6 -:-:---' ~ AO ~ A1 ~ A2 ~ ~ ~4 01 02 03 04 05 06 A3 A4 A5 I'. I .. ---=-3 A6 ~ I'. .!::LJ ~ A9 :~~ A9 74ALS244A TMS27C64-20 TMS320C2x 2 4 6 8 11 113 5 07 19 ~:~ ~ 11 12 13 15 16 17 1 8 1Y1l-1:...;:8_..;;:0..;;:0..... 1Y21--1:...=6'----::0:.-:,1....... 1Y3l-1;..;4_...;;0...;;;2..... 1Y4....1c-2_...,:::0=3" 2Y11-:9:-----=O:-::4"" 2Y2~7_-.::0:.::5" 2Y3 r: <.:5:-----=0:-::::6....... 2Y4t-:3,-----=0:..:..7"" 2:; 2G 17 2A3 " 08 +5V I 1 kQ J ~; 1A 1 1A2 1A3 1A4 2A 1 2A2 ~F-~:...I A10 r" A10 PGM!if A11~ ~A11 A12 ~ 74AS138 ~ A12 G~ A 13WL~9~---11-fAA:--" E I-{:,..::9=-:-_..... 2-iB _ 20 A14 L.:K 'L1 0 3 C YO 1>-'-14-'--M~E~M....;S_E_L+-_ _~ A15 J10 ~ H11 4 G2A G2B 74AS32 r?-, ~R~~~~~c==:6~G~1~~~~*~l--JL---J:~~c=:' -..-/ DfSfR DOS ~ ~ 20 STRB H10 01 "'E1' 02 ~ 02 03 04 05 C1' 06 07~A2 08 09 ~ D1'" 'C'2" --e2' ""B3' 010~ 011 A4' 012"'B5'"' 013 ~A5 014 ~ 015~ READY B8 74 WAIT-STATE GENERATOR OF FIGURE 8 (TWO WAIT STATES) ~ ~ ~ i'----l. ~ E AO A1 A2 A3 A4 5 ~ ~ .0 .r>oo 74AS30 0.0 r-I 'I A5 A6 ~ 25:~ ~ A9 01 02 03 04 05 11 12 13 15 16 17 06 18 07 19 J 2 4 6 8 11 13 15 17 08 +5V 1G 1A1 1A2 1A3 1A4 2A1 2A2 2A3 2A4 2G 1Y1l-1;,.;;8_""0..;;,8,, 1Y21--1:...=6--::=:0,:;.9....... 1Y31--1:...:4~0~1:.::0....... 1Y41-:'1:=2-.::0~171'" 2Y1 ...9_...;;0-,1=2, 2Y21-'7_-::0~1.::,3, 2Y3 ...5'---..;;:0:...:1..;.4..... 2Y41-=3,----=0:,.:1.::,5, 1 kQ 74ALS244A 21-~ A10 PGM 27 ~A11 ~ A12 G ~__2 -:!:TMS27C64-20 - Hardware Interfacing to the TMS320C2x Figure 17. Interface Timing of the TMS27C64-20 to the TMS320C2x I CLKOUT1\ I CLKOUT2\ \ STRB I \ ~ I ~ MEMSEL READY I I I I I I I I I \ r \ I VALID A15-AO .-; \ t2 PS/RW,~ I I \ !: I .-; DTSTR I \ I I I I I I I I I I I ~tl \l i. 015·00 I t3 , .. 'I I \ --, VALID ~ t'- t4 ) With a 200-ns access time, two wait-states are needed. These can be implemented using the wait-state generator of Figure 14(a). Address decoding is similar to that used for the WS57C64F-12, and the TMS27C64 is mapped at address OOOOh. The memory cycle starts with address valid. MEMSEL becomes low tl =10 ns (max) later, due to propagation delay through the 74AS138. With MEMSEL active, valid data appear on the TMS27C64 data lines, ta =200 ns (max) later. As shown in Figure 16, the 74ALS244A octal buffers are used to buffer the memories from the TMS320C2x. These buffers are enabled with DTSTR, which is a logical-QR signal of both MEMSEL and STRB. The maximum propagation delay through these buffers is tp =10 ns. Therefore, valid data appear on the TMS320C2x data bus no later than t3 = t1 + ta + tp = 220 ns from valid address. This is the overall access time, and 140 ns < t3 < 240 ns, i.e., two wait-states are sufficient. With STRB going high, the TMS320C2x has completed the memory read. DTSTR follows STRB, and t2 = 5.8 ns (maximum propagation delay through the 74AS32) after STRB goes high; DTSTR also goes high. This forces the 74ALS244As to enter a high-impedance state 13 ns (max) later. Therefore, no later than t4 =(13 + 5.8) ns =18.8 ns after STRB goes high, the outputs of the 74ALS244As are in a high-impedance state (see Figure 12). Buffers were used because the disable time of the TMS27C64-20 is 60 ns, which will generate a conflict on the data bus. Hardware Interfacing to the TMS320C2x 75 Table 7 summarizes the most critical timing parameters of the TMS27C64-20 interface to the TMS320C2x. Table 7. Timing Parameters of the TMS27C64-20 Interface to the TMS320C2x Description Address Valid 10 MEMSEL low STRB low 10 DTSR low TMS320C2x address valid 10 TMS27C64-20 dala valid STRB high to TMS27C64-20 output disable Symbol Used in Figure 11 Value 11 12 13 10.5 ns (max) 5.8 . ns (max) 220.0 ns (max) t4 18.8 ns (max) In summary, EPROMs can be a valuable tool during the prototyping stages of a design, and may even be desirable for production. When EPROMs that are fast enough are used with the TMS320C2x, a direct interface similar to that used for PROMs may be used. When slower, less costly EPROMs are used, a simple flip-flop circuit can be used to generate one or more wait-states. With slower EPROMs, however, data output turnoff can be slow, and must be taken into consideration in the design. The same advantages are offered by the TMS320E25, which has an on-chip 4K-word EPROM in place of the 4K-word on-chip ROM of the TMS320C25. Interfacing SRAMS The TMS320C2x can utilize SRAM as either program or data memory. When used as program memory, object code can be downloaded into the RAM and executed. SRAM can also be used as data memory to extend the TMS320C2x's 544 words of internal RAM. In the first case, the SRAM is mapped into the TMS320C2x program space, while the second case maps the SRAM into the data space. The SRAM chosen for this interface is the Cypress Semiconductor CY7C169-25 4K x 4-bit SRAM. This SRAM has a 25-ns access time from address (ta(A») and a 15-ns access time from chip enable (ta(CE»)' Note that these access times are fast enough that a wait-state generator is not required for this interface. If, however, RAMs that require wait-states are used in the system,the wait-state genera'tor described in the Interfacing EPROMs subsection can be used. RAMs with a 4K x 4-bit organization are used in this application to minimize the package count for the desired number of words of memory being implemented. In this case, only four packages are required. In contrast, if 16K x 1-bit memories had been used, 16 packages would have been required, and much of the memory might have gone unused. In general, the choice of memory organization for a particular system should be based on the amount of memory required and the organization of the memories currently available in the industry. . The hardware interface to this RAM is shown in Figure 18, and a timing diagram of the interface is presented in Figure 19. 76 Hardware Interfacing to the TMS320C2x Figure 18. Interface of the CY7C169·25 to the TMS320C2x CY7C169·25 TMS320C2x AO~ A1~ A2~ A3~ A4~ A5~ ..!::L/ A7~ A6 A8~ A9~ A10~ A11~ 1/01 1/02 1/03 1/04 ..;:..;...;. b ~ REAOy~B~8----~~~ 74A~g - OS K10 - 74AS32 74AS138 A 15 L1 0 3 A Y11>-'-14,,--~ A14 K9 2 B lJ+5 V A 13 L9 1 C 4~ G2A 1kQ STRB H10 5 G2B G1 RNi H11 6 1 OO~ 01~ IE1 ~ 02~ 03~ 04~ 05 06 07 08 '"'C1"" "'B2' "A2" AO A1 A2 A3 A4 AS A6 16 17 18 19 1 AO A1 A2 A3 A4 2 3 AS '-:":A7=-"':4~ A6 A8 5 A7 '"'A--9"----'6'-i A8 '-A:..:1=-0----'7~ :~ 0 MEMSEL 15 1/01 14 1/02 13 1/03 12 11/04 15 14 1/02 13 1/03 12 1/01 JLQi 15 1/01 14 8 9 ~~ 1/02 13 '-------=1=<11 ~S 1/03 12 W 1/04 A11 15 14 13 12 DO 01 02 03 04 05 06 07 08 09 010 011 012 013 014 015 -s3' 09~ 010~ 011~ 012~ 013~ AS " 014 "i3"6"" L...-_....;;;0;..;.15;;;.!~ Hardware Interfacing to the TMS320C2x 77 Figure 19. Interface Timing of the CY7C169·25 to the TMS320C2x CLKOUT1 '" I , \,--- I OS, A15·AO VALID ~~--------------~ I : I I I I I I I I I I READY STRB. Rm I ,...t1 MEMSEL '---- / \ ,!I"-_ _ _ _ _ _ _ I: J I I I Utt/ I I I I I --1 I I -l I: ~-------,., I I I ) -l I I M§?2 \ I: '--------~""':ir__ tg I @&M TMS320C25 015-00 :--t7 m ~------------)~---I. 1/04-1/° 1 : I-lt;.....-I , t--to; ~ MEMSEL READ CYCLE I I I I ts CY7C169-25 t3 ....., \l CY7C169-25 015·00 Rm I I :--t2 I l- t4 "1 TMS320C25 015·00 I ts 'msm- WRITE CYCLE => The design of Figure 18 utilizes a similar approach to the one described in the Interfacing PROMs and Interfacing EPROMs subsections; i.e., one address decoding scheme is used to generate READY, and a second address decoding scheme is used to enable the SRAM. In this design, RAMs with no wait-states are mapped at the lower half (lower 32K words) of the TMS320C2x data space. The upper half is used for memories with one or more wait-states. This decoding is implemented with the 74AS32 two-input OR gate. The output of this gate is low (active) whenDS is low (i.e., access to external data space requested), and A15 is low (i.e., lower 32K words selected). Time tl in Figure 19 indicates the time from valid address to READY going high. The maximum value for tl is tl =1p(74AS32) + tp(74AS30) =(5.8 + 5) ns =10.8 ns where tp(X) denotes the maximum propagation delay through device X. 78 Hardware Interfacing to the TMS320C2x As shown in Figure 18, address decoding that enables the RAM is implemented with the 74AS138. This decoding separates the data space into eight segments with 8K words per segment. The first four segments are enabled by the YO, Y1, Y2, and Y3 outputs of the 74AS138. These segments are used for memories with no wait-states. Note, in Figure 18, that the CY7C169s are enabled by Y1; i.e., the memories are mapped at address 2000h. The rest of those segments, enabled by the other outputs ofthe 74AS138 decoder, are used for memories with one or more wait-states. Memory Read Cycle Figure 19 shows the timing for memory read and write cycles. In a read cycle, R/W goes high concurrently with valid address, indicating that a read rather than a write cycle has been initiated. With STRB used to enable the 74AS 138, MEMSEL goes low no later than t2 = 8.5 ns after STRB goes low. This is the maximum propagation delay of the 74AS138 before outputting a high-to-low transition from the Genable pin. The CY7C169s begin driving the data bus no earlier than ts =5 ns after MEMSEL goes low. By then, all of the devices having access to the data bus must have entered a high-impedance state. Figure 19 shows the TMS320C2x data lines entering a high-impedance state no later than t4 =15 ns after the beginning of the read cycle. This is the case when the present read cycle is preceded by a write cycle. The RAMs provide valid data no later than t6 =15 ns after MEMSEL goes low. Therefore, the worst-case access time from STRB going low is t2 + t6 =23.5 ns. This meets the 27-ns access time required by the TMS320C2x operating at 40 MHz. The TMS320C2x read cycle is concluded with STRB going high. MEMSEL follows STRB and goes high within t3 =7.5 ns. This time is the maximum propagation delay through the 74AS138 for a low-to-high transition. The CY7C169 data lines enter a high-impedance state no later than t7' =15 ns after MEMSEL goes high. Therefore, no bus conflict occurs if the present read cycle is followed by a write cycle. Memory Write Cycle As shown in Figure 19, the memory write cycle is similar to the read cycle with the exception that RiW is low. The TMS320C2x begins driving the data bus as soon as STRB goes low, while MEMSEL follows STRB within 12 = 8.5 ns. Since R/W is low when MEMSEL goes low, the CY7C169s do not drive the data bus. Data is clocked into the CY7C169s on the rising edge of MEMSEL. Time t8 in Figure 19 is the time that data is valid before MEMSEL goes high. This time is no less than the TMS320C2x minimum data setup time before STRB goes high (t8 (20 - 20) ns 30 ns when operating at 40 MHz) plus the 2-ns minimum propagation delay through the 74AS138. Therefore, t8 is equal to or greater than 32 ns. Note that this time meets the 10-ns minimum data setup time required by the CY7C169. = = Table 8 summarizes the most critical timing parameters that must be considered when interfacing the CY7C169s with the TMS320C2x. Hardware Interfacing to the TMS320C2x 79 ,Table 8. Timing Parameters of the CY7C169-25 Interface to the TMS320C2x Description Symbol Used in Figure 11 Address valid to READY valid STRB low to MEMSEL low STRB high to MEMSEL high CLKOUTI low to TMS320C2x data bus entering the high-impedance state MEMSEL low to CY7C169-25 driving MEMSEL low to CY7C169-25 data valid MEMSEL high to CY7C169-25 entering the high-impedl!nce state Data setup time for a write Data hold time Value tl t2 t) t4 10.8 8.5 7.5 15.0 ns ns ns ns (max) (max) (max) (max) ts t6 t7 5.0 ns (min) 15.0 ns (max) 15.0 ns (max) ts t9 32.0 ns (min) 7.5 ns (min) In summary, interfacing external RAM to the TMS320C2x is quite useful for expanding the internal data memory or implementing additional RAM program memory. In cases where RAMs of different execution times are used, separate schemes for address decoding and READY generation can be used to meet READY timing requirements in a similar manner to that used for the PROM interface as described in this report. RAMs with similar access times may then be grouped together in one segment of memory. Interfacing Memories to the TMS320C2S-50 TMS320C25-50 memory interfaces are similar or identical in form to those of the 40-MHZ version of the TMS320C25. In many cases, the interfacing techniques given in the preceding sec.. tion can be used, with higher-speed versions of the memory devices substituted. This section describes the memory interface timing requirements of the TMS320C25-50. Determining appropriate memory device speeds requires an understanding ofTMS320C25-50 external bus cycles and the timing specification of the device. The following excerpt from the TMS320C25-50 Electrical Specification and Figure 20 show the information necessary to determine the minimum memory device speed for a given application. Min t.(A) tsu(A) tsu(D)R 80 0-11 17 Max Units 3Q-31 ns ns ns 1 Hardware Interfacing to the TMS320C2x Figure 20 shows a TMS320C25-50 memory read and write cycle. Either of two timing requirements must be satisfied to guarantee a successful read operation. These two requirements are specified by ta(A) and tsu(D)R' Note that it is not necessary to satisfy both requirements, as each parameter is guaranteed independently. Figure 20. TMS320C2S·S0 Memory Read and Write Cycle CLKOUT1 \ _A15-A.Q. PS, OS, IS ~ I.X --, STRB '--- / ------~! 1 1 1 I: tsu(A) 1 1 RfN~! 1-1 ~ VALID 1 1 r- ! I td(SL.R) ~ ' REAOY~~ I 015-00 i j-- ta(SL) -I !! 1 1 _~II R/W~I ( READ CYCLE DATA IN )>------- 1 1 - I I REAOY~ 1 WRITE CYCLE toe-- tdls(D) - - - : 015-00 - - - - - - - @ < O A T A O U T ) @ _ Hardware Interfacing to the TMS320C2x 81 A timing requirement of special interest is the memory access time measured from the falling edge of STRB. The specification of this requirement is jointly implied by the device ta(A) and tsu(D)R specifications as shown in the following. ta(A) is defined as follows: ta(A) =tsu(A)min + tw(SL) + tr(C) - tsu(D)Rmin For convenience, define tw(S) as follows: 1w(S) =tw(SL) + tr(C) Then ta(A) is given by ta(A) =tsu(A)min + tw(S) - tsu(D)Rmin The ta(A) specification guarantees that ta(A) > ta(A)max or tsu(A)min + tw(S) - tsu(O)Rmin > ta(A)max The above inequality is potentially confusing in that it guarantees a minimum on a parameter with a max subscript. As with any parameter specified as a maximum, the measured ta(A) value of a given device must be greater than the specified maximum in order for the device to pass the ta(A) test performed on the device. In this way, all values of ta(A) less than ta(A)max are guaranteed to meet the device ta(A) requirement. ta(A)max is specified as ta(A)max =30-35 ns ta(A)max =30-31 ns (40 MHz TMS320C25) (TMS320C25-50) Thus, the following inequalities are guaranteed: 0-12 + tw(S) - 23> 30-35 0-11 + tw(S)-17 > 30-31 (40 MHz TMS320C25) (TMS320C25-50) which evaluate to tw(S) > 20 tw(s) > 20-3 (40 MHz TMS320C25) (TMS320C25-50) The ta(A) specification thus implies a minimum value for tw(S). On a memory read cycle, data must be valid no later than tsu(D)Rmin prior to STRB going high. The maximum access time from STRB low (define this as ta(SL») is thus ta(SL)max or =tw(S)min =20 - 23 tsu(D)Rmin =(2Q-3) -17 =2Q-20 (40 MHz TMS320C25) (TMS320C25-50) The specification of ta(SL) typically determines the maximum access tim~ from chip select andlor output enable for a memory device, as discussed in the following sections. Note that the 82 Hardware Interfacing to the TMS320C2x specification of the minimum value of tw(SL) (STRB -low pulse width) is in no way involved in assessing access time from address or from STRB going low. Full-Speed Interfaces The TMS320C25-50 can be interfaced to fast SRAM with no wait-states. Two key memory device specifications for such an interface are access time from address valid and access time from chip select and/or output enable. The key TMS320C25-50 timing requirements are specified by ta(SL) and ta(A)' If STRB is an input to logic that generates the chip select and/or output enable signal for a memory device, data must be guaranteed valid no later than ta(SL) - td from STRB falling, where td is the delay imposed by the logic used to generate the chip select or output enable signal. Typically, devices with both chip select and output enable signals can more easily accommodate the ta(SL) requirement, as STRB can directly serve as the output enable signal (active low), resulting in the condition td =O. Logic internal to the memory device enables the device's input or output buffers (depending on the state ofR/W) only if the chip is selected via its chip select input. Interfaces to memory devices having a chip select input but no output enable input will include chip select logic having STRB as one of its inputs. In these cases td is nonzero and thus the requirement on access time from chip select is tightened. Hardware Interfacing to the TMS320C2x 83 Figure 21 shows a TMS320C25-50 interfaced to 8K-words of full-speed SRAM and 8K-words of two wait-state EPROM. The operation of this circuit is discussed in the following section. Figure 21. TMS320C25-50 Interfaced to Full-Speed SRAM and Two Wait-State EPROM ,.:. . 8,.:. 0 0 00 • 0 0 I~- ~ 0 ~ '" 74AL5244A 11;- l 0 0 ,.:. '" 0 I 10 ICl-<>-/> c-- TM527C64·15 ~ I~ W U 0 N ~ ~ N ::Ii a: ~ a: U l:l'" ::Ii t- 84 Hardware Interfacing to the TMS320C2x Full-Speed SRAM in Program Space The cost and/or availability of non-volatile memory devices able to support TMS320C25-50 full-speed program execution may be prohibitive for some applications. (One such device is the Cypress Semiconductor 2K x 8 EPROM, part number CY7C291A-25.) The program code for Figure 21 can be stored in EPROM and self-booted into the SRAM devices at powerup for subsequent full-speed execution. Table 9 shows the wait-state map for this circuit. Note that the READY generation logic for this arrangement is simple enough that inexpensive gates can be used for its implementation. Refer to the Ready Generation Techniques section earlier in this report for details of operation of the READY generation logic. Table 9. Wait-State Map for Circuit of Figure 21. External Space Program Program Data I/O Address Range Number of Wait-States OOOOh-7FFFh 8000h-FFFFh OOOOh-FFFFh OOOOh-OOOFh 2 0 0 1 The TI TMS27C64 EPROM devices reside in the two wait-state portion of program space at locations 0000h-1FFFh; the Micron MT5C6408-20 SRAM devices reside in the zero-wait portion of program space at locations 8000h-9FFFh. Timing Analysis Figure 22 shows the interface timing for accesses of the TMS27C64 EPROMs. Key timings are listed in Table 10. The output disable time of the TMS27C64 is too long to guarantee that no bus conflict will occur if an external write cycle follows a TMS27C64 read cycle; this is solved by buffering the data lines with TMS74ALS244A octal buffer lCs. Figure 22. Interface Timing for Accesses ofTMS27C64-15 to the TMS320C25-50 ! CLKOUT1 \ ! \ CLKOUT2 STRB ! \ ! \ PS/RW.~ A15-AO t1 --' PROM READY ! \ ! \ \ IiI : ~ VALID te- :\{ I I I I- 015-00 Hardware Interfacing to the TMS320C2x '-- I I I ! t2 I --' ~ { VALID ;- 'te- t3 }- 85 Table 10. TMS27C64 Interface Timing Parameters Parameter Name Designation in Figure 22 Address valid to PROM valid PROM valid to TMS27C64 data valid Address valid to TMS320C25 data valid STRB high to TMS74ALS244A outputs high-Z Time Duration 5.8 150 165.8 18.8 tl t2 t3 ns ns ns ns (max) (max) (max) (max) As shown in Figure 11, data is valid on the TMS27C64 data lines 5.S ns + 150 ns (max) after address becomes valid. The delay through the TMS 74ALS 244A buffers is 10 ns (max). Data is valid on the TMS320C25-50 data bus t1 + t2 +10 165.8 ns (max) after address valid. Thus the inequality t1 + t2 + 10 (max) < ta(A) + Ntc(C) is satisfied; 165.8 ns < 29 ns + 2 * 80 ns. Note that tc(C) is assumed to equal 80 ns. The buffer outputs are set in the high-impedance state t3 5.S ns + 13 ns 18.8 ns (max) after STRB goes high. = = = Figure 23 shows the interface timing for accesse.s of the MT5C640S SRAMs. Key interface timing parameters are given in Table 11. Figure 23. Interface Timing for Accesses of the MT5C6408-20 to the TMS320C25-50 A15.A..Qz~ i we VALID PS, OS, IS ~ ,. t1 ! READY \ STRB R/W 1#1 I: I I I I I I I I I I I I I I I I I I I -I :- t2 I I: SRM2 TMS320C25·50 015·00 ) I I I I I I ~ R/W ~ t--ts I I I TMS320C25-50 015·00 86 ~ '@@ \ READ CYCLE : - - t4 ---.! t- t3 - I MTSC640a-20 OQa·OQ1 '-- I - :I I I ~ ~ ~t4 ----: ~ }WR~ CYCLE Hardware Interfacing to the TMS320C2x Table 11. MTSC6408-20 Interface Timing Parameters Read Cycle Parameter Name Designation in 23 Address valid 10 READY valid Address valid 10 SRM2 valid Address valid to SRMI valid SRMl/SRM2 valid 10 dala valid STRB high 10 data bus high-Z II 12 13 14 Time Duration 9 9 9 20 15 os os os os os (max) (max) (max) (max) (max) Write Cycle Parameter Name Designation in Figure 23 Address valid 10 READY valid Address valid 10 SRM2 valid Address valid 10 SRMI valid Data valid before STRB high STRB high to data bus high-Z 11 t2 ts t4 Time Duration 9 9 9 23 15 os os os os os (max) (max) (max) (max) (max) The SRAMs are enabled if CEl is low and CE2 is high. CE2 is high when IS, DS, and A15 are high. (Making use of the fact that the 3 external spaces are mutually exclusive and exhaustive, 1 gate delay is saved by using IS and DS rather than PS. This is crucial for satisfying the READY timing requirement.) CE1 is driven directly by STRB. The function of the DE input of the MT5C6408s is the inverse of that of the WE input. Read Cycle As shown in Table 11, both chip enable inputs are valid no later than 9 ns from address valid. Data is valid no later than 20 ns after CE1 and CE2 are valid, thus satisfying the condition ta(SL) :S ta(SL)max' The outputs are tristated no later than 15 ns from STRB high. Write Cycle As shown in Table 11, both chip enable inputs are valid no later than 9 ns from address valid. Data is valid 23 ns (min) prior to STRB going high, satisfying the MT5C6408 data setup time requirement of 12 ns (min). The outputs are tristated no later than 35 ns from STRB high. The complete electrical specifications and additional information pertaining to the TMS320C25-50 may be found in the Second-Generation TMS320 User's Guide. [1 ] System Control Circuitry A system control circuitry performs important functions in system initialization and operation. A powerup reset circuit design and a crystal oscillator circuit design are presented in this section. Reset Circuit The reset circuit shown in Figure 24 performs a power-up restart operation; i.e., the TMS320C2x is reset when power is applied. Note that the switch circuit must contain debounce Hardware Interfacing to the TMS320C2x 87 circuitry. Driving the RS signal low initializes the processor. Reset affects several registers and stafilS bits. For a detailed description of the effect of reset on the processor status, refer to the Second-Generati9n 1'1.1S320 User's G~ide.[lJ Figure 24. Powerup Reset Circuit TMS320C2x +5V R1=100 kQ 4.71!F T "::' r lOGNO For proper system initialization, the reset signal must be applied for at least three CLKOUT cycles; i.e., 300 ns for a TMS320C2x operating at 40 MHz. Upon powerup, however, it can take up to hundreds of milliseconds before the system osciUator reaches a stable operating state. Therefore, the powerup reset circuit should generate a low pulse on the reset line until the oscillator is stable (between 100 and 200 ms); Once a proper reset pulse has been applied, processor operation begins at program memory location 0 which normally contains a branch (B) statement to direct program execution to the system initialization routine. The voltage on node A is controlled by the Rl CI network (see Figure 24). After a reset, the voltage rises exponentially to the time constant RICI, as shown in Figure 25. Figure 25. Vo~tage on tbe ',fMS320C2x Reset Pin VOLTAGE I Vee V=VeC<1- e-Itt) ------------------------=-~~~-~~------~---- TIME 88 Hardware Interfacing to the TMS320C2x The duration of the low pulse on the reset pin is approximately tl, which is the time it takes for the capacitor Cl to fully charge; i.e., 1.5 V. This is approximately the voltage at which the reset input switches from a logic level 0 to a logic level 1. The capacitor's voltage is given by V:: Vee [I-e-f] ., where (1) 1: :: R 1Cl is the reset circuit time constant. Solving (1) for t gives: (2) Setting the following: RI CI V Vee :: = = = 1 MQ 0.47 flF VI =1.5 V 5V gives t =tl =167 ms. The Schmitt triggers shown in Figure 25 appropiately reshape the signal on node A.Therefore, the reset circuit of Figure 24 can generate a low pulse of an appropriate duration (167 ms) to ensure the stabilization of the system oscillator when most systems are powered. Crystal Oscillator Circuit The crystal oscillator circuit shown in Figure 26 is suitable for providing the input clock signal to any TMS320C2x device except the TMS32020. Since crystals with fundamental oscillation frequencies of 30 MHz and above are not readily available, a parallel-resonant third-overtone oscillator is used. If a packed clock oscillator is used, oscillator design is of no concern. Figure 26. Crystal Oscillator Circuit TMS320C2x +5V fcrystal o 4.7kQ 74AS04 rI 10 kQ C= 20 pF -- 0.1 !iF . L - The 74AS04 inverter in Figure 26 provides the 180-degree phase shift that a parallel oscillator requires. The 4.7-kQ resistor provides the negative feedback that keeps the oscillator in a stabre Hardware Interfacing to the TMS320C2x 89 state; i.e., the poles of the system are constrained in a narrow region about the j axis of the s-plane (analog domain). The 10-kQ potentiometer is used to bias the 74AS04 in,the linear region. This , potentiometer is adjusted as follows: Before the crystal is placed on the system board, adjust the potentiometer so that the voltage at the input of the inverter is in the transition region between a logic level 0 and a logic level 1 (i.e., approximately 1.5 V). Then install the crystal. In a third-overtone oscillator, the crystal fundamental frequency must be attenuated so that oscillation is at the third harmonic. This is achieved with an LC circuit that filters out the fundamental, thus allowing oscillation at the third harmonic. The impedance of the LC network must be inductive at the crystal fundamental frequency and capacitive at the third harmonic. The impedance of the LC circuit is given by: Z(w) L = C j[L- (3) ':cl Therefore, the LC circuit has a pole at: (4) At frequencies significantly lower than wP' the 1/(wC) term in (3) becomes the dominating term while wL can be neglected. This gives: z(w) = jwL, for w < < wp (5) In (5), the LC circuit appears inductive at frequencies lower than wp. On the other hand, at frequencies much higher than wp, the wL term is the dominant term in (3), and 1/(wC) can be neglected. This gives: 1 z(w) = -.JWC forw» wp (6) The LC circuit in (6) appears increasingly capacitive as frequency increases above wp. This is shown in Figure 27, which is a plot of the magnitude of the impedance of the LC circuit of Figure 26 versus frequency. Based on the discussion above, the design of the LC circuit proceeds as follows: Choose the pole frequency wp approximately halfway between the crystal fundamental and the third harmonic. The circuit now appears inductive at the fundamental frequency and capacitive at the third harmon~ ic. In the oscillator of Figure 26, choose wp = 166.5 rads/s for the 40.96 MHz design or wp = 223.6 for the 51.2 Mflz design. These angular frequencies lie approximately halfway between the respective fundamentals and third harmonics. Choose C =20 pF. The appropriate value ofL may then be computed using (4). Values ofL for three differentTMS320C2x devices operating at different frequencies are tabulated in Table 12. 90 Hardware Interfacing to the TMS32OC2x Table 12. Values of fcrystal and L for TMS320C2x Devices TMS320C25 TMS320C25-50 TMS320E25 fcrysta' (MHz) L (IlH) 40.96 51.20 40.96 1.8 1.0 1.8 Figure 27. Magnitude of the Impedance of the Oscillator LC Network IZ (00) I INDUCTIVE REGION CAPACITIVE REGION 00 (rad/s) The 0.1 fA.F capacitor in series with the 1.8 fA.H inductor is a coupling capacitor, requiring no DC path to ground. The 74AS04 inverter is included to shorten the rise and fall times of the waveform generated by the oscillator. Consider the case where the TTL inverter goes low. In this case, the current flowing through the 10-kQ resistor is less than 5 VIlO-kQ =0.5 rnA. This is an acceptable current level since the 74AS04 inverter can sink up to 20 rnA. The output of the oscillator drives the CLKIN input of the TMS320C2x, thus providing the four phases required for each machine cycle. With a 40.96 MHz input clock frequency, the TMS320C2x machine cycle is 97.6 ns. In summary, the system control circuitry performs functions that, while often overlooked, are critical for proper system initialization and operation. The powerup reset circuit assures that a reset of the part occurs only after the oscillator is running and stabilized. The oscillator circuit described allows the use of third-overtone crystals that are more readily available at frequencies above 20 MHz. Interfacing Peripherals Most DSP systems implement some amount of I/O using peripherals in addition to any memory included in the system. Quite commonly this includes analog input and output, which can Hardware Interfacing to the TMS320C2x 91 be performed through the parallel and serial I/O ports on the TMS320C2x. In this section, hardware interfaces of the TMS320C2x to a codec, an analog-lo-digital converter (AID), and a digital-to-analog converter (D/A) are described. Interfacing TMS320 devices to the Texas Instruments TLC32040 Analog Interface Chip is described in the applications report Interfacing the TMS320 Family to the TLC32040 Family found in this book. Combo-Codec Interface In speech, telecommunications, and many other applications that require low-cost analog-to-digital and digital-to-analog converters, a combo-codec may be used. Combo-codecs are single-chip pulse-code-modulated encoders and decoders (PCM codecs). They are designed to perform the encoding (AID conversion) and decoding (D/A conversion), as well as the anti aliasing and smoothing filtering functions. Since combo-codecs perform these functions in a single 300-mil DIP package at low cost, they are extremely economical for providing system data conversion functions. The design presented here uses a Texas Instruments TCM29C16 codec, interfaced using the serial port of the TMS320C2x. TMS320C2x Serial Port The TMS320C2x serial port provides direct synchronous communication with serial devices. The interface signals are compatible with codecs and other serial components so that minimum external hardware is required. Externally, the serial port interface is implemented using the following pins on the TMS320C2x: • DX (transmitted serial data) • CLKX (transmit clock) • FSX (transmit framing synchronization signal) • DR (received serial data) • CLKR (receive clock) • FSR (receive framing synchronization signal) Data on DX and DR are clocked by CLKX and CLKR, respectively. These clocks are only required during serial transfers. Note that this is different from the TMS32020 serial port in which the clocks must be present at all times if the serial port is being used. Also, the TMS320C2x serial port is double-buffered while that of the TMS32020 is not. Serial port transfers are initiated by framing pulses on the FSX and FSR pins for transmit and receive operations respectively. For transmit operations, the FSX pin can be configured as an input or output. This option is selected by the transmit mode (TXM) bit of status register STl. [1] In this design, FSX is assumed to be configured as an input; therefore, transmit operations are initiated by a framing pulse on the FSX pin. Upon completion of receive and transmit operations, an RINT (serial port receive interrupt) and an XINT (serial port transmit interrupt) are generated, respectively. The format (FO) bit of status register STl is used to select the format (8-bit byte or 16-bit word) of the data to be received or transmitted. For interfacing the TMS320C2x to a codec, the format bit should be set to one, formatting the data inS-bit bytes.[l] 92 Hardware Interfacing to the TMS320C2x After the information from the codec is received by the TMS320C2x, the f.A.- or A-law companded data must be converted back to a linear representation for use in the TMS320C2x. Software companding routines appropriate for use on the TMS320C2x are provided in the book, Digital Signal Processing with the TMS320 Family Volume 1.[2] The software required to initialize the TMS320C2x-codec interface is shown next. The initialization routine should include the following: INIT DINT FORT LACK LDPK SACL 1 Disable interrupts ; Set 8-bit data format lOh 0 DMA4 Enable RINT (through IMR) * * * EINT ; Enable interrupts Note that since reset initializes the TXM (transmit mode) and FSM (frame synchronization mode) bits to the values required by this interface, it was not necessary to explicitly initialize these values in the routine shown above. However, in digital communications with peripherals!devices! ports (T 1 trunks) that do not require a framing pulse for every byte!word transmitted, the FSM bit must be set to 0 using the RFSM instruction. [1] The interrupt mask register (IMR) located at data memory location 4h of the TMS320C2x data memory is used to enable the serial port receive interrupts (RINT). To access that memory location, the data page pointer must be set to zero. Also, the data page pointer must be initialized after reset since its contents are random at powerup. A value of 10h in the IMR enables only the RINT; all other interrupt sources are disabled. Interrupts are disabled upon reset. Before exiting the initialization routine, interrupts are reenabled with the EINT instruction. Hardware Interfacing to the TMS320C2x 93 The hardware interface between the TMS320C2x and the TCM29C16 combo-codec is shown in Figure 28. Figure 28. Interface of the TMS320C2x to the TCM29C16 Codec +5V TMS320C2x DR :~1 ~~~~~T~C~M~2~9C~1~6 100kQ Vee AIN- ...1,,-,4..--.NIfI-_lt_-..-..-<. 11 PCMOUT DXt-7:~--_6'PCMIN ClKX A9 FSXJ-'B::..:9"--4""';':':'4"o=t GSX PWRD+ DClKR 5 ANALOG OUTPUT 100kQ -5V 74HC390 11 CKA 1OA!-=3:........<~14~ ClK 7 100 1 50 2 51 11 ENT 23 ENP +5 V ClKIN J-'F-.:1..:.,1_____....-..::3i> AS R1= 1 MQ 74A5869 RCO H G 7 A B A8 6 +5V +5V 10kO ~ - ANALOG GROUND ic 11 ~C=20 pF 74AS04 0, F . • l=1.8 IlH ~- DIGITAL GROUND Clock Divider Circuit A combo-co dec configured in the fixed-data-rate mode requires the following external clock signals: . A 2.048-MHz clock to be used as the masterclock, and 8-kHz framing pulses required to initialize the data transfers. Both of these signals can be derived from the 40.96 MHz system clock with appropriate divider circuitry. This is the primary justification for selecting 40.96 MHz as the system clock fre94 Hardware Interfacing to the TMS320C2x quency. The clock divider circuit consists of a 74AS74 D-type flip-flop, a 74HC390 decade counter, and a 74AS869 8-bit up/down counter. The hardware connections between these devices are shown in Figure 28. To generate the 2.048-MHz master clock for the combo-codec, a division by 20 of the 40.96-MHz system clock is required. The 74HC390 contains on-chip two divide-by-2 and two divide-by-5 counters. Since the 74HC390 cannot be clocked with frequencies above approximately 27 MHz, a 74AS74 configured as a T-type flip-flop is used. This implements a divide-by-2 of the 40.96-MHz clock, thus making the output of the 74AS74 slow enough (20.48 MHz) to properly clock the 74HC390. The to-kQ pullup resistor shown in Figure 28 is used to ensure the compatibility between the logic levels of the TTL (74AS74) and HCMOS (74HC390) devices. The 74HC390 is first used to implement a divide-by-5, which appears at the output pin 10D (pin #7) of the 74HC390 (see Figure 28). This in turn drives the divide-by-2 counter, at the output of which (pin lOA) the 2.048 MHz clock appears. Note that the divide-by-5 precedes the divide-by-2 because the codec requires a clock with a minimum duty cycle of 40 percent, while the output of the divide-by-5 has a duty cycle of only 20 percent. By following the divide-by-5 counter with the divide-by-2, the duty cycle at the output of the 74HC390 is 50 percent. = = The 7'4AS869 is configured to count down (SO 1 and Sl 0 in Figure 28); therefore, the counting sequence is 255, 254, ... , 1, 0, 255, ... , and so on. The ripple carry output generates a low-level pulse while the count is zero. The duration of this pulse is one input clock cycle, i.e., 488 ns. The frequency of the ripple carry output is 2.048 MHz/256 =8 kHz. By inverting this signal, positive pulses at 8 kHz are generated. These pulses are used by the TMS320C2x and codec as framing pulses to initiate data transfers. TMS320C2x-Codec Interface The TMS320C2x interfaces directly to the codec, as shown in Figure 28, with no additional logic required. The PCM fJ.-law data generated by the codec at the PCMOUT pin is read by the TMS320C2x from the data receive (DR) pin, which is internally connected to the receive serial register (RSR).[1] The data transmitted from the data transmit (DX) pin ofthe TMS320C2x is received by the PCMIN input of the codec. During the digital-to-analog conversion, this data is converted from fJ.-Iaw PCM to linear. The resulting analog waveform is 10wpass-fiItered by the codec's internal smoothing filter. Therefore, no additional filtering is required at the codec output (PWRO+). Hardware Interfacing to the TMS320C2x 95 The timing diagram of the TMS320C2x-codec interface is shown in Figure 29. Figure 29. Interface Timing of the TMS320C2x to the TCM29C16 Codec CLKX ' I 'I FSXJ.,v--"'Ii~, ___~~__-+__~__~__+-~~-+ ox (FO -1) , I , ' A1 I ' . II, __~__~~.r-1-L1 II AS, I I ~I I I , I I I I I I II I ' -...I.....~lIi-I-l(8) DATA TRANSMITTED BY THE TMS320C25 XINT I ' ....- B1 '( ) ,8 ....- CLKR FSR DR (FO -1) -r---{E~DC][X2~CM[)GIDaOC!ASi}-+--+~+-KIDC ~, __ RINT~__~__~__~__~__~~~~__~___II ~ (b) ~~\~I~~~~_ (8) DATA RECEIVED BY THE TMS320C25 As indicated in Figure 29, both the transmit and receive operations are initiated by a framing pulse on the FSX and FSR pins of the TMS320C2x and the codec. The receive and transmit interrupts shown in Figure 29 occur only if they are enabled. Note that Figure 29 corresponds to the burst-mode serial port operation of the TMS320C2x.[1] Continuous-mode operation using framing pulses or without framing pulses is also available. Analog Input The level of the analog input signal is controlled using the TL072 opamp connected in the inverting configuration (see Figure 28). Using the 500-kQ potentiometer, the gain of this circuit can be varied from 0 to 5. The output of the O.01-J.l.F coupling capacitor drives the TCM29C16's internal opamp. This opamp is connected in the inverting configuration with unity gain (feedback and input imped;mces having the same value of 100 kQ). In summary, codecs, combo-codecs in particular, are most effective in serving DSP system data-conversion requirements. These inexpensive devices interface directly to the TMS320C2x, .occupy minimal board space, and perform both filtering and data conversion functions. Codecs interface to the TMS320C2x by means of the serial port and provide a companded, PCM -coded digital representation of analog input samples. This PCM code is easily translated into a linear form by the TMS320C2x for use in processing. Interface to the codec on the serial port is initialized by a simple software routine in the TMS320C2x. Il)terfacing an Analog-to-Digital (AID) Converter Many digital signal processing applications require a higher level of signal quality than that offered by the eight companded bits of a combo-codec. For these applications, linear analog-to-dig- . 96 Hardware Interfacing to the TMS320C2x ital converters with 10, 12, or 14 bits are commonly used. The improved signal quality obtained with these converters, however, is accompanied by increased system complexity and higher cost. The hardware interface of a 12-bit linear analog-to-digital (AID) converter to the TMS320C2x is discussed in this subsection. In this design, the AID is mapped into the input/output (I/O) space of the TMS320C2x. The distinction between the I/O space and the program and data spaces is made by using the IS pin. This pin goes active (low) when the I/O space is accessed. The TMS320C2x space contains 16 ports that can be read from or written to. These ports are accessed with the IN and OUT instructions.[l] The hardware design of this interface is shown in Figure 30. This design utilizes an antialiasing (lowpass) filter, the Analog Devices' AD585 sample-and-hold and ADADC84 analog-to-digital converter, two 74AS534 octal D-type flip-flops, plus additional logic to generate the READY signal. Figure 30. Interface of the ADADC84 to the TMS320C2x $ = ANALOG GROUND ~74AS30 ~ = DIGITAL GROUND 50kQ r O·U.tF 10 kQ EXTERNAL INPUT --1 500kQ .1. 1\ 111 IE 10kQ A0585 ~ +12V 10M 50kQ r-" 12 v +vs RIN VIN ~ HOLD ..!RFB II REF 2 .~ IN BIT10 4 NULL VIN+ +5 V SHORT CYCLE BIT 9 ~ GNO 14 V BIT8 ~ CC BIT7 NULL 1 !-1FT BIT6~ HOLt AOAOC84 BIT 5 ~ -Vs BIT 4 12 4 20 STATUS BIT 3 1 +12V BIT2[E +12V 50, 2.2 M 27 GAIN SIT 1 CONVERT kQ AOJ -Vs ~ f!---..' ~ t .::1 211 - 12 V 0.01 !-IF A ,us,. r-i>74ALS04A RiW H1C IS STRB A3 A2 K2 Al K AO 1 l' ROAT BIT 12 BITll , BIT 0 . BIT 9 4 10 7 20 3D 40 ,Blr8~3 . BIT 7 1 50 BIT 6 17 60 , BIT 5 18 70 BO QC 10 2 20 5 30 ~~ 112 ~~ 15 ~!1 7Q CLK 16 80 19 01 04 2 05 C1 06 B2 07 -.A2 08 B3 D9 A3 010 B4 011 11 1 BIT 4 BIT 3 . BIT 2 BI·1 4 10 7 20 3D 40 QC CLK 111 I .,. ~. READY G~ ~ L3 , 26 2B 123 122 AGNO +V 8;IP C2MP 15 S FF I OGNO BIT 12 CLOCK BIT 11 1 !-IF Hll B 2 If }:ti f"'' ': :. 74AS321 1\ M l G2A 5 .j.12V 1 TMS320C2x ~ 74AS32 74AL~ 900 pF ~l ~ !-' 10 2 20 30 40 A4 012 B 013 Ai 014 B6 015 01' XF 87 BIO The design of Figure 30 consists of two sections: the analog-to-digital conversion and the interface to the TMS320C2x. Each of these sections is considered separately. Hardware Interfacing to the TMS320C2x 97 Analog.to.Digital Conversion The analog-to-digital conversion section of this interface performs the function of sampling and coding the input waveform. This circuit consists of the antialiasing filter, the sample-and-hold, and the analog-to-digital converter. To avoid distortion during an analog-to-digital conversion, the sampling theorem states that the analog signal must contain no frequency components greater than half the sampling frequency. If this condition is not met, distortion occurs in the form of aliasing; i.e., high-frequency components are superimposed on the low frequencies of the signal spectrum. To avoId this phenomenon, an anti aliasing (lowpass) filter is used. In the design of Figure 30, the antialiasing filter is implemented using a TL072 opamp connected in the inverting configuration. The gain of the opamp is determined by the values of two fixed resistors (10 kQ and 50 kQ) and a 500-kQ potentiometer. The resistance of the potentiometer inversely varies the gain of the opamp. The minimum gain of 0.098 (50 kQ/51O kQ) is reached when the potentiometer is 500 kQ. The maximum gain of 5 (50 kQ/lOkQ) is achieved when the potentiometer is decreased to zero resistance. To satisfy the sampling theorem, the cutoff frequency of the antialiasing filter must be less than half the sampling rate. In the design of Figure 30, the 900 pF capacitor in the feedback path introduces a pole at the frequency f defined by: f=_I_= 1 =3.5kHz 2nRC 2n(50kQ)(0.9)nF) A~ter 3.5 kHz, the frequency response of the filter drops by 6 dB per decade. This rejection, however, may not be adequate for some applications. In such cases, a lowpass filter of higher order is required. Such a filter is presented in the next subsection. The ~utput of the antialiasing filter is connected to the input of the AD585 sample-and-hold, which is configured for a gain of -1. The operation of this device is controlled by the HOLD input. When HOLD is low, the output of the sample-and-hold 01OUT) follows the input (lowpass version of the external input). When HOLD is high, the output stays constant. The time from HOLD high to output stable is referred to as the aperture time, specified as 35 ns for the AD585. AID conversions are implemented by the ADADC84, a 12-bit linear AID converter in which data is represented in complementary two's-complement form. A conversion begins when the CONVERT input goes high. The XF (external flag) output of the TMS320C2x is used to drive the CONVERT input. Since the XF pin is software controlled, the TMS320C2x internal timer may be used to generate programmable sampling rates. This is discussed in more detail later. When CONVERT goes high, the ADADC84 begins the conversion and STATUS goes high. This puts the AD585 in the hold mode. The AID conversion lasts for 10 f.ts, with the MSB decision made approximately 820 ns after STATUS goes high. Note that the aperture time of the AD585 is only 35 ns, and as a result, the input to the AID converter is stable well before the time the MSB decision is made. The LSB decision is made at least 40 ns before STATUS goes low. When STATUS goes low, the AD585 enters the sample mode with again of-I; i.e., the output follows the inverted 98 Hardware Interfacing to the TMS320C2x input waveform. As shown in Figure 30, the BIO pin ofthe TMS320C2x is connected to STATUS. By polling BIO, the TMS320C2x can detect when an AID conversion is completed. The falling edge of STATUS generates a rising edge at the clock inputs of the 74AS534s. This rising edge clocks the ADADC84 data into the 74AS534s. Since the LSB decision is made 40 ns before STATUS goes low, the 3 ns setup time for the 74AS534s is met. Since the 74AS534s are inverting-type flip-flops, the ADADC84 outputs are complemented to give data in two's~comple ment form. This data, however, does not appear on the TMS320C2x data bus until the output buffers of the 74AS534s are enabled. Interface to the TMS320C2x The interface logic in Figure 30 is used to perform the following functions: • Generate READY, and • Enable the output buffers of the 74AS534s so that the TMS320C2x can read the data from the AID conversion To meet the TMS320C2x READY timing requirements, two separate address decoding schemes are used to implement these two functions. One decoding scheme is used for READY, and a second is used to enable the I/O-mapped devices. The address decoding for READY is implmented with the 74AS32 positive-OR gate. The output of the 74AS32 goes low when both IS and A3 go low; i.e., access to ports 0 through 7 is requested. This scheme generates READY for devices that do not require wait-states. I/O devices that generate one or more wait-states can utilize ports 8 through 15. To enable the I/O devices, a 74AS138 is used. Outputs YO through Y7 of the 74AS138 can be used to enable the devices 0 through 7, respectively. In Figure 30, YO is used to enable a read from the AID converter. Note that YO is ORed with the inverted R/W. This prevents the bus conflict that occurs if the TMS320C2x writes to port O. Hardware Interfacing to the TMS320C2x 99 The timing diagram of a TMS320C2x read from port 0 is shown in Figure 31. Figure 31. Interface Timing of the ADADC84 to the TMS320C2x CLKOUT1 IS, R/W, A15-AO \ \'--- ~ VALID -., t"- t1 ------~/~------------~~ -------- READY / 1 \_------'1: r- -l --------------------~~~I t3 __________________-J~~I---------~ --l *-1 t5 ---------------------------«~_______VA__LI_D______~)~------., 1 D15-D4 ~:-- t2 I t4 Time t1 in Figure 31 indicates the time from valid address to READY high. This is less than 10.8 ns, the maximum propagation delay through the READY generation logic. Therefore, the 18-ns READY timing requirement (at 40 MHz) is met. RDAT in Figure 31 is used to enable the output buffers of the 74AS534s. RDAT goes active (low) no later than t2 =tp(74AS138) + tp(74AS32) =14.3 ns after STRB goes low (STRB is used to enable the 74AS138). With a low level on the output control (OC) of the 74AS534s, valid data appears on the TMS320C2x data bus within t4 = 10 ns. The worst-case access time is t2 + t4 =24.3 ns from STRB going low, which is less than the 27 ns required by the TMS320C2x. When STRB goes high, RDAT follows within t3 = 13.3 ns. With a high logic level on the output control (OC)' the output buffers of the 74AS534s enter a high-impedance state within ts = 6 ns. Since t3 + ts = 19.3 ns after STRB goes high, the 74AS534s have entered a high-impedance state, and no bus conflict will occur if a write cycle follows the present read cycle. Table 13 summarizes the most critical timing parameters of the ADADC84 interface to the TMS320C2x. Table 13. Timing Parameters of the ADADC84 Interface to the TMS320C2x Description Address valid to READY valid STRB low to RDAT low STRB high to RDAT high Progagation delay through the 74AS534 (QC to Q) 74AS534 disable time 100 Symbol Used in Figure 3 Value tl t2 t3 t4 t5 10.8 ns (max) 14.3 ns (max) 13.3 ns (max) 10.0 ns (max) 6.0 ns (max) Hardware Interfacing to the TMS320C2x Controlling AID Conversions with the TMS320C2x Timer The TMS320C2x timer can generate periodic interrupts that may be used to set the NO sampling frequency. The TMS320C2x timer logic consists of a 16-bit timer register and a 16-bit period register. At every CLKOUTI cycle, the timer register is decremented by one. When the count reaches zero, a timer interrupt (TINT) is generated. In the next cycle, the contents of the period (PRD) register are loaded into the timer register. Therefore, a timer interrupt is generated every PRD + 1 cycle of CLKOUTl, and the frequency of these interrupts is CLKOUTl/(PRD + 1). As an example, consider a TMS320C2x operating at 40 MHz. The design of Figure 30 is utilized to interface the NO converter to the TMS320C2x. A sampling rate of 10 kHz is desired. To generate timer interrupts at the 10 KHz sampling rate, the value of the period register is calculated as follows: Since f = CLKOUTl s PRD + 1 the period register is PRD= CLKOUT fs 1 With CLKOUTl = 10 MHz and fs = 10 kHz, the value of the period register is PRD = 999. By loading the period register (data memory location 3) with 999, timer interrupts (if enabled) occur at a 10 kHz frequency. This can be implemented with the following TMS320C2x source code: LDPK LALK SACL LACL OR SACL 0 999 DMA3 8 DMA4 DMA4 Point to Data Page #0 ACC 999 Period Register ACC Enable TINT through the IMR To start the NO conversion, the interrupt service routine must generate a positive pulse on the XF output. This can be implemented with the following code: ISE SXF RXF EINT RET Set external flag (XF) Clear external flag (XF) Enable interrupts Note that upon entering the interrupt service routine, the interrupts are disabled. Interrupts are reenabled by the EINT instruction just before exiting the interrupt service routine. Also, the conversion pulse that this routine generates is 100 ns long, easily meeting the 50-ns minimum conversion pulse width required by the ADADC84. To summarize, lO-bit to more than 14-bit linear NO converters are often used to perform data conversions in DSP systems that require more resolution than is provided by codecs. The circuit shown in Figure 30 describes the interface of an NO conversion subsystem to the Hardware Interfacing to the TMS320C2x 101 TMS320C2x. This subsystem contains antialiasing filters, a sample-and-hold circuit, and a 12-bit NO converter. Communication with the TMS320C2x is provided via the I/O space. The NO converter is isolated from the processor's data bus by high-impedance buffers when data transfers are not being performed. The TMS320C2x's internal timer is used to establish the NO sample rates, thus reducing system logic requirements. Interfacing a Digital-to-Analog (D/A) Converter This subsection discusses the hardware interface of a lO-bit digital-to-analog converter to the TMS320C2x. The design, shown in Figure 32, utilizes the Analog Device's ADDACIOO digital-to-analog converter, a 74AS8221O-bit flip-flop, a smoothing filter, plus additional logic to generate READY. Figure 32. Interface of the ADDACIOO to the TMS320C2x TMS320C2x 74AS30 ~ = ANALOG GROUND REAOYt=B""8-----« ~ is = DIGITAL GROUND J11 STRBE-H;.::10::...--+-;::--~ A3 K3 A2 L3 A1 K2 AO K1 2000 Y1 74AS138 74AlS04 14 WRDAT 14 2 10 ~--=:~_.::.I3 20 4 3D F.:----=t 5 40 E---.::.I i=-'_ _ _.;;t6 5D ClK ~_ _ _::t7 6D 8 70 1.;:::---.::.1 9- t:.::::---1~080 E-----'~9D t-=_ _--.,;1""!1 10D 10 20 30 40 v+ BIPOLAR AOOAC100 23 13 BIT 1 (MSB) REF 22 12 BIT2 21 11 BIT 3 20 10 BIT4 5Q 60 7Q 8Q 18 17 16 15 9Q 19 10Q 14 AGND 9 8 7 6 5 BIT 5 BIT 6 BIT 7 BIT 8 BIT 9 4 BIT 10 -v 2 15 -12V This design consists of three sections: the interface to the TMS320C2x, the D/A converter, and the smoothing filter. Each of these sections is considered separately. Interface to the TMS320C2x The 74AS822 is used to latch the data from the TMS320C2x. Since the output control (OC) of the 74AS822 is always active (grounded), the latched data is available at the inputs of the D/A converter immediately following a write from the TMS320C2x. In bipolar mode; the ADDACIOO accepts data in complementary offset binary form. By inverting the MSB of the two's-complement 102 Hardware Interfacing to the TMS320C2x data from the TMS320C2x, the data input to the 74AS822 is converted to offset binary form. This data is inverted by the 74AS822 so that the input to the ADDACI00 becomes complementary offset binary form. The circuit shown in Figure 32 utilizes the same address decoding technique used for the ana. log-to-digital converter interface. This technique maps devices that require no wait -states into ports o through 7. Ports 8 through 15 are used for devices that require one or more wait-states. In this design, the D/Aconverter is mapped into port 1 of the TMS320C2x I/O space. The timing diagram for a write to the D/A is shown in Figure 33. Figure 33. Interface Timing of the ADDACIOO to the TMS320C2x CLKOUT1 is,RW, A15-AO \ "--- / )@( ~ VALID I ~ : - t1 I READY \. Jf \ 104- t2 ~ \ I I I .. : 015-06 ( I t3 VALID --:! ! I 104- t4 I i When port 1 is addressed, WRDAT goes low. No later than t2 =7.5 ns after STRB goes high, WRDAT follows. This rising edge of WRDAT clocks the data into the 74AS822. The minimum setup time for the data before WRDAT goes high is t3 min + t2 min (see Figure 33). Time t3 min is the minimum setup time for the TMS320C2x data before STRB goes high (30 ns), minus the maximum propagation delay through the 74ALS04 (11 ns). Time t2 min is the minimum propagation delay through the 74AS138 (2 ns). Therefore, the minimum setup time for the data before WRDAT goes high is 21 ns, which is greater than the 6-ns minimum setup time required by the 74AS822. Hardware Interfacing to the TMS320C2x 103 Table 14 summarizes the most critical timing parameters of the ADDAClOO interface to the TMS320C2x. Table 14. Timing Parameters of the ADDACI00 Interface to the TMS320C2x Description Address valid to READY valid STRB high to WRDATJ:!!.&h... Data setup time before STRB high Data setup time before WRDAT high Data hold time from STRB high Dala hold time from WRDAT high Symbol Used in Figure 3 t1 t2 t3 t3 + t2 14 14 - 12 Value 10.8 ns (max) 7.5 ns (max) 19.0 ns (min) 21.0 ns (min) 15.0 ns (min) 7.5 ns (min) D/A Converter The ADDAC100 lO-bit digital-to-analog converter converts a digital input to an output current. The standard current-to-voltage conversion is implemented using the TLOn opamp. This is the opamp closest to the ADDACIOO in Figure 32. The offset and gain ajustments are implemented with the 500-Q and 200-Q potentiometers, respectively. Smoothing Filter The output of the ADDAClOO contains high-frequency components to be removed by the smoothing filter. In the design of Figure 32, this filter is implemented with the TLOn opamp configured to implement a second-order lowpass filter with a cutoff frequency around 1.7 KHz. For some applications, however, a rejection of 12 dB per decade is not adequate. A design that implements a sixth-order lowpass filter is shown in Figure 34. This design is a cascade of three opamps, each implementing a second-order section. Figure 34. Sixth-Order Lowpass Filter Used for AntiaJiasing and Smoothing Filter Operations - TL072l V 0"' ~ = Analog Ground 104 Hardware Interfacing to the TMS320C2x The design of Figure 34 is used to implement the antialiasing and smoothing filtering operations in the TMS32010 Analog Interface Board. The cutoff frequency of this filter depends on the values of the passive components. The values of these components for several cutoff frequencies. are shown in Table 15.[3] Table 15. Lowpass Filter Component Values for Various Frequencies r 1.7 kHz Rl Cl R2 R3 C2 R4 C3 R5 R6 C4 R7 C5 R8 R9 C6 Note: 2.588 0.280 1.294 2.588 0.00936 7.071 0.0375 3.536 7.071 0.00936 9.659 0.0201 4.830 9.659 0.00936 4.7 kHz 2.588 0.101 1.294 2.588 0.00339 7.071 0.0136 3.536 7.071 0.00339 9.659 0.00726 4.830 9.659 0.00339 7.7 kHz 2.588 0.0617 1.294 2.588 0.00207 7.071 0.00827 3.536 7.071 0.00207 9.659 0.00443 4.830 9.659 0.00207 10kHz 2.588 0.0475 1.294 2.588 0.00160 7.071 0.00637 3.536 7.071 0.00160 9.659 0.00341 4.830 9.659 0.00160 12kHz 2.588 0.0396 1.294 2.588 o.oom 7.071 0.00531 3.536 7.071 0.00133 9.659 0.00284 4.830 9.659 0.00133 16kHz 20kHz 2.588 0.0297 1.294 2.588 0.000995 7.071 0.00398 3.536 7.071 0.000995 9.659 0.00213 4.830 9.659 0.000995 2.588 0.0238 1.294 2.588 0.000796 7.071 0.00318 2.536 7.071 0.000796 9.659 0.00171 4.830 9.659 0.000796 The unit for resistance is kQ The unit for capacitance is f.lF The above values are not industry-standard values In summary, the lO-bit linear D/A converter provides analog output for the TMS320C2x. The D/A converter is interfaced to the processor through the I/O space and is driven by latches that store the digital data for the current sample until the next sample period. A smoothing filter provides final analog signal reconstruction by eliminating extraneous high-frequency components in the output waveform. Summary The interface of memories and peripherals to the TMS320C2x has been described in this application report. Both direct interfaces and interfaces that utilize address decoding have been considered, with special attention given to READY timing requirements. The design techniques used in these interfaces can be extended to encompass interface of other devices to the TMS320C2x. Hardware Interfacing to the TMS320C2x 105 · References 1) Second-Generation TMS320 User's Guide (literature number SPRU014A), Texas Instruments (1989). . 2) Digital Signal Processing Applications with the TMS320 Family, Volume 1 (literature number SPRA012A), Texas Instruments (1986). 3) TMS32010Analog interface Board User's Guide (literature number SPRU006), Texas Instruments (1983). 4) The TTL Data Book Volume ~ (literature number SDLDOO1), Texas Instruments (1985). 5) The TTL Data Book Volume 3 (literature number SDAD001A), Texas Instruments (1984). 6) MOS Data Book, Micron Technology, Inc. (1990). 7) CMOS/BiCMOS Data Book, Cypress Semiconductor (1989). 106 Hardware Interfacing to the TMS320C2x Interfacing the TMS320 Family to the TLC32040 Family Linear Products - Semiconductor Group Texas Instruments 107 108 Interfacing the TMS320 Family to the TLC32040 Family 1 Introduction The TLC32040 and TLC32041 analog interface circuits are designed to provide a high level of system integration and performance. The analog interface circuits combine high resolution AID and DIA converters, programmable filters, digital control and timing circuits as well as programmable input amplifiers and multiplexers. Emphasis is placed on making the interface to digital signal processors (the TMS320 family) and most microprocessors as simple as possible. This user's guide describes the software and circuits necessary to interface to numerous members of the TMS320 family. It presents three circuits for interfacing the TLC32040 Analog Interface Circuit to the TMS320 family of digital Signal processors. Details of the hardware and software necessary for these interfaces are provided. To facilitate the discussion of the software, the following definitions and naming conventions are used: 1. > nnnn - a number represented in hexadecimal. 2. Interrupt service routine - a subroutine called in direct response to a processor interrupt. 3. Interrupt subroutine - any routine called by the interrupt service routine. 4. Application program (application routine) - the user's application dependent software (e.g. digital filtering routines, Signal generation routines, etc.) Interfacing the TMS320 Family to the TLC32040 Family 109 110 Interfacing the TMS320 Family to the TLC32040 Family 2 TLC32040 Interface to the TMS32010/E15 2.1 Hardware Because the TlC32040 (Analog Interface Circuit) is a serial-IIO device, the interface to the TMS32010, which has no serial port, requires a small amount of glue-logic. The circuit shown in Figure 2-1 accomplishes the serial-to-parallel conversion for the AIC operating in synchronous mode, 2.1.1 Parts list The interface circuit for the TMS32010 uses the following standard logic circuits: 1, 2, 3, 4, One SN74lS138 3-to-8-line address decoder One SN74lS02 Quad NOR-Gate One SN74lS00 Quad NAND-Gate One SN74lS04 Hex Inverter 5, One SN74lS74 Dual D-Flip-Flop 6, Two SN74LS299 8-bit Shift Registers ·74LS299 TLC32040 TMS32010/C15 ~ S1 FIX G2 OEN L....- YO Yf G1 - - so 1 ox OH' 74lS138 U2 < to-- lIT SHIFT h •• •• U1 AO/PAO f - - A AlIPA1 f - - - 8 A2/PA2 f - - C SR r - - - ClK t- ~ ,~ 74lS299 ~l1 016 ••• 00 WI ClKOUT INT 8 - f---< OH' so U3 8 / .r lIT 16 / S1 iff 7-- h •• • SR ~ ~ ~ • 0f'4 OR 0 U4 74Lsi4 ~ MSTRClK mt5X FIgure 2·1. Ale Interface to TMS32010/E16 Interfacing the TMS320 Family to the TLC32040 Family 111 2.1.2 Hardware Description The 74LS138 is used to decode the addresses of the ports to which the TLC32040 and the interface logic have been mapped. If no other ports are needed in the development system, this device may be eliminated and the address lines of the TMS32010 used directly in place of Y1 and YO (see Figure 2-1). Since the interface circuits are only addressed when the TMS32010 executes an IN or an OUT instruction, gates L1, L2, L3, L4, and L5 are required to enable. reading and writing to the shift registers only on these instructions. The TBLW instruction is prohibited because it has the same timing as the OUT instruction. Flip-flop U4 ensures that the setup and hold times of 74LS299 shift registers are met. o Although not shown in the circuit diagram, it is recommended that the CLR pins of the 74LS299 shift registers as well as the RESET pin of the AIC be tied to the powerup reset circuit shown in the AIC data sheet. This ensures that the registers are clear when the AIC begins to transfer data and decrease the possibility that the AIC will shift in bad data which could cause the AIC to shut down or behave in an unexpected manner. 2.2 Software The flowcharts for the communication program along with the TMS3201 0 program listing are presented in Appendix A. If this software is to be used, an application program that moves data into and out of the transmit and receive registers must be supplied. 2.2.1 Initializing the TMS32010/E15 As shown in the flowcharts in Appendix A, the program begins with an initialization routine which clears both the transmit/receive-end flag and the secondary communication flag, and stores the addresses of the interrupt subroutines. The program uses the MPYK .. PAC instruction sequence to load data memory locations with the 12-bit address of the subroutines. This sequence is only necessary if the subroutines are to reside in program memory locations larger than >OOFF. Otherwise, the instructions LACK and SACL may be used to initialize the subroutine-address storage locations. 2.2.2 Communicating with the TLC32040 After the storage registers and status register have been initialized, the interrupt is enabled and control is passed to the user's application routine (i.e. the systemdependent software that processes received data and prepares data for transmission). The program ignores the first interrupt that occurs after interrupts are enabled (page A-6, line 206, IGINT routine), allowing the AIC to stabilize after a reset. The application routine should not write to the shift registers while data is moving into (and out of) them. In addition, it should ensure that no primary data is written to the shift registers between a primary and secondary data-communication pair. The first objective can be accomplished by writing to the 74LS299 shift registers as quickly as possible after the receive interrupt. The number of instruction cycles between the data transfers can be calculated from the conversion frequency. By counting instruction cycles in the application program, it is possible to determine whether the data transfer will conflict with the OUT instruction to the shift register. The second objective can be accomplished by monitoring SNDFLG in the application program. If SNDFLG is true (>OOFF), secondary communication has not been completed. 112 Interfacing the TMS320 Family to the TLC32040 Family When the processor receives an interrupt, the program counter is pushed onto the hardware stack and then the program counter is set to >0002, the location of the interrupt service routine, INTSVC (page A-3, line 46). The interrupt service routine then saves the contents of the accumulator and the status register and calls the interrupt subroutine to which XVECT points. If secondary communication is to follow the upcoming primary communication, XVECT, is set by the application program to refer to SINT1, otherwise, XVECT defaults to NINT (i.e the normal interrupt routine). Because the interrupt subroutine makes one subroutine call and uses two levels of the hardware stack, the application program can only use two levels of nesting (i.e., if stack extension is not used). This means that any subroutine called by the application program can only call subroutines containing no instructions that use the hardware stack (e.g. TBLW) and that make no other subroutine calls. In addition, if the application program and communication program are being implemented on an XDS series emulator, the emulator consumes one level of the hardware stack and allows the application program only one level of nesting (i.e., one level of subroutine calls). As shown in the flowcharts in Appendix A, the normal interrupt routine reads the A/D data from the shift registers and then sets the receive/transmit end-flag (RXEFLG). The application program must write the outgoing D/A data word to the shift registers at a time convenient to the application routine. It should have the restriction that the data be written before the next data transfer. 2.2.3 TLC32040 Secondary Communication If it is necessary to write to the control register of the AIC or configure any of the AIC internal counters, the application program must initiate a primary/secondary communication pair. This can be accomplished by placing a data word in which bits and 1 are both high into DXMT, placing the secondary control word (see program listing page A-3) in D2ND, and placing the address of the secondary communication subroutine, SINT1, in XVECT. When the next interrupt occurs, the interrupt subroutine will call routine SINn. SINn reads the A/D information from the shift registers and writes the secondary communication word to the shift registers. o Interfacing the TMS320 Family to the TLC32040 Family 113 114 Inferfacing the TMS320 Family to the TLC32040 Family 3 TLC32040 Interface to the TMS32020 3.1 Hardware Description 8ecause the TlC32040 is designed specifically to interface with the serial port of the TMS32020/C25, the interface requires no external hardware. Except for ClKR and ClKX, there is a one-to-one correspondence between the serial port control and data pins of TMS32020 and TlC32040. CLKR and CLKX are tied together since both the transmit and the receive operations are synchronized with SHIFT ClK of the TLC32040. The interface circuit, along with the communication program (page 8-5), allow the AIC to communicate with the TMS32020/C25 in both synchronous and asynchronous modes. See Figures 3-1, 3-2, and 3-4. 3.2 Software The program listed in Appendix 8 allows the AIC to communicate with the TMS32020 in synchronous or asynchronous mode. Although originally written for the TMS32020, it will work just as well for the TMS320C25. TMS32020/C25 5 m FSX ox FIR ox FSR DR DR ClKR WORD/BYTE MSTR ClK ClKOUT ClKX L TLC32040 ~ SHIFT ClK Figure 3-1. AIC Interface to TMS32020/C25 Interfacing the TMS320 Family to the TLC32040 Family 115 SHIFT ClK FSR. m ~L - DR I I D15 I f-1------oJI :-_-il:-_-i-__- f __ I I I ~1~~D-l----D-O---------------------I I DO DX meR. L---'r----- -------------~II~----------~ EODX The sequence of operation is: 1. 2. 3. 4. The ffi or FSA pin is brought low. One 16-bit word is transmitted or one 16-bit byte is received. The ffi or FSA pin is brought high. The EO OX or EOOA pin emits a low-going pulse as shown. Figure 3-2. Operating Sequence for AIC-TMC32020/C25 Interface LJ LJ LJ LJ LJ LJ Figure 3-3. Asynchronous Communication AIC-TMS32020/C25 Interface 3.2.1 Initializing the TMS32020/C25 This program starts by calling the initialization routine. The working storage registers for the communication program and the transmit and receive registers of the DSP are cleared, and the status registers and interrupt mask register of the TMS32020/C25 are set (see program flow charts in Appendix B). The addresses of the transmit and receive interrupt subroutines are placed in their storage locations, and the addresses of the routines which ignore the first transmit and receive interrupts are placed in the transmit and receive subroutine pointers (XVECT and RVECT). The TMS32020/C25 serial port is configured to allow transmission of 16-bit data words (FO, the serial port format bit of the TMS32020/C25 must be set to zero) with an externally generated frame synchronization (FSX and FXR are inputs, TXM bit is set to 0). 116 Interfacing the TMS320 Family to the TLC32040 Family 3.2.2 Communicating with the TLC32040 After the TMS32020/C25 has been initialized, interrupts are enabled and the program calls subroutine IGR. The processor is instructed to wait for the first transmit and receive interrupts (XINT and RINT) and ignore them. After the TMS32020 has received both a receive and a transmit interrupt, the IGR routine will transfer control back to the main program and IGR will nQt be called again. If the transmit interrupt is enabled, the processor branches to location 28 in program memory at the end of a serial transmission. This is the location of the transmit interrupt service routine. The program context is saved by storing the status registers and the contents of the accumulator. Then the interrupt service routine calls the interrupt subroutine whose address is stored in the transmit interrupt pointer (XVECT). A similar procedure occurs on completion of a serial receive. If the receive interrupt is enabled, the processor branches to location 26 in program memory. As with the transmit interrupt service routine (XI NT, page B-B, line 223), the 'receive interrupt service routine (page B-8,line 191) saves context and then calls the interrupt subroutine whose address is stored in the receive interrupt pointer (RVECT). It is important that during the execution of either the receive or transmit interrupt service routines, all interrupts are disabled and must be re-enabled when the interrupt service routine ends. The main program is the application program. Procedures such as digital filtering, tonegeneration and detection,and secondary communication judgment can be placed in the application program. In the program listing shown in Appendix B, a subroutine (C2ND) is provided which will prepare for secondary communication. If secondary communication is required, the user must first write the data with the secondary code to the DXMT register. This data word should have the two least significant bits set high (e.g. > 0003). The first 14 bits transmitted will go to the D/A converter and the last two bits indicate to the AIC that secondary communication will follow. After writing to the DXMT register, the secondary communication word should be written to the D2ND register. This data may be used to program the AIC internal counters or to reconfigure the AIC (e.g. to change from synchronous to asynchronous mode or to bypass the bandpass filter). After both data words are stored in their respective registers, the application program can then call the subroutine C2ND which will prepare the TMS32020 to transmit the secondary communication word immediately after primary communication. 3.2.3 Secondary Communications - Special Considerations This communication program disables the receive interrupt (RINT) when secondary communication is requested. Because of the critical timing between the primary and secondary communication words and because RINT carries a higher priority than the transmit interrupt, the receive interrupt cannot be allowed to interrupt the processor before the secondary data word can be written to the data-transmit register. If this situation were to occur, the AIC would not receive the correct secondary control word and the AIC could be shut down. In many applications, the AIC internal registers need only be set at the beginning of operation, (i.e, just after initialization). Thereafter, the DSP only communicates with the AIC using primary communication. In cases such as these, the communication program can be greatly simplified. Interfacing the TMS320 Family to the TLC32040 Family 117 118 Interfacing the TMS320 Family to the TLC32040 Family 4 Interfacing the TLC32040 to the TMS320C 17 4. 1 Hardware Description As shown in Figure 4-1, the TMS320C 17 interfaces directly with the TLC32040. However, because the TMS320C17 responds more slowly to interrupts than the TMS3201 O/E15 or the TMS32020/C25, additional circuit connections are necessary to ensure that-the TMS320C 17 can respond to the interrupt, accomplish the contextswitching that is required when an interrupt is serviced, and proceed with the interrupt vector. This must all be accomplished within the strict timing requirements imposed by the TLC32040. To meet these requirements, FSX of the TLC32040 is connected to the EXINT pin of the TMS320C 17. This allows the TMS320C 17 to recognize the transmit interrupt before the transmission is complete. This allows the interrupt service routine to complete its context-switching while the data is being transferred. The interrupt service routine branches to the interrupt subroutines only after the FSX flag bit has been set. This signals the end of data transmission. The other hardware modification involves connecting the EODX pin of the TLC32040 to the BIO pin of the TMS320C 17. Because the TMS320C 17 serial port accepts data in 8-bit bytes (see Figure 4-2) and the TLC32040 controls the byte sequence (i.e. which byte is transmitted first, the high-order byte or the low-order byte) it is important that the TMS320C 17 be able to distinguish between the two transmitted bytes. The EODX signal is asserted only once during each transmission pair, making it useful for marking the end of a transmission pair and synchronizing the TMS320C17 with the AIC byte sequence. After synchronism has been established, the BIO line is no longer needed by the interface program and may be used elsewhere. Because the TMS320C 17 serial port operates only in byte mode, 16-bit transmit data should be separated into two 8-bit bytes and stored in separate registers before a transmit interrupt is acknowledged. Alternatively, the data can be prepared inside the interrupt service routine before the interrupt subroutine is called. From the time that the interrupt is recognized to the end of the data transmission is equivalent to 28 TMS320C17 instruction cycles. TMS320C17 EXINT FSX TLC32040 h .f'" ClK OUT WORD/BYTE FSX MSTR CLK DXO OX FSR FSR ORO DR SCLK liiO SHIFT CLK EODX Figure 4-1. Ale Interlace to TMS320C 17 Interfacing the TMS320 Family to the TLC32040 Family 119 SHIFT CLK I . I I I I I m.m'I I \ i I II I I ., I OR--~0~'~:5~~~~~-------=0~8--------~~jC]§C\~0~,__'0~O__________ t2i! ~.' OX ---"1f?15I014 09 I 08 07 06 ~ ., II I The sequence of operation is: 1. The ffi or pin is brought low. 2. One B-bit word is transmitted or one B-bit byte is received. or EOi5R pins are brought low. 3. The 4. The ffi or emit a positive frame-sync pulse that is four shift clock cycles wide. 5. One B-bit byte is transmitted and one B-bit byte is received. 6. The EOOX and EO DR pins are brought high. and pins are broul!ht high 7. The m rnox m m m Figure 4-2. Operating Sequence for AIC-TMS320C 17 4.2 Software The software listed in Appendix C only allows the AIC to communicate with the TMS320C17 in synchronous mode. This communication program is supplied with an application routine, OLB (Appendix C, program listing line 236), which returns the most recently received data word back to the AIC (digitalloopback). 4.2.1 Initializing the TMS320C 17 The program begins with an initialization routine (lNIT, page C-5, line 122). Interrupts are disabled and all the working storage registers used by the communication program are cleared. Both transmit registers are cleared, the constants used by the program are initialized and the addresses of the subroutines called by the program are placed in data memory. This enables the interrupt service routine to call subroutines located in program-memory addresses higher than 255. After the initialization is complete, the program monitors the BIO line of the TMS320C17 and waits for the end of the first interrupt pair (the AIC is in byte mode). Afterwards, interrupts are enabled and control is passed to the main program. 4.2.2 AIC Communications and Interrupt Management Because the AIC FSX pin is tied to the EXINT line of the TMS320C17 and the delay through the interrupt multiplexer, the interrupt service routine is called four instruction cycles after the falling edge of FSX. The interrupt service routine (lNTSVC, Appendix C, program listing, line 91) completes its context switching and then monitors the lower control register, polling the FSX flag bit that indicates the end of the a-bit serial data transfer. If the FSX flag bit is set, the transfer is complete. After this bit is set, control is transferred to the interrupt subroutine whose address is stored in VECT. The serial communication must be complete before data is read from the data receive register. 120 Interfacing the TMS320 Family to the TLC32040 Family When no secondary communication is to follow, the interrupt subroutines, NINTl and NINT2, are called. If data has been stored in DXMT2 (the low-order eight bits of the transmit data word), which does not indicate that secondary communication is to follow, the interrupt service routine calls NINTl when the first 8-bit serial transfer is complete. NINT1 immediately writes the second byte of transmit data, (i.e., the contents of DXMT2) to transmit data register 0 (TRO). It then moves the first byte of the received data (i.e. the high-order byte cif the AID conversion result) into DRCV1. NINTl then stores in VECT the address of NINT2. NINT2 is called at the end of the next 8-bit data transfer and resets the FSX interrupt flag bit by writing a logic high to it. The next interrupt (a falling edge on EXINT) occurs before the interrupt service routine returns control to the main program. This is an acceptable situation since the TMS320C17, on leaving the interrupt service routine, recognizes that an interrupt has occurred and immediately responds by servicing the interrupt. The interrupt subroutine NINT2 is similar in operation to NINT1. It stores the loworder byte of receive data (bits 7 through 0 of the AID conversion result) and stores the address of the next interrupt subroutine in VECT. NINT2 does not write to the transmit data register, TRO. This task has been left to the application program. After the transmit data has been prepared by the main program and the data has been stored' in DXMT1 and DXMT2, the main program stores the first byte of the transmit data in transmit data register 0 (TRO). 4.2.3 Secondary Communications The interrupt subroutines SINT1 through SINT4 are called when secondary communication is required. For secondary communication, DXMT1 and DXMT2 will hold the primary communication word. DXMT3 and DXMT4 will hold the secondary communication word. VECT, the subroutine pointer should then be initialized to the address of SINT1. As with the normal (primary' communication only) interrupt subroutines (i.e., NINTl and NINT2), the secondary communication routines will change VECT to point to the succeeding routine (e.g~, SINT1 will point to SINT2, SINT2 will point to SINT3, etc.). Interfacing the TMS320 Family to the TLC32040 Family 121 122 Interfacing the TMS320 Family to the TLC32040 Family 5 Summary The TLC32040 is an excellent choice for many digital signal processing applications such as speech recognition/storage systems and industrial process control. The different serial modes of the AIC (synchronous, asynchronous, 8- and 16-bit) allow it to interface easily with all of the serial port members of the TMS320 family' as well as other processors. Interfacing the TMS320 Family to the TLC32040 Family 123 124 Interfacing the TMS320 Family to the TLC32040 Family A A.1 TLC32040 and TMS3201 0 Flowcharts and Communication Program Flowcharts •• 'Modified to call NINT. a. MAIN Interfacing the TMS320 Family to the TLC32040 Family b. PRIMARY INTERRUPT ROUTINE 125 ·Set, if need secondary. "Modify to call SINT2. "'Modify to call NINT . ••• *Must execute before transfer beginning. c. SECONDARY DATA COMMUNICATIONS 1 A.2 Communication Program List 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0002 0011 0003 00'04 0012 0013 0005 0014 0006 0015 0007 0016 0008 0017 0009 0018 OOOA 0019 OOOC OOOD 0020 0021 OOOE 0022 OOOF 0023 0024 OOFF 0025 0001 0026 0027 0028 0029 0000 0030 0000 F900 0001 OOOD 126 d. SECONDARY DATA COMMUNICATION 2 **********************************************************~* When using this program. the circuit in the TLC32040 data sheet or its equivalent circuit must be used. TMS32010 port 0 and port 1 are reserved for data * receiving and .data transmitting. TBLW command is prohibited because it has the same timing as the OUT command. TLC32040 is used only in synchronous mode. * * * * * * ************************************************************ *RXEFLG SNDFLG DRCV DXMT D2ND XVECT ACHSTK ACLSTK SSTSTK ANINT ASINTl ASINT2 TMPO * SET ONE * * * EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU >02 >03 >04 >05 >06 >07 >08 >09 >OA >OC >OD >OE >OF EQU EQU >FF >01 AORG >0000 EPH receive & xmit end flag. secondary communication flag. receive data storage. xmit data storage. secondary data storage. interrupt address storage. ACCH stack. ACCL stack. Status stack. interrupt address 1 interrupt address 2 interrupt address 3 temporary register. ================= Reset vector. ================= B program start address. jump to Initialization. Interfacing the TMS320 Family to the TLC32040 Family 0031 0032 0033 0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 0080 0081 0082 0083 ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• • • • • • • • • • •• 0002 0002 0002 0003 0004 0005 0006 0007 0008 0009 OOOA OOOB OOOC For secondary communication,modify the contents of XVECT to the address of secondary communication and store secondary data in D2ND. ex. LAC ASINTl,O modify XVECT. SACL XVECT ,0 • • • • • • • • • •• ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• AORG >0002 interrupt vector. 7COA 6EOI 5808 5009 2007 7F8C 6508 7A09 7BOA 7F82 7F8D I INTSVC LAC D2ND,0 store secondary data. SST LDPK SACH SACl LAC CALA ZALH OR LST EINT RET SSTSTK ONE ACHSTK ACLSTK XVECT,O push status register. set data pointer one. push ACCH. push ACCL. load interrupt address. branch to interrupt routine. pop ACCH pop ACCl. pop stack register. enable interrupt. return from interrupt routine. ACHSTK ACLSTK SSTSTK •••••••••••••••••••••••••••••••••••••••••••••••••••••• • • • • • • • • DODD OOOD OOOD OOOE OOOE OOOF 0010 0011 0012 0013 0014 0014 0015 0016 ================== Interrupt vector. ================== ============================= Initialization after reset. ==========~================== • • • • • Data RAM locations 82H(130) through 8FH(143), 12 words of Page l,are reserved for this program .• The user must set the status register by adding • the SST command at the end of the initial routine. •••••••••••••••••••••••••••••••••••••••••••••••••••••• • • • AORG $ initial program. LDPK ONE set Data page pointer one. 7EOI 500F 6AOF 802C 7F8E 500C LACK SACl LT MPYK PAC SACl ONE TMPO TMPO NINT save normal communication address to its storage. 8030 7F8E 500D MPYK PAC SACL 6EOI EPIl ANINT SINTl save secondary communication addressl to its storage. ASINTl Interfacing the TMS320 Family to the TLC32040 Family 127 0084 0085 0086 0087 0088 0089 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 0100 0101 0102 QI03 0104 0017 0017 0018 0019 001A 001A 001B ODIC 0010 0010 ODIE POIF 001F 0020 0020 0020 0020 8037 7F8E 500E MPYK PAC SACL ASINT2 803E 7F8E 5007 MPYK IGINT SACL XVECT 7F89 5002 ZAC SACL RXEFLG,O 5003 SACL SNDFLG,O Pj\C 7F82 save sepondary communication address2 to its storage. ignore interrupt once after master reset: clear flags. enable interrupt. EINT l! l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l! ==================== l! 0~0!i l! IE l! l! IE l! Mai n program. User can mod; fy. , l( 0106 0107 0108 0109 0110 DIll 0112 0113 0114 0115 0116 0117 0118 0119 0120 0121 0021 0122 0021 2002 0123 0022 FFOO 0023 0021 0124 0024 0125 0024 2003 0126 0025 FEOQ 0026 0028 0127 0027 0128 d027 4905 0129 0028 0130 0028 7F89 0131 0029 5002 0132 002A 0133 002A F~OO 0021 0021 128 SINT2 ==================== This program allows the user 2 levels of nesting, since ¥ two levels are used as stack for the interrupt. IE 'When the RXEFLG flag is false; no data transfer has l! occurr~d; if true then' data transf~r has finished. l! User routines such as digital fflter, secon~ary-datal! communication judgement etc. must be placed in this IE location. Depending on the sampling rate, ~conversion IE IE IE IE IE ¥ IE ~ IE IE l( rate), these, user routines must ;"rite the xmit'data to l! the shift registers within approximateiy 500 instruction IE IE cycles. If ~he user reqJire~ secondary comm~nication, it l! l! will be necessary to delay the OUT'instruction until the l! l! secondary data transfer has fin'i~hed. ' l! l!l!l!l!l!l!l!l!l!l!l!l!l!l!l(l!l(l!l!l!l(l!l!l!l!l!l(l!IEl!l!IEl!IEl!l!IEl!l!l!l!l!IEl!l!l!l!l!l!l(l!l!l!1E1E1El!1El!l! MAIN MAINI LAC BZ RXEFLG,O wait for interrupt, MAIN LAC BNZ SNDFLG,O skip qUT instruction during secondary MAINI communication. our DXMT,PAI write xmit ZAC SACL RXEFLG B MAIN dat~ to shift register. clear flags. , loop. Interlacing the TMS320 Family to the TLC32040 Family 0134 0135 0136 0137 0138 0139 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 0150 0151 0152 0153 0154 0155 0156 0157 0158 0159 0160 0161 0162 0163 0164 0165 0166 0167 0168 0169 0170 0171 0172 0173 0174 0175 0176 0177 0178 0179 0180 0181 0182 0183 0184 Oi85 0186 II *••••••• 1111 •• 11 •• 11 •• 1111111111 •• 11111111. 111111111111111111111111111111111111.11 •• 11 ••••• ============================ II normal interrupt routine. • II II • • ===============~============ • destroy ACC.DP. II • • II Write the contents of DXMT to the LS299's, receive OAC data in ORCV, and set RXEFLG flag. II II 002C 002C 4004 0020 0020 7EFF ~02E 5002 002F 002F 7F80 NiNT IN DRCV,PAO Receive data from shift register. LACK SACL SET RXEFlG RET II set receive and xmit ended flag. return. • 11 ••• 11 •••• 11 •• * •• * •••• * ••••••••• 11 •••••••••••• 11 ••••• *.*.*** •• =============================================== • • secondary communication interrupt routine 1. * *II * * • destroy ACC,OP * * * Write the contents of 02NO to the 'LS299s, receive * * data in DRCV, and modify XVECT for secondary communi * * • -cati on interrupt. *********.**********11.*****.* •• **.** ••• 11** •• ************** 0030 0030 4004 0031 0031 4906 SINTI iN DRCV,PAO receive data from shift register. OUT 200E 5007 LAC SACL D2ND,PAl write secondary data to shift register. ASINT2,0 modify interrupt location. secondary communication 2 XVECT 7EFF 5003 LACK SACL set secondary communication flag. SET SNDFLG,O 7F8D RET * 0032 0033 0034 0034 0035 0036 0036 0037 return. *****11*11***11.*************.*.*************11*************** =============================================== II II secondary communication interrupt routine 2. * =============================================== * II destroy ACC, DP ** II * * * 0037 0037 20DC 0038 5007 II Modify XVECT for normal communication, and set RXEFLG* flag. SINT2 LAC SACL ANI NT XVECT modify interrupt location normal communication. Interfacing the TMS320 Family to the TLC32040 Family 129 0187 0039 LACK SET set receive and xmit ended flag. 0188 0039 7EFF 0189 003A 5002 SACL RXEFLG 0190 0038 0191 0038 7F89 ZAC Clear secondary communication flag. 0192 003C 5003 SACL SNDFLG,O 0193 003D 0194 003D 7F8D RET return. 0195 003E 0196 _ _ __ 0197 0198 ignoring first interrupt after reset. 0199 0200 destroy ACC,DP. 0201 Ignore first interrupt after reset. TLC32040 receives 0202 - zero as DAC data but no ADC data,in DRCV. 0203 0204 0205 003E 0206 003E 200C IGINT ANINT modify interrupt location LAC SACL XVECT normal communication. 0207 003F 5007 0208 0040 0209 0040 7F8D RET return. 0210 0041 0211 END NO ERRORS, NO WARNINGS ....... ........... ............. ._----------------------====================================== - - 130 ====================================== _ - Interfacing the TMS320 Family to the TLC32040 Family B B.1 TLC32040 and TMS32020 Flowcharts and Communication Program Flowcharts ~------_r------~ ~------_r------~ 2 3 ~------~------~ 6 ....._ _ _ _.,..-_ _ _ _... 4 ~------_r------~ 1 2 3 4 5 - Alterable AR pointer and OVM. Alterable CNF, SXM and XF. Must clear at least 10S'through 127, 19 of internal RAM. If IMR is changed by user program, INST must be changed. 5 - Their contents will be changed by their·routine locations. 6 - IGNR~ is executed only once after reset. a. INITIALIZATION b. RECEIVE INTERRUPT SERVICE ROUTINE c. RECEIVE SUBROUTINE Interfacing the TMS320 Family to the TLC32040 Family d. IGNORE INTERRUPT 131 ~------~------~ 7 7 - IGNRX is executed only once after reset. e. TRANSMIT INTERRUPT SERVICE ROUTINE ~-------,--------~ 8 f. PRIMARY TRANSMISSION ROUTINE ~----------~----------~ 9 8 - Modify to 52 address. 9 - Modify to NRM address. g. PRIMARY-SECONDARY COMMUNICATIONS 1 132 h. PRIMARY-SECONDARY COMMUNICATIONS 2 Interfacing the TMS320 Family to the TLC32040 Family ~-------r------~ 10 11 ~ ~ 10 Modify to NRM address. Modify to 51 address. i. IGNORE TRANSMIT INTERRUPT j. SECONDARY COMMUNICATION JUDGMENT k. IGNORE FIRST INTERRUPTS Interfacing the TMS320 Family to the TLC32040 Family 133 B.2 Communication Program List 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 0053 0054 134 ============================================ TLC32040 & TMS32020 communication program. by H.Okubo & W.Rowand version 1.0 7/15/87. * * This is a TMS32020 - TLC32040 communication program * that can can be used in many systems. To use this * program, the TMS32020 and the TlC32040 (AIC) must be * connected as shown in Volume 3 of linear and Interface * Applications. The program reserves TMS32020 internal * data memory 108 through 127 (82) as flags and data * storage. When secondary communication is needed, every * maskab1e interrupt except XINT interrupt is disabled * until that communication finishes. This means that XINT * will be valid only during one DAC conversion time. * If you have any questions, please let us know. * * * * * * * * * * * ~ ************************************************************ 0000 0001 0004 006C 006D 006F 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 0078 007C 007D 007E 007F * ** ========================== * Memory mapped register. * ========================== *DRR EQU o * data receive register address. EQU 1 DXR * data xmit register address. IMR EQU 4 * interrupt mask register address. ** ============================================ TMPO ACCHST ACClST SSTST INTST RVECT XVECT VRCV VNRM VS1 VS2 DRCV DXMT D2ND FRCV FXMT F2ND EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU 108 109 III 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 * temporary register. * stack for ACCH. * stack for ACCl. * stack for STO register. * stack for IMR register. * vector for RINT. * vector for XINT. * RINT vector storage. * XINT vector storage. * secondary vector storage1. * secondary vector storage2. * receive data storage. * xmit data storage. * secondary data storage. * receive flag. * xmit flag. * secondary communication flag. * Interfacing the TMS320 Family to the TLC32040 Family 0055 0056 0057 0058 0000 0059 0000 FF80 0001 0020 0060 0061 0062 0063 0064 0065 OOlA 0066 OOlA FF80 0018 004A 0067 0068 0069 0070 0071 0072 OOlC 0073 OOlC FF80 OOlD 005A 0074 0075 0076 0020 0077 0078 0079 0080 0081 0082 0083 0020 0084 0020 FE80 0021 0025 0085 0022 CEOO 0086 0023 FE80 0024 0088 .................................................. ........ . ~ • • Processor starts at this address after reset. AORG 0 B STRT • • • • • • program start address. jump to Initialization routine. •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• IE 1E1E1E.1E1E1E1E1E1E1E1E •• IEIEIEIEIEIEIEIEIEIEIEIEIEIE.IEIEIEIEIEIEIEIEIEIEIEIEIEIEIE.IEIEIE •• IEIE •• IE IE II IE IE IE Receive interrupt location. IE IE AORG 26 B RINT IE IE IE IE Rint vector. jump to receive interrupt routine. IE IE 1E1E1E1E1E1l1E1E1E1E1E1E.1E1E1E.1E1I.1E1E1E •• IEIE.IEIE •• IE.IEIlIEIlIlIE.IlIlIEIEIEIlIEIE.1l1E1E1EIE IE IE IE IE IE • 1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E.1E1E1E1E1E1E1E1E1E •• IE •••••• IE •••••••••• Transmit interrupt location. IE IE AORG 28 B XINT • • • IE • Xint vector. • jump to xmit interrupt routine. •••••• IE ••••••• IE •••••••••••••••••••••••• IE.IE •• IE •••••• IIIIIIII II II II II IE IE AORG 32 IE start initial program. IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE User must initialize DSP with the routine INIT. The user may modify this routine to suit his system requirements as he likes. IE IE IE IE IE IE IE IE IE 1E.1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE STRT CALL INIT EINT CALL IGR IE enable interrupt. Interfacing the TMS320 Family to the TLC32040 Family 135 0087 0088 0089 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 0100 0101 0102 0103 0104 0105 0106 0107 0108 0109 0110 0111 0112 0113 0114 0115 0116 Oil7 0118 0119 0120 9121 0122 0123 0025 C800 0124 0026 0001 0027 OEOO 0125 0028 606F 0126 0029 506F 0127 0128 0129 0130 0131 0132 0133 0134 002A 0001 002B 03FO 0135 002C 606f' 0136 002D 516F 0137 i36 II .IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII*IIIIIIIIIIIIIIII.II~IIIIIIIIIIIIIIII.IIIIIIIIIIIIIIII*IIIIIIIIIIIIII111111111111 II ============== II II User area II II II ============== II II II This program allows th& user 2 levels of nesting, si~ce II II 2 levels are used as stack for the interrupt. When the II II II FXMT flag is false'no data transmit has occurred. When II the FRCVfiag is false no data has been received. A~ II II those flags are not reset by any routin~ in this program II II II the user must reset the flag to read or write new data II and note that >OOFF mea~s true, >0000 means false. II II User routines such as digital filtering, secondary-data- II II II communication judgement etc. must be plac&d in this II location. Depending on the sampling rate (conversion II II II rate), these user routines must write the xmit data to II DXMT registe'rs wi thin approximately 500 instruction II II II cycles. If the user r~quires secondary communication, II first write data with secondary code to DXMT, then write II II secondary data to D2ND and, call C2ND routine to set F2ND II and modify XVECT for secondary communication. Note that II ~ every maskable interrupt except XINT is disabled during II II this conversion cycle including secondary communication. II' IIIIKIIIIIIIIIIIIIIII~IIIIIIIIIIIIIIIIII.IIIIIIIIIIIIIIIIIIIIIIIIIIII*IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII111111111111 II * ~IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII.IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII~ II ======================= Initializing routine. II II ======================= II This routine initializes the status, registers, flags, II vector storage contents and internal data locations II II II II II ~ 96 through 107. Note that the User can modify these II II registers (i.e. STO ST} IMR), as long as the contents do II II II not conflict with the operation the AIC. 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 INIT LDPK 0 II set statusO register. LALK >OEOO,O II 0000 1110 0000 OOOOB SACL TMPO,O LST TMPO II II II II II II II II II ARP=O AR pointer 0 OV =0 (Overflowreg.c}ear) II OVM=} (Overflow mode set to U II ! =1 Not affected. I( INTM=} Not affected I( DP 000000000 page, ti, I( I( set statusl register. I( LALK >03FO II 0000 0011 1111 OOOOB SACL lSTl TMPO,O TMPO II APB=O II CNF=O (Set BO data memory) II TC =0 Interfacing the TMS320 Family to the TLC32040 F(lmily 0138 0139 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 0150 0151 0152 0153 0154 0155 0156 0157 0158 0159 0160 0161 0162 0163 • • • • • • • 002E 002F 0030 0031 0032 0033 CAOO 6001 6000 C060 CBIF 60AO 0034 CA30 0035 6004 0036 6073 0037 D001 0038 0065 0164 0039 6077 0165 0166 003A DOOI 003B 006A 0167 003C 6078 0168 0169 D03D DOOI 003E 006 F 0170 003F 6079 0171 0172 0040 DOOI 0041 0055 0173 0042 6076 0174 0175 0043 DOOI 0044 0092 0176 0045 6074 0177 0178 00·46 DOOI 0047 0097 0179 0048 6075 0180 0049 CE26 • • • • • • SXM=l Cenable sign extend ~ode.) • D9-D5=111111 not affected. • XF=l CXF pin status.) FO=O C16bit data transfer mode.j TXM=O CFSX input) • • • ZAC SACL SACL LARK RPTK SACL DXR.O DRR.O ARO.96 31 .+.0 • • Block B2. • Interrupt masking LACK SACL SACL >30 IMR.O INTST.O 0000 0000 0011 OOIiOB II 1I11 XINT I 1111 RINT 1111 TINT INT2 III INTl Ii I • INTO • • • • • • • • • registers • clear • •• clear • • LAlK NRM.O • normal xint routine address. SACL VNRM.O • LALK S1. 0 • secondary xint routine address 1. SACL VSl, 0 • LALK S2.0 • secondary xint routine address 2. SACL VS2.0 • LALK RCV.O lE rint routine address. SACL VRCV.O LALK IGNRR.O lE set ignore first rint address. SACL RVECT.O LALK IGNRX.O SACL RET XVECT.O lE lE lE • set ignore first xint address. • return. Interfacing the TMS320 Family to the TLC32040 Family 137 0181 0182 0183 0184 018S 0186 0187 DIU 0189 0190 0191 0192 0193 0194 019S 0196 0197 0198 0199 0200 0201 0202 0203 0204 020S 0206 0207 0208 0209 0210 0211 0212 0213 0214 021S 0216 0217 0218 0219 0220 0221 0222 0223 0224 022S 0226 0227 0228 0229 0230 0231 0232 0233 138 II lIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlI ================================= Receive interrupt routine. ================================= II II II II This routine stores receive data in its storage II DRCV (112 pageD) and sets receive flag FRCV (12S pageD). II As 2 levels nesting are used. this routine allows the II user 2 levels nesting. without stack extension. II II II II II II II lIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlI 004A 004B 004C 004D 004E 004F OOSO OOSI 00S2 00S3 00S4 7872 C800 607i 6870 2074 CE24 4171 4870 S072 CEOO CE26 DOSS 00S6 00S7 00S8 00S9 2000 607A CAFF 607D CE26 RINT SST SSTST LDPK 0 SACL ACCLST.O SACH ACCHST.O LAC RVECT.O CALA ZALS ACCLST ADDH ACCHST LST SSTST EINT RET II II II II II push data push push load STO register. pointer page O. ACCL. ACCH. ACC vector address. II pop ACC II pop ST register. II enable interrupts. II return. II RCV LAC DRR.O SACL DRCV,O LACK >FF SACL FRCV RET II II II II II load data from DRR. save it to its storage. set receive flag. return. II lIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlI II II II II II II II II II II II II =================================== Xmit interrupt routine. =================================== This routine writes xmit data (the contents of DXMT (123 pageD» to DXR register according to communication condition. i.e. normal communication or secondary communication. For normal communication call normal communication routine (NRM). For secondary. call secondary communication routines (Sl and S2). Because these routines use 2 levels of nesting. the user is allowed 2 levels of nesting if stack extension is not used. II II II II II II II II II II II II lIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlIlI OOSA OOSB OOSC OOSD DOSE OOSF 0060 0061 0062 0063 0064 7872 C800 6071 6870 207S CE24 4171 4870 S072 CEOO CE26 XINT SST SSTST LDPK 0 SACL ACCLST.O SACH ACCHST.O LAC XVECT.O CALA ZALS ACCLST ADDH·ACCHST LST SSTST EINT RET push ST register. data pointer page O. push ACCL. push ACCH. load vector address. call xmit routine. II pop ACC II II II II II II II pop ST register. II enable interrupt. II return. Interfacing the TMS320 Family to the TLC32040 Family 0234 0235 0236 0237 0238 0239 0240 0241 0242 0243 0244 0245 0246 0247 0248 0249 0250 0251 0252 0253 0254 0255 0256 0257 0258 0259 0260 0261 0262 0263 0264 0265 0266 0267 0268 0269 0270 0271 0272 0273 0274 0275 0276 0277 0278 0279 0280 0281 0282 0283 0284 0065 0066 0067 0068 0069 2078 6001 CAFF 607 E CE26 006A 0068 006C 006D 006E 207C 6001 2079 6075 CE26 006F 0070 0071 0072 0073 0074 0075 0076 0077 0078 CAOO 6001 601F CAFF 607E 2077 6075 2073 6004 CE26 l! l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l! l! =================================== l! l! Normal data writing routine. l! =================================== l! This routine is called when normal communication occurs.l! l! this routine writes'xmit data to DXR, and sets xmit flag l! l! C126 pageO). l! l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l! NRM LAC DXMT,O l! write DXR data. SACL'DXR,O LACK >FF l! set flag. SACL FXMT l! return. RET l! l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l! l! ====================================== l! l! l! Secondary data writing routine 1. l! l! l! This routine is called when secondary communication l! l! occurs. This routine writes secondary data 'to DXR, and l! l! modifies the content of XVECTCl17 pageO) for continuing l! l! the secondary communication. l! l! l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l! Sl LAC D2ND,0 l! write DXR 2nd data. SACL DXR,O LAC VS2,0 l! modify for next XINT. SACL XVECT, 0 l! return. RET l! l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l! l! ====================================== l! Secondary data writing routine 2. l! l! l! l! l! l! l! This routine is called when secondary communication l! l! occurs. This routine writes dummy data to DXR to clear l! l! the secondary code for the protection of double writing l! l! the secondary code and reset secondary flagC127 pageD), l! l! modify the content of XVECTCl17 pageO) for normal XINT. l! l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l!l! l! clear data for protection. ZAC S2 l! of double secondary communication. SACL DXR,O l! clear secondary flag. SACl F2ND l! set xmi t end flag. LACK >FF SACL FXMT,O l! set normal communication vector. LAC VNRM,O SACL XVECT,O l! enable all interrupts. LAC INTST,O SACl IMR,O l! return. RET Interfacing the TMS320 Family to the TLC32040 Family 139 0285 0286 0287 0288 0289 0290 0291 0292 0293 0294 0295 0296 0297 0298 0299 0300 0301 0302 0303 0304 0079 007A 007B 007C 007D 007E 007F 0080 0305 0081 0306 0307 0082 0308 0083 0309 0084 0310 0085 0311 0086 0312 0087 0313 0088 0314 0089 0315 008A 0316 0317 0318 0319 0320 0321 0322 0323 0324 0325 0326 0327 008B 0328 008C 008D 0329 008E 0330 008F 0090 0331 0091 140 IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE ======================= Check secondary code. ======================= IE IE IE IE IE IE IE IE IE IE IE destory DP pointer. ACC. IE IE IE This routine checks whether the data in DXMT (123 pageO)1E has secondary code or not. If secondary code exists, IE then disable maskab1e interrupts except XINT, modify the IE contents of XVECT(117 pageD) for secondary communication,1E and set secondary flag. Note that we recommend calling IE this routine to send control words to AIC. IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE C800 CA03 606F 207B 4E6F 106F F680 0082 CE26 C2ND o. LDPK 0 LACK 03 SACL TMPO LAC DXMT,O AND TMPO SUB TMPO,O BZ C2NDI IE data page pointer IE is this data secondary code IE if yes, then next. RET IE else return. LACK >FF SACL F2ND,0 LACK >20 SACL IMR,O LAC VSl, 0 SACL XVECT,O LAC DXMT,O SACL DXR,O RET IE set secondary flag. IE enable only XINT. IE IE CAFF 607F CA20 6004 2078 6075 207B 6001 CE26 C2ND1 IEmodify vector address for secondary IE communication. IE write primary data to DXR. IE return. IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE ======================= IE IE IE Check first interrupt IE ======================= IE IE IE This routine check whether both first interrupts have IE occurred. If this routine is called after reset, this IE IE IE routine waits for both interrupts then returns. IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IE IGR LAC FRE,O IE check first interrupt after BZ IGR IE master reset. IE 206D F680 008B 206C F680 008B CE26 LAC BZ FXE,O IGR RET Interfacing the TMS320 Family to the TLC32040 Family II 0332 0333 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 II 0334 II 0335 Ignore interrupt routine. II 0336 ============================== 0337 II These routines are for the purpose of ignoring the firstll 0338 II RINT and XINT after the DSP reset. The routines only set II 0339 II flags and modify each vector address to normal interrupt II II 0340 II address but do not read or write to serial ports. 0341 II II Note that first data that the first data that the AIC 0342 II II will receive after the DSP reset is OOOOH. 0343 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 0344 0092 CAFF IGNRR LACK >FF 0345 0093 606D SACL FRE,O 0346 0094 2076 LAC VRCV,O II set normal receive address. 0347 0095 6074 II SACL RVECT,O 0348 0096 CE26 II return. RET 0349 II 0350 0097 CAFF IGNRX LACK >FF 0351 0098 606C SACL FXE, 0 0352 0099 2077 LAC VNRM,O II set normal xmit address. II 0353 009A 6075 SACL XVECT,O 0354 0098 CE26 II return. RET 0355 II 0356 END NO ERRORS, NO WARNINGS Interfacing the TMS320 Family to the TLC32040 Family 141 142 Interfacing the TMS320 Family to the TLC32040 Family C C.1 TLC32040 and TMS320C 17 Flowcharts and Communication Program Flowcharts •. MAIN Interfacing the TMS320 Family to the TLC32040 Family b. INTERRUPT SERVICE ROUTINE 143 144 c. PRIMARY COMMUNICATION 1 d. PRIMARY COMMUNICATION 2 e. PRIMARY-SECONDARY COMMUNICATION 1 f. PRIMARY-SECONDAiw COMMUNICATION 2 g. PRIMARY-SECONDARY COMMUNICATION:3 h.. PRIMARY-SECONDARY· COMMUNICATION 4 Interfacing theTMS320 Family to the TLC32040 Family DIGITAL LOOPI!ACK Interfacing the TMS320 Family to the TLC32040 Family 145 C.2 Communication Program List 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 146 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ ~ ~ ====================================================== ~ TlC32040 to TMS320C17 Communication Program version 1.1 ~ ~ by Hironori Okubo and Woody Rowand Texas Instruments ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ This program uses the circuit published in the vol. 3 of linear and Interface Circuit Applications with the following modifications: 1. BIO- of the TMS320C17 must be connected to EODXof the TlC32040. 2. INT- of the TMS320Cl7 must be connected to FSXof the TLC32040. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ In this configuration, the program will allow the TLC32040 to communicate with the TLC320C17 with the with the restriction that all interrupts except INTare prohibited and only synchronous communication can occur. The progr,am allows the user 2 levels of nesting in the main program; the remaining 2 levels being reserved for the interrupt vector and subroutines. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ====================================================== ~ ~ ~ ~ ~ ~ ~ If desired, this program may be used with the TMS32011 Digital Signal Processor with the following change. Since the TMS320ll has only sixteen words of data RAM on data page 1, all of the registers used by this program should be moved to data page 0, except for SSTSTK (the temporary storage location for the status register) which must remain on page 1 (since the SST instruction always addresses page 1). ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 OOOA OOOB OOOC DODD SSTSTK ACHSTK AClSTK RXEFLG DRCVl DRCV2 DXMTI DXMT2 DXMT3 DXMT4 VECT ANINTI ANINT2 ASINTI EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU >00 >01 >02 >03 >04 >05 >06 >07 >08 >09 >OA >OB >OC >OD stack for status (SST) register. stack for accumulator high (ACCH). stack for accumulator low (ACCL). xmit/receive in progress. storage for high byte receive data. storage for low byte receive data. storage for high byte xmit data. storage for low byte xmit data. storage for high byte secndry data. storage for low byte secndry data. storage for interrupt vector addr. storage for normal xmit/rcv vect 1. storage for normal xmit/rcv vect 2. storage for secndry xmit/rcv vect 1. lnterfacmg.the TMS320 Family to the TLC32040 Family 0053 OOOE OOOF 0054 0010 0055 0056 0011 0012 0057 0058 0013 0059 0014 0060 OOFF 0061 0000 0062 0063 0064 0065 0000 0066 0000 F900 0001 0013 0067 0002 0068 0069 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 0080 0081 0082 0083 0084 0085 0086 0087 0088 0002 0089 0002 0090 0002 0091 0002 6EOI 0092 0003 7COO 0093 0004 5801 0094 0005 5002 0095 0006 4813 0096 0007 0097 0007 4011 0098 0008 2011 0099 0009 7912 0100 OOOA FFOO OOOB 0007 ASINT2 ASINT3 ASINT4 CNTREG MXINT CLRX TEMP flAG EQU EQU EQU EQU EQU EQU EQU EQU >OE >OF >10 >11 >12 >13 >14 >FF storage for secndry xmit/rcv vect 2. storage for secndry xmit/rcv vect 3. storage for secndry xmit/rcv vect 4. storage for control register. storage for xmit interrupt mask. storage for xmit interrupt clear. temporary register. flag set. ======================================= Branch to Initialization Routine. ======================================= AORG B >0000 INIT branch to initialization routine. *-********************************************************** * ================================= Interrupt Service Routine. * * ================================= * To initiate secondary communications, change the * contents of VECT ~o the address of the secondary * * * * * * * communications subroutine and store the secondary * * communication information in DXMT3 and DXMT4. * ** e.g. * * modify VECT. ASINTl * LAC * SACL VECT * * store high-byte of secondary LAC HI * * SACL DXMT3 information in DXMT3. * * store low-byte in DXMT4. LAC H2 * SACL DXMT4 * * ************************************************************ >0002 interrupt vector. INTSVC LDPK SST SACH SACL OUT 1 SSTSTK ACHSTK ACLSTK CLRX,PAO push push push make HAITI CNTREG,PAO CNTREG,PAO MXINT HAITI read control register. load accumulator with control reg. mask-off xmit interrupt flag. loop until xmit interrupt flag is AORG IN LAC AND BZ Interfacing the TMS320 Family to the TLC32040 Family status register. accumulator high. accumulator low. sure FSX-flag is clear. 147 0101 0102 0103 0104 0105 0106 0107 0108 0109 0110 0111 0112 0113 0114 0115 0116 0117 0118 0119 0120 0121 0122 0123 0124 0125 0126 0127 0128 0129 0130 0131 0132 0133 0134 0135 0136 0137 0138 0139 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 0150 0151 0152 0153 148 OOOC 0000 OOOE OOOF 0010 0011 0012 0013 200A 7F8C 6501 7A02 7800 7F82 7F80 - LAC CALA ZALH OR LST EINT VECT ACHSTK ACLSTK SSTSTK RET recognized. load acc with interrupt vector. call appropriate xmit/rcv routines. pop accumulator high. pop accumulator low. pop status register. enable interrupts. return to main program. - ==================================== _ .Initialization after Reset. - ==================================== _ _ 0013 0013 0014 0015 0015 0016 0017 0018 0019 OOlA 0018 ODIC OOln ODIE 001F 0020 0020 0021 0022 0022 0023 0024 0024 0025 0026 0027 0027 0028 0029 002A 0028 0028 002C 7F8l 6EOl Data RAM locations >80 through >92 are reserved by this program. The user must set the status register at the end of this program with the SST command or a combination of SOVM, LOPK etc. IN IT - - disable interrupts. set nata page pointer one. DINT LOPK 7F89 6880 7083 50A8 50A8 50A8 50A8 50A8 50A8 50A8 5088 ZAC LARP LARK SACL SACL SACL SACL SACL SACL SACL SACL clear registers. 0 0,RXEFLG+>80 4906 4906 OUT OUT DXMTl,PAI DXMTl,PAl 7E04 5012 LACK SACL 100000100 MXINT 7EOl 5014 6A14 LACK SACL LT TEMP TEMP prepare for serial port initialization and initialization of registers containing l6-bit constants. 8094 7F8E 6713 4813 MPYK PAC TBLR OUT CLXl initialize interrupt flag clear. CLRX CLRX,PAO configure serial port. 806E 7F8E MPYK PAC NINTl H H H H H H H IE 1 G~ear transmit registers. initialize xmit-int mask. save normal communication address to its storage. Interfacing the TMS320 Family to the TLC32040 Family 0154 0155 0156 0157 0158 0159 0160 0161 0162 0163 0164 0165 0166 0167 0168 0169 0170 0171 0172 0173 0174 0175 0176 0177 0178 0179 002D 002E 002F 002F 0030 0031 0032 0032 0033 0034 0035 0035 0036 0037 0038 0038 0039 003A 003B 003B 003C 003D 003E 003E 003F 0040 0041 0042 0043 0044 0044 0045 50 DB SODA SACl SACl ANINTl VECT 8074 7F8E 500C MPYK PAC SACl NINT2 807B 7F8E 500D MPYK PAC SACl 8081 7F8E 500E MPYK PAC SACl 8087 7F8E 500F MPYK PAC SACl 808C 7F8E 5010 MPYK PAC SACl ASINT4 F600 0042 F900 003E F600 0042 IGNORI BIOZ IGNOR2 0180 0181 7F82 0182 0183 0184 0185 0186 0187 0188 0189 0190 0191 0192 0193 0194 0195 0196 0197 0198 0199 0200 0201 0202 0045 B IGNOR2 BIOZ EINT preset interrupt address. save normal communication address 2 to its storage. ANINT2 SINTl save secondary communication address I to its storage. ASINTl SINT2 save secondary communication address 2 to its storage. ASINT2 SINT3 save secondary communication address 3 to its storage. ASINT3 SINT4 save secondary communication address 4 to its storage. ignore first FSX pair after reset. IGNORI IGNOR2 enable interrupt. *••••••••••••••• M•• MMM •••• M•••••••••••• M •• M•• M.M •••• M ••••••• M M ================================= Main Program (user area) • ================================= ** * * * * M * *• * M * * * * This program allows the user 2 levels nesting, since one level is used as stack for the interrupt and the interrupt service routine makes one subroutine call. • User routines such as digital filtering and secondary- • communication judgement. Depending on the sampling rate. the user's routines must write the data to the transmit registers within approximately 500 instruction cycles. * * * In the example below, the first two transmissions send secondary information "to the AIC. The first configures the TB and RB registers. The second configures the control register. ** * * * * *.M.M.M.* •••••• ** ••••• *••• ***.*.* ••• *••• *••• *••••• *** •• *.*.** • • Interfacing the TMS320 Family to the TLC32040 Family 149 0203 0204 0205 0206 0207 0208 0209 0210 0211 0212 0213 0214 0215 0216 0217 0218 0219 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F 7F89 5006 7E03 5007 7E24 5008 7E92 5009 200D 500A 4906 0050 0051 0052 0052 0053 0054 0055 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F 0060 0060 0061 0062 7F89 5003 lAC SACL LACK SACL LACK SACL LACK SACL LAC SACL OUT DXMTl >03 DXMT2 >24 DXMT3 >92 DXMT4 ASINTl VECT DXMTl,PAI prepare first control word. lAC SACL RXEFLG clear xmit/rcv end flag. LAC Bl RXEFLG MAINI wait for data transfer to complete. ~ 2003 FFOO 0052 0220 0221 7F89 0222 5006 0223 7E03 0224 5007 0225 7EOO 0226 S008 0227 7E67 0228 5009 0229 200D 0230 500A 0231 4906 0232 7F89 0233 0234 5003 0235 0236 0237 0238 0239 0240 0241 0242 0243 0244 0245 0062 0246 0062 2003 0247 0063 FFOO 0064 0062 0248 0065 2004 0249 0066 5006 0250 0067 2005 0251 0068 5007 0252 0069 4906 0253 150 MAIN MAINI lAC SACL LACK SACL LACK SACL LACK SACL LAC SACL should be xxxx xxII. set VECT for secondary communications. store first transmit byte in transmit buffer. prepare second control word. OUT DXMTl >03 DXMT2 >00 DXMT3 >67 DXMT4 ASINTl VECT DXMTl,PAI lAC SACL RXEFLG ...... ..... .. clear xmit/rcv end flag. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ • ================================== ~ ~ Digital LoopBack Program ~ ================================== ~ This program serves as an example of what can be done in the user area. .~~~~.~~ DLB ... .... ... ~.~~ ~ ~ ~ • ~ • ~.~.~~~~~~~~~~~~~~~~~.~~.~~~~.*~~~~~~ LAC Bl RXEFLG DLB wait for data transfer to complete. LAC SACL LAC SACL DRCVl DXMTl DRCV2 DXMT2 DXMTI,PAI move receive data to transit registers. OUT ~ ~ ~ ~ ~ ~ write first transmit byte to transmit buffer. Interfacing the TMS320 Family to the TLC32040 Family 0254 006A 7F89 0255 006B 5003 0256 006C F900 006D 0062 0257 006E 0258 0259 0260 0261 0262 0263 0264 0265 0266 0267 0268 0269 0270 0271 006E 0272 006E 4907 0273 006F 4104 0274 0070 200C 0275 0071 500A 0276 0072 4813 0277 0073 7F8D 0278 0074 0279 0074 4105 0280 0075 200B 0281 0076 500A 0282 0077 4813 0283 0078 7EFF 0284 0079 5003 0285 007A 7F8D 0286 007B 0287 0288 0289 0290 0291 0292 0293 0294 0295 0296 0297 0298 0299 007B 0300 007B 4907 0301 007C 4104 0302 007D 200E 0303 007E 500A 0304 007F 4813 0305 0080 7F8D ZAC SACL B RXEFLG DLB clear rcv/xmit-end flag. ***********************************************M****M******* * ==================~================ * Normal Interrupt Routines. * =================================== ** These routines destroy the contents of the accumulator * and the data page pointer. making it necessary to save * these before the routines begin. ** Write the contents of DXMT2 to the transmit buffer and * read the receive buffer into DRCVl. * * * * ** * * ** * * ************************************************************ NINT1 NINT2 OUT IN LAC SACL OUT RET DXMT2.PA1 DRCV1.PAI ANINT2 VECT CLRX.PAO write xmit-Iow to xmit register. read rcv-data-high from rcv reg. prepare next interrupt vector. IN LAC SACL OUT LACK SACL RET DRCV2.PAl ANINTl VECT CLRX.PAO FLAG RXEFLG read receive-data-low from rcv reg. prepare next interrupt vector. clear xmit interrupt flag. clear xmit interrupt flag. set xmit/rcv end flag. * ======================================== * Secondary Interrupt Routines * ======================================== * These routines destroy the contents of the accumulator * and the data page pointer. ** The following routines write the low byte of primary * communications and the high and low byte of secondary * communication. They also read the A/D information from * the receive registers. * * * * * ** * * * ************************************************************ SINT1 OUT IN LAC SACL OUT RET DXMT2.PAl DRCV1.PAl ASINT2 VECT CLRX.PAO write xmit-data-low to xmit reg. read receive-data-high from rcv reg. prepare next interrupt vector. clear xmit interrupt flag. Interfacing the TMS320 Family to the TLC32040 Family 151 0306 0307 030S 0309 0310 0311 0312 0313 OOSl OOSl 00S2 00S3 00S4 00S5 OOSli 00S7 00S7 OOSS 0089 OOSA OOSB OOSC 008C OOSD 008E 008F 0090 0091 0092 0093 490S 4105 200F 500A 4S13 7FSD SINTZ OUT IN LAC SACL OUT RET DXMT3,PAl DRCV2,PAl ASINT3 VECT CLRX,PAO write secondary-data-high to xmit. read. receive-data-Iow from rcv. prepare next interrupt vector. clear xmit interrupt flag. DXMT4,PAl write secondary-data-Iow to xmit. 4909 SINT3 OUT prepare next interrupt vector. 0315 ASINT4 2010 LAC 0316 500A SACL VECT clear xmit interrupt flag. 4S13 OUT CLRX,P~O 0317 031S 7F8D RET 03i9 prepare next interrupt vector. 0320 200B SINT4 LAC A~INTl 500A SACL VECT 0321 0322 4813 OUT clear xmit interrupt flag. Cq~X,PAO 0323 lAC 7fS9 5007 clear DXMT2 immediately to eliminate 0324 SACL DXMT2 unnexpected secondary communications. 7EFF LACK FLAG 0325 5003 SAC( RXEFLG set xmit/rcv end flag. 0326 0327 7F8D RET ~~ ~ 0328 0329 0330 • CONTRq~ ~EGISTER INFORMATION • 0331 0332 SERIAL-PORT CONFIG. INT. MASK INT. flAG 03~3 I 1 0 0 R·I· 1 1 01 0 0 0 11 o 1 0 0 I 0334 IS 1~ 13 12 11 10 9 8 7 6 5 4 3 2 1 0 . I 0335 I I I LINT I I I __ FSR 0336 LXF status I _ _ _ FSX 0337 _ _ _ _ FR 033S 0339 (write l's to clear) 0340 0341 DAtA >SE14 0342 0094 8E14 CLXl 0343 END NO ERRORS, NO WARNINGS 0314 ........ ......... ........................................ • • • • • • • • •• • • • • • • • • • • •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• • lS2 Interfacing the TMS320 Family to the TLC32040 Family Icc Requirements ofa TMS320C25 DaveZalac Digital Signal Processor Products - Semicon~uctor Group Texas Instruments . IS3 154 ICC Requirements ala TMS320C25 Introduction Minimization of total power dissipation of an electronic system is often an important design objective. Iftight contraints on supply current are imposed on a design (such as in battery-powered systems), considerations relating to supply current are especially critical. Optimization of such designs is facilitated by an understanding of the tradeoffs involved in the behavior of the supply current requirement of each component of the system. The supply current (ICc) requirement of the TMS320C25 digital signal processor varies significantly under different sets of user-imposed conditions. The purpose of this report is to present a characterization of that requirement with respect to operating frequency, supply voltage, output loading, and temperature. Given an understanding of the variations of TMS320C25 ICC, the system designer can make appropriate design tradeoffs. In this report, a description of supply current as time-averaged capacitor-charging will be developed by considering the supply current requirement of a CMOS inverter. Characterization data describing the behavior of the Icc requirement of the TMS320C25 in normal and low-current modes will be presented. The effects on ICC of output loading and temperature variation are discussed. Finally, some low frequency considerations are made. Supply Current Requirement of a CMOS Inverter Some insight into the behavior of supply requirement under varying conditions can be gained through consideration of the basic CMOS converter shown in Figure 1. The capacitor shown in the figure represents the total load capacitance presented by the capacitances of gates connected to the output node, capacitances associated with the inverter structure itself, and interconnect capacitance. ICC Requirements of a TMS320C25 155 Figure 1. Basic CMOS Inverter Vcc i CMOS- ----, S I I I I I I I VI .1. I I I I I I I L ___ 0 I I I I I I I I ! I I I I I I ..§ ___ -.1I 0 '::" Vo C '::" If the input voltage is fixed at a logic high or logic low level, one ofthe two inverter transistors will be nop-conducting (off) while the other has a highly conductive channel (on). Under this condition, the supply current is equal to the negligibly small P-N junction leakage current through the off device. If the input makes a transition from a logic high to a logic low level (or vice-versa), there will be a short interval of time during which both transistors conduct as the inverter is switching. The supply current during this interval is much larger than that under DC-input conditions. Thus, appreciable current is drawn from the supply only when the inverter is switching. This is in contrast to NMOS logic inverters, in which both the load and driver transistors are always conducting. The absence of a current path under DC-input conditions is thus responsible for the strong dependence of power consumption on operating frequency in CMOS logic circuitry. Let us assume a transition of the input signal is possible every T seconds. The average supply current can be computed by taking into account the supply currents associated with each of three possible events of the output signal (no transition, high-to-Iow transition, low-to-high transition). As already stated, the supply current is negligibly small under static input conditions. Thus we will take the average current to be zero for an interval T wide during which the inverter does not switch. If the input voltage makes a high-to-Iow transition, the N-channel transistor will tum off and the capacitor C will be charged through the conducting P-channel device to the output high level of VOH volts. The total charge Q delivered to C is given by 156 ICC Requirement of a TMS320C25 (1) The output levels for a typical CMOS inverter approach V OH = Vee and VOL = 0 V. Thus C x Vee coulombs are transferred to C each time the output makes a low-to-high transition. The average charging current during the interval is given by Q Ie = - = C X Vee X T (2) f where f =Iff. When the output makes a high-to-Iow transition, C discharges through the N-channel device. The energy stored on the capacitance C is dissipated primarily in the N-type channel. The current sourced by the supply for high-to-Iow transitions of the output is zero as the P-channel device is off. Given this description of supply current, low-to-high transitions of the output are the only events during which current is sourced by the power supply. The average supply current is thus given by: lAVE =k X C X Vee X (3) f where k is equal to the normalized number of transitions that are from a low to a high output level. Thus the average supply current is linearlyrelated to output capacitance, supply voltage, and operating frequency. The average power delivered by the supply is the average product of supply voltage and current and is given by: PAVE = (V X I)AVE = Vee X lAVE =k X C X Vee 2 X f (4) Similar variations with operating frequericy, supply voltage, and node capacitances can be expected of the behavior of the supply current of a complex CMOS integrated circuit. Each time the machine is clocked, charge is transferred to some nodes from either the power supply or from previously charged nodes. Some of the charge on nodes previously at a logic high is lost due to leakage. Additional supply current may be required to replenish the charge on these nodes. The total charge requirement for a given machine cycle depends, as in the case of the inverter, on the product of VCC and the total capacitance charged during that machine cycle. The total capacitance of the IC is directly related to the area of the die. Thus we expect the IC's supply current requirement to be proportional to supply voltage, operating frequency, and die size. Recall that both lAVE and PAVE for the CMOS inverter are proportional to k. The implication this has for a complex CMOS integrated circuit is that of a relationship between power dissipation and the binary representation of the code being executed by the device and data driven on the external bus. Execution of different pieces of code can result in different supply current requirements under otherwise equal conditions. Given this information, let us now look specifically at the TMS320C25 with respect to supply current requirement. It is important for the reader to understand that the data presented in the following sections are used only to characterize the way in which ICC varies as externally imposed ICC Requirement of a TMS320C25 157 conditions are varied. The data should not be taken to supersede the TMS320C25 electrical specification. Furthermore, as a result of process variations and enhancements, the relationship between ICC and external conditions can itself vary. For example, the slopes of the lines in the graphs shown in Figure 2 may increase or decrease somewhat with process parameter variations. In all cases, however, the supply current specification is met by every TMS320C25 device. Shown in Figure 2 are plots of supply current vs. frequency for five values of supply voltage for the TMS320C25. Figure 2. TMS320C25 Supply Current Versus Frequency Plots Icc VS. fCLKIN AND Vee (NORMAL OPERATING MODE) 170 160 150 130 ./ ~ / ./ ~ 110 - 100 V/ r.... 90 80 60 20 .... Vee =4.50 V ......... ~ ........... i""" ~i""" ~~ ~ ~~ ~~ ~ 50 40 lh % h 70 30 ...V V . . . . ,"'.,..i-" -"l V~ " , 120 0 0 Vee = 5.50 V Vee =5.25 V Vee = 5.00 V / . V .... ./. ~ V~ Vee =4.75 V 140 P register TIM register Auxiliary registers 1-7 PRO register Status regs STO & ST1 The timer interrupt routine uses two levels of stack plus as many levels as are required to accommodate subroutine calls from XMT and RCV. If the PRD register contains a value less than 64 (19.2 kbps @ K = 8 or 9.6 kbps @ K = 16), the sampling of some receive bits may be significantly delayed from bit inter- val centers and some transmit signal edges may be delayed. The actual transmit and receiver-sampling bit rate r is given by r = lI[P x K x Tc(C)] , where P is the SUQl. of the contents of the PRO register and one. If no integer value of P exists for a specified r, K, and Tc(C)' the receiv~r should typically be allowed to run at the rate closest to but greater than the ideal bit rate. If the receiver bit rate is exactly equal to the transmit bit rate of the external transmitting equipment, the sampling of incoming bits will occur at times close to the centers of the corresponding bit intervals. Some error is introduced by the latency between the falling edge of the start bit and the time at which the start bit is detected. The maximum value of that error (et) is equal to one period of the timer interrupt. 178 An Implementation of a Software UART Using the TMS320C25 Additional error is introduced if the receiver bit rate differs from the bit 'rate of the incoming data stream. Let the bit duration dictated by the timer interrupt rate be denoted by T 1 and let the bit duration of the incoming data be denoted by T2. The error introduced by the inequality of TI and T2 (e2) for the n'th bit is given by (1) The start bit corresponds to n e2 evaluated at n = WORD_LEN. = 1. The cumulative error for one word is equal to Still another source of error is the latency associated with multicycle instructions. Should a timer interrupt occur during execution of a multicycle instruction or repeat loop, an error e3 will delay the sampling of BIO by a minimum of zero and a maximum of I -1 cycles, where I is the length (in cycles) of the longest instruction or repeat loop. The total difference between the sampling time and a corresponding bit interval center is the sum of e}, e2, and e3' In general, the absolute value of the sum of el, ~, and e3 must be less than one-half the duration of one bit in the incoming data stream in order that all sampling instants fall in corresponding bit intervals; i.e., (2) The above constraint is appropriate for a receive signal having negligible rise and fall times and equal space and mark durations. If either of these conditions is not satisfied, the constraint expression should be modified accordingly. Worst-Case Error Analysis Following are descriptions of the two worst-case scenarios in terms of the three error components. The results of this analysis are then plugged in the constraint expression given in (2) to yield a description of the error constraint in terms of rate difference, K and I. If the incoming data rate is higher than the receiver bit rate, el, e2, and e3 are all greater than or equal to zero. The worst-case value of el is its maximum value given by el(max) = tc(C) X = TI/K [< PRD reg > + 1] The e2 contribution is the cumulative error resulting from the inequality of T 1 and T2 and is given by e2(max) = (T 1 - T2) X (WORD~EN - 112) The worst-case value of e3 is given by e3(max) = (Imax - 1) X tc(C) An Implementation of a Software UART Using the TMS320C25 179 If the incoming data rate is lower than the receiver bit rate, elo e2, and e3 are all less than or equal to zero. The worst-case value of el is its minimum value given by el(min) = 0 The e2 contribution is the cumulative error resulting from the inequality of T 1 and T 2 and is given by ~(min) = (Tl - T2) x (WORD_LEN - 112) The worst-case value of e3 is given by e3(min) =0 The error constraint (2) is thus satisfied if the following pair of inequalities is satisfied: + e2(min) + e3(min) > - T2/2 el(max) + e2(max) + e3(max) < T2/2 (3) el(min) where expressions for the extreme values of each error component are given above. The inequalities in (3) specify the overall constraint on maximum rate difference, minimum value of K and maximum value of I. For example, suppose = 0.100 ms = 0.103 ms = 20 = lOOns tc(C) WORD_LEN = 10 Since T 1 is sufficiently close to T2, the first inequality in (3) is satisfied: o+ [(l03xlO-6) - (lOOxlO- 6)] x (10-0.5) + 0 > (-lOOxlO- 6)/2 Evaluation of the second inequality in (3) yields (103 x 10-6)/K X + [(103 X 10- 6) - (100 X 10- 6)] X (10 - 0.5) + (20 - 1) (lOOxlO- 9) < (100xlO- 6)/2 or K~6 Thus (2) translates into a specification for the minimum value of K for a given T 1, T2, I, tc(C)' and WORD~EN .. In summary, considerations must be made with respect to the data rate of the external transmitting equipment, the data rate resulting from the timer interrupt rate, and the latencies associated with start bit detection and multicycle instructions. The two inequalities in (2) must be satisfied for all bits for proper UART operation . 180 .An Implementation of a Software UART Using the TMS320C25 • Loopback Test In the source code given, the XMT and RCV routines are structured to implement a loopback test at 9600 bps, 7 data bits, 1 stop bit and odd parity. The circuit shown in Figure 7 can be used to interface to RS-232-compatible transmit and receive lines. No other RS-232 signals are supported. +5V 2kQ XF ;1;12 V TMS320C25 Transmit line 75189 BIO TTL level ;1;12 V Receive line Figure 7. RS-232 Interface References [1] TMS7000 Family Data Manual, literature number SPNDOO1C, Texas Instruments, 1989. [2] McNamara, John, Technical Aspects of Data Communications, Digital Equipment Corporation, 1982. [3] Data Communications Standards, McGraw-Hill, 1982. [4] Second-Generation TMS320 User's Guide, literature number SPRU014A, Texas Instruments, 1989. An Implementation of a Software UART Using the TMS320C25 181 - HHHHHHHHlHHHtIHIHIHHf.fttHHHfHff-lHfff.I-HHHfHHfHIHH ~ Iff.HHHHHfHfffHfHfHHfHfHfHfHttfHfH*tHHHfHHHHfHfHHfH •UARTPIIlT •,.t SlFTIiIRE UART USINl TIE TIIS32OC25 IfIITTEN BY' IWI£ ZALAC TEXAS INSTRlI'IENTS, INC. ; PORT ADIlRESS OF LlART STATUS REGISTER HI*ftHHffHtHHfHHfHHHffffHHffffHHftfffffffHHtHHHHHHHtH 1131189 INITIAl VIU£S OF UART PARAllETEIlS PROGRAN IEIlmY REllUIREIIElIr: 332 I«JRDS DATA IEIlmY REllUIREI1ENT. 23 I«JRDS MAXI.... BIT RITE. 19.2 KIIPS HHfHffHHHfHHHHffHfHfHfffHHHfHffHofffHHHtHHftHHHfHIH •I"'ACTIVE ••• t fotHHfHHfHfHHfHHtHHHfHHHHHfHHftHlfH*fHftHHHffHH.fHf ASSEII8I.Y-TillE CIl'lSTANTS SECTION *HffHl-fHHHHHHHHHHHffHfHHHfHHHffffHHHHHHfffHtHHHf • ).. :::r ~ •••t OOlh •SIt ...i:) •FllllERR..IISK RPE-Q.R .set OOlh OFEh .Q, I:a V, ~ I:a ~ .~ '"'l ~ FllllERR..ClR •••t •R!ILIISK .Stt 1U..5ET ...t RIILClR •RIIA..IISK RDA..5ET RDA..ClR .Sft .set 002h 00211 OFDh ; RECEIVE FRAIIINl ERROR ITlNTPER , •• t 259 .,.t I 004h 004h OFBh ; RECEIVE DATA 008h 008h OF7h , RECEIVE DATA AVAILAIIlE ; RECEIVER EllABLE RlIE..ClR TDAJISI( .stt .set .s.t O2Oh 020h O1t'h , TRANSIIIT DATA AVAlLAIIlE TIlA-ClR •T1Il ~ OIOh OIOh OEFh ••• t RWG .set X8lTs..REG • ,';t RBITS •••t XBREG .,.t IMP.PTR Il'LPTR ••• t ••• t DIYIDES TINT RATE BY K !lIlT) DIVIDES TINT RITE BY K (ilCV) USED BY TRANSIIlTTER TO CWNT DATA BITS USED BY RECEIVER TO CWNT DATA BITS USED BY XCCII'OSE TO CWNT DATA BITS POINTS AT LOCATI(Ij TO PUT RECEIYE1I DATA POINTS AT DATA TO BE TRANSIIITTED HHfHffHHHtHHHMHHHfHfffHffHHHtlfHfHftHHfHHHHfHHHH END ASSEIIBLY-TlIIE CIl'lSTANTS SECTION , ffffHHHtfHffHtHHHHffHlHHftfHHfHHtHHHHfHfHHHHHHHfH DATA IIEIIORY SPACE RESER'lATI(Ij 1IIIIIIIIIIIIIIIIIIIIIIIIIIItHHHHfHtHHHHHttHHHHHHHHHffUHf HiffHHHfHfHt*fHfHHfHHfHffH*HlfHIHHlfHfHfHHHHHHtHffH USTAT REGISTER VARIABlES BIT I 5 4 3 2 FLM TIlA 0 RlE RIIA 0 IU INlTlAL IIt'ILI£ 0 0 ~ "C ~ REGISTER ASSIGNI1ENTS HHftHHffHHHHHHHHHIHH*fHfHfHHHHfHfHHHHHtffHffHtH+ .set .stt TIlA..5ET Q v, .stt ... t =KI2-1 K2II1 IUI1IER OF DATA BITS/10m TOTAL I OF BITS/_ ODD = I SELECTS ODD PMITY OlIO =0 SELECTS E1JEII PMITY TINTPER =TIllER INTERRlf'T PERIOD 1M CI.KOOTl CYU.ES. TINTPER SIQ.lI) lIE SET TO C1I (K 10 ; RECEIVE PARITY ERROR RlE.1ISK RlE..5ET • ~ •••t FRtERfLSET .Stt s· OQ ••• t RPACTlVE =I INDICATES ReV PMITY CHECKINlIl'l f1NT RATE =K4BIT RATE; KIll =K-I IN'll ••• t I_..lEN ••• t IODD HHtHltfHHHffHHfHfHHfHHHHflHffffffHfHfHfHHHH*HflfHfH.. I g' .,.t IK2IIl STATUS BIT IIASKS •RPE.J1SK •RPE..5ET ~ •IKIII I FRII 0 0 RPE 0 fHffHHH+HHHHHftfHHfHfHfHfHffHHHHftffHHff4HHi.fHfHHflf ~ ..... ~ ,bss .bss ,bss .bss ,bss ,bss ,bss .bss ,bss .b55 ~ ;: 3' 'ti ~ :! '~" ;: g. .DSS ;: .bss .bss .bss .bss .bss .Q, I:l V) i .b55 .bss ,bss .bss .bss .bss .bss I:l ~ ~ ...,;:.;, ~ ~. ~ ~ tv a ~I,I , , , , , WORD-LEN, I 000,1 TlNTPER, I TIIE,1 RECEIVER STAM lIART STAM REGISTER SHIFT FACTI)! RECEIVED BIT RECEIVER SHIFT REGISTER LOCAI.J.Y-GElERATED PARIT'i INITIAL VALIJE OF RPAR STOP BIT STRING INITIAL VALI£ OF XSTOf' TRANSIIIT APRITY RECEIVE BlfFER TRANSIIIT PARITY TOGGLE IIASK TRIWSI1IT DATA TRANSIIIT SHIFT REGISTER SCRATCH VARIABLE RECEIVE PARITY ACTIVE 10/1) K-I N-I D\'ERAL.L WORD LENGTH SELECTS ODD/EVEN PARITY 11/01 TlI£R INTERRlf'T PERIOD TRANSIIIT BlfFER EJf'TY PROGRAII SECTION .sect .Sf/iU *TlMINT • MIN IIRS+24-$iflbl , POSITIIlII TINT VECTOR XMIT , BRANCH TO XIfT IRe\' ROUTlI£ • text , INITIALIZE LDPK ZAC SACL CALL lIARLINIT , , , , , , LACK SACL 10h USTAT , ENAIII.E RECEIVER SIMI SSXM $PM CNFD SELF SELF END PROGRAM SECTION IffftfffHfHHfHIfHffffffHftHffHfHfffUffffffHfffffHHHHfHffHffH lIART INITIALIZATION ROUTINE THE FOLLIIIING COIlE INITIALIZES THE lIART PER THE VALI£S IN THE ASSEMIll.YTIlE CONSTANTS SECTION ABOVE. ROUTINE PARINIT IS A SUIlSET OF lIARLINIT AND MY BE CALLED INDEPENDENTLY. flfffffffH+ffffnUfffflHfHffHfttHfffHffffH+fHfHffHfffHHHt+f4Hff •UARLINIT LDPK LALK SACL LALK SACL LALK SACL NO GLOBSL rIEIIlRY SET 0YfRFL1II r10IIE SET SllJHlT. r10IIE P-REG SHIFT • 0 BITS CON'IGIJlE IIlOCK BO AS DATA /£l1ORY INITIALIZE IJART LALK Itlll NMI SACL ZALS SACL SAtL LALK SACL ZAC SACL SACL OOT LAR LAR lAC SACL LRI.J( LRLK 00 HHfHfHffHfffHfHffHHHfHHHfffHffHfHHffUHfffHHHfHff**f**ff IRPACTIVE RPACTIVE IKIII KIll IK21'11 K2MI SAtL LALK SACL LACK SACL LALK SACL LACK "vectors· MIN RS THE USER'S PROGRAM SIIlULD APPEAR HERE. , K/2-1 fHtHfffHUfHHHHffH+tfHIHfHtHHfUHfHftHffHffflff**fHfftHffH 0 V, , , , , , , , , , , , , , , , , , ffHHU+HunfHHfHfHHHfffHnHUUfH+HfffHffffffHUHUHfUfH* S. '" RSTAT, I USTAT, I *,1 INP,I MIlD,1 _,I RPARI,I XSTOP,I XPARI, I XPAR,I RDATA, I XPARTOO, I !DATA,1 T*,I TEIf', I RPACTlVE,1 KIII,1 K21t1,1 , INITIALIZE lIART PARAMETER VARIABlES IIiORILLEN WIlRD-LEN IODD ODD ITINTPER TlNTPER I TBE TlNTPER 2 3 OFFCSh INITIALIZE TIMER PERIOD , ENAIII.E TINT ONLY 4 RSTAT , RSTAT: • 0 USTAT , USTAT: • 0 USTAT. liARTPORT TWO, KMI , lIfT WAIT: • lIR XSITS_REG, WORD-LEN , INITIALIZE XBITS..REG MIlD , !IIORD' • 0 INP..PTR, 0200. , INITIALIZE DATA POINTERS DPT..PTR. 0200. HfffHfffHHfHfffffffHlfffffHffHffHfffffffHfffffffffHffHtfHffHffff WNFIGlIlE PARITY-RELATED CONSTANTS IJ,) fHfUfffffffHHfffffHffHUffHfffffflfffffflHfHff+tHffffHffHfHlffH* ...~ I PMINIT ZALS S4ICL S4ICL U¥:K S4ICL LIILJ( S4ICL LARI' LAR IIIIR LAC S4ICL LAC S4ICL LAC S4ICL BAIIZ SHIFX ~ :! LAC S4ICL ~ "6 ~ I INITIALIZE llIGGI.E I INITIALIZE STOP l1l\5I( l1l\5I( TO BIT 0 TO BIT 0 XONE 'XIERO 1+ XPMI,I XPMI XPMTOO,I I SHIFT llIGGI.E l1l\5I( BY N+ I BITS XPMTOO XSTOP,I XSTOP SHIFX I SHIFT STOP BIT STRIIil BY N + I BITS lSTOP,1 XSTOP I TOTAL • IF SHIFTS Fa! XSTOP • N + 2 I END UART INITIALIZIITION ~ ""! lONE ~I IlJTPUT NEXT BIT I TIlE- ClllfENSATION RXF B SXF : S4ICL LAR 00,1<111 I )lilT I BIT INTERVAl. IIEFOlE OOTPUTTIIil NEXT BIT LARI' BANI XBIT5..REG RCV I IF lAST BIT, SET TBE LACK S4ICL I TBE I SET TBE LAR XBIT5..REG, IQID-LfH CALL XftT XZERO TSIF I SIGNAl. ENIHF-tIIJID OO_ImR 1HIIIIIIIIIIIIIIIIIIIIIIIIHHfHHHHfHHtfHHftHHHHfHfHHHfIHfH 00 UART_INIT • RECEIVER HIHH......fHHMt.HHHttHftH.IHHHHHIHHIHHHfffIHHHHlHHH _ImR I HHlllllllllIlllllllIllHHtHlllllIllllIIllllHHHfHtHHHHIHtHtHfHf •XlIIT BZ TBE NOT.BI'TY ZIILS USTAT IIIIIK BZ TDA.JISI( ZIILS ElPTY ~ S· ZIILS So S4ICL 1\ ~ I IF TIIA = 0, 11£11 SKIP TO RECEIVER I TSIF' • TIlATA USTAT AJIl( TDA...ClJI WI USTAT USTAT, UARTPIIIT lIM: S4ICL TBE NOT-Bf'TY LARI' 00 ZIILS I Cl£AR TIIA AND TBE RIIEJIS1( CONT ZIILS RSTAT NOTSTART I IF )IImlll, SKIP TO RECEIVER I SKIP RECEIVE RMINE IF RII£ • 0 RETIRI I RSTAT • 0 III'I.IES )IImlil Fa! START BIT HHHHHHlllllIlllllllllllllllllHHlHfHHNHlHHHfHHlHHHlHltHl RSTAT = 0 HIHH.lHlHHfHfHHtHHttHfHHHHHHHHH•••• IIIIIIIIIII.IIIIHtHH I BIOI B I USTAT ANI»( 8HZ B 8HI TIlATA TSIF ZIILS ~ ~ CONT RCV S4ICL RCV I IF NOT ZEfilHI£N EII'TY I Oq 0 V, TSIF HtHHIIIIIIIIIIIIIIIIIIIIIIIHfMlIHf.fHHHIHu.HHlHfHHHfHtHHHf ~ ~ IIILS RIll II: NOP HffUHHHlHfHHfflltHHlfHfHf.HHfHlHflHlfHHHflHHHHfHfHHf ~ l' RCV I SHIFT PMITY BIT LOCATION BY N + I BITS 1IIIIIIIIIIIIIIIHHHHlHHHHfHfHHHHHIHHHHHHfHfHHHflfHlH gO ~ XPMI I XPMTOO OFFFFh XSTOP 0 0,1111 EIN! RET ~ ~ § - BANI OOD STARTBIT U¥:K S4ICL LAR STARTBIT I UJ(I( Fa! START BIT ON BIOI RETIRI I RSTAT RIIl,1C2II1 I lI'DATE RSTAT I )lilT 112 INIUD IHTERYAL AFTER START BIT 8 ~ ::s IETEtTiOl fIETIRI DAUfRO LT '6 ~ • 1f •1IIIIIIIIIIIIIIffHfHHlHHHlfHHHfIHHHfiH.HfHHIHHlHHfHHlfH S S- • RIll IEMli I IF I.i\ITING, fIETIRI ~ .ZAlS ~ X(R( , RSTAT =1 INDICATES START BIT IaIFICATIOI PENDING c" IINZ RSTAT 1 NGTVER t ~ ~ ~ ""i • "' • IAlS II1CHIINGE LAC , SHIFT INPUT BIT TO _lATE POSITIOI AND APPEND TO IIf'UT STRING IlIOlIl III' RPAR , NG PARITY C/iNlE IF SPACE , ·TOOOl£ PARITY-GEN BIT IF I1ARK I SIF,I , lI'IlATE SHIFT FACTIIl SAC/.. SHF LAR RlIG, KIt! I I.i\IT 1 BAUD INTERVAL· IIEFlIlE SNfLING r.EXT BIT LARP RBITS SKP3 ; ENJKIf-wRD !£TEeT 3 RSTAT , lI'IlATE RSTAT loi£ii fUU. 111m IS RECEIIIEII BllNZ , IF I~ID START BIT, START OVER BIOZ ZAC SACl 8 RSTAT IEMli LACK SACl 1 SIF , INITIALIZE BIT POSITIOI INDICATIIl LACK SACl 2 RSTAT ; lI'IlATE RSTAT ABITS, 1111 RIll, IOU , N BITS/CHARACTER , !/AIT 1 BAUD INTERVAl IlEFIIlE SNfLING DATA •VALIILSTART VlLllLSTART LACK SAC/.. SKP3 RETURN •NOTDATA IALS X(R( ~ ~ IINZ RSTAT 3 IiITPAR , RSTAT =3 III't.IES I.i\ITJNG Fill PARITY BIT HffHlfHHHffffffHlfffHfHfHfHfllfHHHHHHHHHffHHHffHf.HHH lAR .LAR (") ~ IETIRi NOTVER ZAlS XIR( lINZ RSTAT RSTAT • RSTAT 2 NOTDATA =2 lAC ; PRESET DATA TO IfRO 8101 III' DALlfRO LACK SACl 1 INP SAC/.. , SET DATA TO 1 IF I!ARI( lAC SACl BIOI LACK •PIERO UHHlfHfHlllllllllllllllllflHHffHtHHHHffflfHHlIHUHfHHHfHlf • =3 ffffHHfHfHfHfHHHHHfHfft*,flHfHflfHHffflHtHltHHHlfHffHHff IHUIHHfII.IIIIIIIIIII.llHHtHH+fHHHHIffHHfftHfHHfIHHHffHH • ~ RPAR lAlS 81 HHHlH*HHHHHHllllllllllllllllliHtflHHHftfHtHfHHtHHtIfHHH ~ .... X(R( SAC/.. III SAC/.. RSTAT • 1 ~ S- III' HHHHMtI-HHHfHHfHHMfHHffHHHHHHHHHHl+HfHMIt*,",,**,,"" S· OQ SIF -- PAC RSTAT 0 0 NGTSTART LARP BANI g' II'Y HHIIIIIIIIIIIIII.IIIIIIIIHHtIHHHHfHtHtHHHlHHHfHfHHftH*fHt SAC/.. ; PRfSET PARITY TO IfRO III' PIERO 1 III' , SAll'LE PARITY BIT , C1£CK AGAINST lllCALlHOIREATED PARITY IAlS IN' llll RPAR AND 81 RPACTIYE RtVPAR..(J( ;1_ , REPIIlT PARITY EAROR ZAlS USTAT IR( RPE_SET SACl ruT USTAT USTAT ,UARTI'II!T IF RECEIVE PARITY-cJ£CKING IS If:-ACTiYATED .- 00 END m:EIYER RCVPlIIUJ: LJIR RIIG,IIIU ; WAIT I IIAUD INTERWIL 0'1 ffHfHHHtHHfHfHtfHHlHfttHH.fftHHHfHHfHfHfIHHHHHHtffH. lJIIl( !WJ. 4 RSTAT TMIISItITTER DATA FEED R!lUTIIE RETI.IIII TI£ RLL(IIIIIG X"T/ReV R!lUTIIES III'lEIIENT A LOOPIW:K TEST, HHHfHHHHHHfHHHHH-IHHIIHIIIIIIIIIIIIIIIIIIIHHfHfHfHHHIH RSTAT • 4 XftT IHHfHHfHlIIIIIIIIIIIIIIIIIIIIIIIIIHHfIHft M1TPt1R BIOI 5111'0 ;J:. ;: ...... ~ 1b ~ ;: "' i:i §" •STOP-tIC • 6'/ERRIIII t"'" USTAT III( FIftIIl.5ET !WJ. M USTAT USTAT,I.IARTI'OfI ZALS USTAT -Bl USTAT III( RlILSET •MLIMRRtIi lALS !WJ. lAlS ~ III( ~ ""l !WJ. M ~ S· Oq lAC !WJ. !WJ. So ZALS !WJ. "' ~ ~ tv ~ 0 V, •RETURN tAU. EINT RET END XftT HHHHfHtlHHHtfHtHfHf+HHtHHlHfHHHflIIIIIIIJIIIIIIIIIIIII*HH RECEIVER DATA RECOVERY R!lUTIIE ; REPOIT FRAI1ING ERROR • litiS SET -- XftT IRCV IWTlIES IIIPLEI1ENTS A UO'BACK TEST. HlfHflfHHfHlHfHfHHfHHtHHfHfHftHHHHfHHflffHHHHHHtfH RECV , REPOIT OYEIR.IN CALL GET..IIATA tAU. tAU. RET XcatPOSE REFORI'AT PUT..IIATA TMIISItIT SAlE DATA GET m:E11'EII DATA HHfHfHfHHHHfHfHHHHtHHffHHHHHHHHHHHHHHHtHHffH4 USTAT USTAT,I.IARTI'OfI END ReV , CIFI DATA TD RDATA RDATA , SET RDA USTAT RIIILSET USTAT USTAT,I.IARTI'OfI RSTAT tF ; OYEIR.IN IETECT IIIJlIIERRlII !f4lS !WJ. M .Q, t.:l "'" ZALS RET HHHHHtfHfHHffHfHfHfHlHfHHfHHfHfHIIIIIIIIIIIII.llllllllllfH I 1NVll.ID STOP BIT STOP-tIC STII'O HffHHHffHfHHHHHHHHHHfHHlHHHHHHHtHHfMfHfHHfHHH HHfHfHfHfHHfHHfHf4fHHHHHHHHHHfIHIHHHHHfHfNHHHH _ITTER INTERFACE R!lUTIIE PUT-DATA Clf'IES T.PTR , CIf'Y DATA TOTIIATA TDATA _I RECV ZALS III( !WJ. M USTAT , SET AND REPOIT TDA TDA..SET USTAT USTAT,UARTPORT RET HHHffHHf+HHflHffHfHHfHHffHHHff.fHfHfHHIHHIHHfHHHlH ). ::s ~ l ~ S' §" ~ 1:0 V) .g, END I'UT-MTA RECEI~ ~ ~ o ...., INP_PTR • RDATA m m XPAR XSTW ADD START BIT ADD PARITY BIT ADD SW BITS HfHHffH+HHfffH·HHfffftHHfHtUtHfffffHt-fHHfUfHHHtfH*HtHff END XCO/IPOSE IALS ANDK ANDK SACL OUT USTAT , CLEAR RDA RDILClR OFFF8h ; CLEAR ERROR FLAGS USTAT USTAT, UARTPORT ffffHffHfffHffHfHffHHfHffHHHffHffHfHIHffffUftHfHHfffHfHf* RET HflHHfHfHffHHHnHHfHffUltHfHHHfHHfffffHHfHHffH*HtfHt* END GET_DATA fH-ftHHHfIHftHftHfHlfHtfl-tHHHttHfHUH*HIfHHfHHHHHH*4flf _ I T DATA COtIPOSE ROUTINE XCOtIPOSE ADDS START, STOP, AND PARITY BITS TO DATA POINTED AT BY AR(OPT..PTRI XCOIIPOSE ZALS SACL LARP XPARI XPAR COIfOSE TRAIISItIT IOlD INPUT IS l SPISIMO Pin 31.1 TALK :,.....O-....--K"::5I SPISOMI , Pin , I ___ -I MASTER/SLAVE 31.2 POLARITY SPICLK 30.6 Figure 7. TMS370COIO SPI Module The SPI module has a single 8-bit register used for both transmitting and receiving serial data. In this system, the serial data is clOCked into the SPISOMI pin and clocked out of the SPISIMO pin. The SPICLK is used for counting and timing the data. Because the TMS37OCOIO is the master processor, the SPICLK is used by the TMS320C17/E17 for timing transmission and reception of all data transfers. For more information on the TMS370COIO's SPI module, refer to Section 10 of the TMS370 Family Data Manual (literature number SPNS014). There is also an application report for serial communication entitled Using the TMS370 SPI and SCI Modules (literature number SPNAOO6). TMS320C17 and TMS370COIO Serial Interface 201 TMS320C17/E17/TMS370COIO Tr~mission/Reception Protocol The TMS32OC17/E17 and the TMS370C010 are connected by the seven wires shown in Table 1. Table I. Serial Intedace Connections TMS370C010 TMS320C17/E17 D3 D4 XF (DO@PA4) D5 D6 SPISCLK SPISIMO SPISOMI -EXINT BIO SCLK DR1 DX1 Name Function READY RTS_320 RTS_370 DATA EN CLOCK REC XMT READY line Request to send (TMS320C 17/E 17) Request to send (TMS370C010) Signals 320 - clk 9 sent Data clock Data receive line Data transmit line Sections 5.1 and 5.2 describe how the TMS32OC17/E17 and TMS37OCOlO communicate over the serial interface. A timing diagram is illustrated for both transmission and reception of data, and signal sequencing steps (data flow and handshaking) are outlined for each case. In each example, the TMS370C010 is assumed to be the master of the system. TMS370COIO Transmits Data to the TMS320C17/E17 T9 CLOCK FSR DATAJ:N ~~:_.......~_............;+-~_.......--'! . :. ---~--i-~-"';"'-+-~''-"';"'--:J1 .. Figure 8. Timing Diagram for TMS37OCOIO to TMS320CI71E17 Transmission The signal sequencing in Figure 8 is defined in the following steps: 1) The TMS370COlO interrupts the TMS32OC17/E17 by asserting RTS 370 low. 202 TMS320C17 and TMS370COIO Serial Interface 2) When acknowledged, the TMS320C17/E17 ensures that the serial port is set up appropriately for receiving data, sets the SCLK for input clock, and kills any transmissions pending or in progress (in agreement with the system's characteristics of the TMS370COlO being master). The TMS320Cl7 then signals the TMS370COlO that it is ready for reception by bringing its XF pin (READY) low, which, in turn, sets the TMS320C17 FSR low (via an external OR gate). This notifies the onboard serial logic that data is soon to follow. 3) The TMS370COI0 then transmits the 8 data bits. When the last bit is sent, the TMS370COlO sets the RTS 370 line high. 4) When the RTS 370 line goes high, the external OR gate asserts FSR high, causing a TMS320C 17/E17 interrupt. The FSR interrupt indicates that the 8 data bits have been clocked into the receive shift register RSO. This puts the TMS320C17/E17 into a polling routine, waiting for the BIO (DATA EN) to go high. 5) The TMS370COIO sends a ninth clock pulse to transfer the 8-bit value in the RSO register into the receive register, RRO. NOTE: This ninth clock pulse is required by the TMS32OCl7/El7 internal logic to transfer the contents of the RSO to RRO. If the clock were free running, this ninth clock pulse would simply be the next clock pulse. 6) The BIO (DATA EN) is brought high by the TMS37OCOIO to signify that the ninth clock pulse has been sent and that the data is ready to be read by the TMS320Cl7 IEI7. 7) The TMS320C17/E17 reads the data, stores it, and sets an internal software flag, indicating a new data word has been received. The TMS320C17/E17 then ends the transmission by setting the XF (READY) line high. It also clears the interrupt and enables the EXINT interrupt for the next byte. TMS320C17/E17 Transmits Data to the TMS370COIO Figure 9 shows a timing diagram for transmission of data from the TMS320Cl71 E17 to the TMS370COlO. TMS320C17 and TMS370COIO Serial Interface 203 T1 : T2 : T3 : T4 : :T7:TS: T9 CLOCK RTS_320 READY , " "......- _....._ _ _:..._ FSX ~---Jr ............_ _:.,.J/ '''''-';'u- ............- ...............t--......~'i-i- ...... .............-P---....~.....--i-_P--Jr: Figure 9. Timing Diagram for TMS320C17lE17 to TMS37OCOIO Transmission Signal Sequencing in Figure 9 is defined in the following steps: I) The TMS320C 17IE17 puts the 8-bit value to be transmitted into the serial transmission register TRI. 2) By sending a zero data value OUT to I/O port 4, the TMS32OCl7/El7 signals to the TMS370COlO that its serial port is configured and that data is ready to be transmitted. The TMS37OCOI0 sees this as a one-to-zero transition of the RTS...,320 line (TMS320C17/E17 request to send). 3) The TMS37OCOIO sets READY low via the external OR gate, causing FSX to go low. The FSX transition causes the transfer of the 8-\:>it value in the TRO register to the TSO register, starting the transmission. 4) When the eighth data bit is received from the TMS32OCI7/EI7, the TMS37OCOlO sets READY high, causing FSX to go high, which interrupts the TMS32OCl7IEI7. 5) When the FSX interrupt is received from the TMS37OCOIO, the TMS32OCl7/El7 transmission is assumed complete. The TMS320Cl7/El7 sends a one data value OUT to I/O port 4 (asserting data line DO high), clearing the RTS...,320 line. This restores the port to the initial state and makes it ready for the next RTS...,370 (TMS370COlO request to send). 6) The last operation performed is the transmission of a ninth clock pulse by the TMS370COIO. The ninth clock pulse is sent to reset the TMS32OCl7/El7 TRI register to set up the TMS320C17 logic for the next transmission. 204 TMS320C17 and TMS370COIO Serial Interface Interfacing the TMS320C17/Et7 to the TMS370 and CODEC Simultaneously To allow the TMS32OC17/E17 to communicate with a TMC29CI3, the SCLK pin must be switched, under software control, between the SPICLK on the TMS370COlO and the CLK pin on the TMC29C13. The additional external logic needed to do this is shown in Figure 10. The logic consists of two AND gates (112 - SN74HCOO) and three buffers (2/3 - SN74HCI25). TMS320C17 and TMS370C010 Seriallnterface 205 ~ r---------------------------------I !I I II DATA EN , m 10k " V~CC ~ 704HCt2& Vee i vfcc I I I I 10t ..... 30 r \"" VDO 'OV DIGITAL OIlOUOlD SW'~ RESET DSl2' . . 22 D3 23 . . 20 D,20 00 21 .. ~ I I I I I I I R2 'OkR3 ~ o tv ANAl DCUCRf!-, ANALOG OUT ~ ~ g~ I I I I I I 'I E. ~ I I III DIGITAL ANALOG OIIOUND ....UND V,.,-Sl ~ ~ ~ '"'"""" : ~DH20."~C2 jC1J..! i~~ I3 ~ U&A I I I I 74HC74 !In CUt':.t! ;;1' olQ PO I II L ______________ b Vee I _ _ _ _ _ _ _ _ ...J ~ ~ ~ ;;- 10 ........ Figure 10. Full System Schematic DIGITAl. ....... U1 _17 J This additional logic adds to the system cost, board space, and power requirements. To reduce this burden, a TmPAL16L8 can be used to absorb the AND, OR, buffer, and address decoder, reducing the system to the circuit shown in Figure 11. TMS320C17/E17 TMS370C010 XMI SPISOMI REC SPISIMO RTS-.370 05 OATA...eN 08 OX1 OR1 EXINT BIO TO ISET DO 16lS8 PAL PR 04 RTS_320 0,....QRTS Q CK< ~ 1/2·74HC74 03 SPISCLK REAOY SPIClK XF 3/1 PAO 4/1 PA1 511 17/0 PA2 8/1 WE 7/1 FSX 1010 FSR 211 15/0 SCLK 14/0 811 1/1 19/0 XF PAO PA1 PA2 WE FSi T FSR SClK 1010 ClK ":" PCMOUT ORO PCMIN FSX FSR OXO FR ~ TMC29C13 Figure 11. Serial Interface with CODEC This brings the system chip count down to the following five ICs: 1. TMS37OCOI0 - System microcontroller 2. TMS320C17/E17 - System digital signal processor (DSP) 3. TMC29C13 - CODEC (analog in and out) 4. 112 of an SN74HC74 - D flip-flop 5. TmPAL16L8-15 - 15 ns PAL TMS320C17 and TMS370COIO Serial Interface 207 Design Example .Ali attractive fe8;ture of the approach shown in Figure 11 is the ability to isolate the DSP and CODEC from the microcontroller. The host controller can thus be placed 2 to 5,yards from the DSP/CODEC and connected via seven wires (READY, RTS~20, RTS~70, DATA EN, CLOCK, REC, and XMT). Using line drivers and receivers, this distance can be increased substantially. An example of a system benefitting from the TMS370/TMS320 interface is a vibration monitoring device used to monitor an in-service automated numerical control milling machine (refer to Figure 12). In such a system, ,the DSP performs a 64-point real DFT, compating its results to ~ DFT mask taken when the cutting tool in the milling machine was new. Such data can be used to predict when the cutting tool will go out of specification. A siInilar system could apply to almost any machine containing bearings or producing vibration relating back to the machines performance; i.e., copiers, automobiles, steam or jet engines, etc. 208 TMS320C17 and TMS370COlO SerialInterface REAL TIME FFTMAP ORIGINAL OFT MAP 2 3 4 5 I 8 2 3 4 5 CUTTING TOOL I 8 SEVEN WIRE INTERFACE TO PC Vibration Sensor Contains: - - - - - I.. 1) TheDSP 2) The Analog to Digital Converter 3) The Interface logic (PAL and Flip Flop) 4) Une driver and Receiver The frequency responces of the milling operation or cutting operation is taken when the cutting tool is new (Original OFT map). This original response is compared to the frequency response for each follow-on cut. The difference between the two is used to determine if the cutting tool ne~ds to be changed before it produces bad product. Within the PC is an interface board that has the TMS370C010 on it. The TMS370 holds the original map in EEPRQM and compares it to each follow-on OFT map. Figure 12. Design Example TMS320C17 and TMS370COIO Serial Interface 209 Conclusion You can see that the TMS320 and TMS370, when paired together, provide a lowcost, high-performance DSP system ideally suited for adaptive DSP tasks requiring pattery back-up. The TMS320C17/E17, with its serial interface logic, connects with zeroglue logic to combo-CODECs and, with the addition of only a PAL and one flip-flop, can communicate with the TMS370's SPI interface. The TMS37OCOIO is shown to be a powerful 8-bit microcontroller with onboard EEPROM. In the event of a power failure, the data EEPROM, in conjunction with the SPI serial peripheral interface, can be used as a means of preserving the TMS32OC17/ElTs and TMS37OCOlO's data RAM and processor status. In addition, the TMS37OCOlO has the power and flexibility to read a keyboard, interface to a display, and/or communicate with a serial communication device (SCI/UART interface). Note that the Texas Instruments integrated circuits presented in this application report are offered in two surface-mount packages, thus giving a small-end system form factor. Source Code Examples Source code examples are presented for both the TMS320 and TMS370 transmit . and receive routines. The TMS370COlO code in Appendix A presents SPI initialization source modules, plus transmit and receive 8-bit values for the TMS320C 17IE17. As noted. earlier, the TMS370COlO is assumed to be the master while the TMS320C17/E17 is the slave. In the TMS320C17/E17 source code examples (Appendix B), the header presents a full narrative description, which closely follows the narrative presented within this report. Both the TMS320 and TMS370 source code examples are written in modular fashion so you can choose what you want to include to meet your unique system· needs. Appendix ,C gives the reduced equations and chip diagram for a PAL example. 210 TMS320C17 and TMS370COIO Serial Interface ~ ~ ~ o l • Pig. .titl. 1IIIIIIIIIIIIIIIIIIIUHftHHfHIHHHHIHHHfHUIIIIJllllllllnHfUHH 'TIIS37OCI7lT~OXX COIfUjlCATlIJI SlFTIIAR£' II'P£IIIIl A - TftS32OCI7IE17 SOURCE CODE EXAIIPLE • text 1HHHIfH111111111111111111 •• IIHHHHHfIHfHHHHtHffHHHfflHHHH ClPYRIGHT Ie) 1988, TEXAS INSTRliIIEIITS li'I:!JRP(JlATED, AU. RIGHTS REl3ER'IEIl 'I IUlllllllllllllllllllllllllllllllllllllllllllfHHHfHfHHfHofIffltHHHH • SI0370 , IIRAII.:H TO PROCESSOR RESET HfHftfHHtHfHHHHHfHtHHffHHHHfHfHHffllllllllll.IIIIII •• 1111 SI0370 INTERRUPT HANDlER ~ TlIIS SIFlI/IIRE 0006TRATES TIE USE IF TIE TIIS32OtI7 SERIAL INTEI1fACE TO aIIUIlCATE WITH A TilS370c010 CHIP, TIE T~OC010 IS ASSIJIED TO lIE, TIE IfI1STER IF TIE SYSTEII. TlIE INTERRUPT ENABlE BITS ARE AND'EO WITH TI£ INTERRUPT FU¥l BITS TO lIETERIlltE hlilCH INTERAlIPT TO SERVICE. c::::. THIS 0006TRATlIJI IS ACCOIIPLISI£D BY SIIf'LY ECHOIIil TO TIE IllAlEVER IS RECEI~, TIE SCENARIO IS AS FlUJIiS' ~ ~ g s·~ :;~ i-!;l HHHffHffHHHfHHHHtHffHHHfHfHHHfIII.'.II.IIIII'I.IHflfHlHf T~OC010 I. TIE TllS37OC010 INTERRlI'TS TI£ TIIS32OC17, INDICATlt«l A TIIS370c0I0 REllEST TO SEIIll. 2. TIE TIIS32Otl7 ENSUIES THAl TIE SERIAL POll IS Af'PR(fRIATELY SET II' FOR TIE TRANSIIISSIIJI, Will! EXTERNAL SCIJ( AND FRAIUt«l. TIE TftS32OCI7 TI£N SI6IIIFIES IT IS READY FOR TIE RECEPTlIJI BY BRIt«lIMl TIE IF PIN LOW. IT ALSO Klu.s ANY TRANSIIISSIIJiS PENlIINl III IN ~ TO 11£ TilS370c0IO, IN AIlIIEE/EHT WITH TIE SYSTEN'S CHMACTERISlIC IF TIE TItS37OCOIO BEINl MSTER, 5. WI£N TIE FSX (Ill TllS37OCOIO RTS) INTERAlIPTS ARE RECEI~, TI£ TRANSMISSION IS ASSlIEII COFI.ETE, TIE TIIS32OC17 SENDS A I (lIT TO I/O POll 4, CWRIIIG TIE TIIS32OCl1 REllEST 10 SEND, AND RESTOlES TIE POlT TO TIE INITIIIl STATE, READY FlII TIE tEXT TIIS37OCOIO RTS• I'-) code SST SAVEST LDf'I( PAGEl SAC!.. SAYEAL SoWEAH ARO,SAYARO SACH SAl! SAl! 3. TIE TIIS32OCl7 RECEI'IES All FSR INTEIIRIPT INDICATlNl THAl TIE lII\lA lfAS IIEEN CI.OCKEO INTO TIE RECEIIJE SlfIFT IEGISTER. A NINTlI SCIJ( IS TI£N SENT FRIll TIE 11lS37OCOIO TO TRANSFER TIE DATA FRIll TIE SlfIFT IEGISlER TO TIE E£IIJE I£l1ISTER, AND TIlE BID PIN IS IIfrulHT HIGH TO SIGNIFY THAT TIE DATA IS READY. TIE TIIS32OC17 R£ADS TIE DATA, STOlES IT, lIND SETS A FU¥l INDICATl,., THAT A tEN DATA I/ORO HAS IIEEN RECEIVED. TIE TIIS32OCI7 TI£M ClEARS TIE INTERAlIPT AND EIWIl£S TIE tEXT TllS370c0I0 RTS INTERAlIPT. 4, TIE DIllY APPliCATION PW.S TIE DATA FU¥l·AND RESPONDS TO ITS BEINl SET, IT TI£M ENSUIES THAT TIlE SERIAL POll IS SET II' FlII TRANSIIISSIIJI lIND SEIIIS TIE IMIA (lIT TO TIE SERIAL lRAIISIIISSION IEGISTER. IT SI!IiALS THAT TIE CONFIIlIIATlIJI AND IMTA AI£ READY BY PERFlIIItIIlG All 001 11ISTRUCT11iI (A ZEROI TO 110 POll 4, hlilCH IS SEEN BY TI£ TIIS37OCOI0 AS A TIIS32OCl1 REllEST TO SEND, FINIILl.Y, IT ENAIIlES B01H TIlE FSX AND TIIS37OC010 RTS INTERRlI'TS. .sect , SAVE AUXILIARY IEGISTERS ARl,SAYARI IN SCRACH, anGO , READ IN INTERAlIPT FU¥lS LAC III SCRACH,I2 , !lET INTEllRlPTS EIIAIIlED SCRACH SCRACH SCRACH SCRACH , , , , lJICI( 4 , CI£D( FlII AND SCRACH , CI£D( FlII lII\TA , CI£D( FlII :J7O RTS SACH AND SAC!.. .. SAVE STATUS _PAGEl SAVE ACruWIlOl BIll RSPSNT lJICI( AND 2 SCRACH BIll lII\TREC lJICI( I AND SCRACH RTSREC lINZ III IN IIITERRUPT FU¥lS SAVE EIIAIIlED BITS _ FU¥lS WITH ENAIIlE BITS AND SAVE RESIl.T RESf(JISE SENT RECEI~ NO VALID INTERAlIPT, RE-INITlIllIIE INTERRlI'TS •11111111111111111111... 1111111111111111111.111111111111111111111111111111111. lJICI( 08Eh SAC!.. SCRACH I SCIJ( IN, NO alEC IXIlINl, , IF HIIJt, EXTERNAL FRIIIt[IIG, SERIIIl POll 1 > i ~. > N ..... N OIFh SCRACH,B SCRACH , EJWII.£ 1lIS370c010 RTS INTERRlPT, , ClEAR Ill. INTERRIJPTS SNl. B INTRET I IEFAlU TO RETIJ!II lACK ADD LlJP1( lACK SNl. lACK ADD SNl. TIE TltS37OC010 IllS ISSUED A REQI£ST TO SEND. EIISlIIE THAT HE seRiAl PmT IS aN'11llm COIIIEtTI.Y, KIll. ANY PENDIIIl TRflIISIIISSIOllS IX! 11tS32OC17 REQI£STS TO SEND, AND t«lTlFY TIE 1lIS370c010 OF READlt£SS BY 5 ;:s I:>.. ; IIRAN:H TO RETIJ!II lACK BI ~ ei tv IN, t«l roIEC COOIIll, IF HIGH, EXTEIINAL FIWIIIIl EJWII.£ TftS370c010 RTS INTERRlI'T, ClEAR FSR INTERRIYr ST(I£ I£W aN'IGllIATlIII 5ClJ( HHHHtHHfHHHHHIIII.I' •• I.,UI'U •• ,IUII.II'.II".If.IIII',IIHHfH 1IIIIIUIUIIIIIIIIIUU".IIIIIIIIIUIIIIIIIIIII.llllfHfHfIIIlUUIIIIIIUI NOFSX I£W aN'IGllIATlOII IN PIllE I INTRET INTEMUPT I - 1lIS370c010 REQl£ST TO SEND RECEIVED RTSREC PAGEl 08Eh SCRACH 012h SCRACH,B SCRACH OOT LST EINT RET SAVEAA SAYEAl SCRACH, CIFRGO SAVEST ; RESTORE ACClIIJl.ATIX! OOTPUT I£W CilNFIGllIATlIII RESTIXlE STATUS INTERRlJPTS RETIJ!II "**tHf"*IIIIIIIII •••••• III •• IIHHfffHHHHfIfffHlH-HtHHfIHHfHlIH RESET PROCESSOR AND Fill. _ TO APPLICATION HffHlIHflffffHHIfHHllHflHtlHIHfffllffHHHHfftHHtffHHftHttH IN IN lACK SACl OATFLG , RECEIVE REGISTER FR()I &COO •510370 lAC LARP LARK ACCUIIULATOR ARO ARO,Om SfLECT ARQ INITIAlIZE AODRESS/COONT ~ ~ lAC!( CI.RItEII S4ICl. BANI N C (") UIPK ...... I.JICI( 'I S4ICl. I:> ;:s o,O,ARO CI.RItEII PlIGEI I (1£1 ; llllJ' TO CLEAR !WI 1:1. UIPK ~ SACl PlIGEO (1£ ,ANDONEINPAGEO ~ OUT ONE,RTS320 ; CLEAR 1lIS32OC17 RElII£ST TO SEND I.JICI( 9...... SACl OEIfh TEll' ; IF HIGf, ElTEAoIA1. FRAIIIIIl, C I.JICI( 0Fh ~ .... ADD TEIIP,8 TEIIP TEII',CIFRGO t:! SACl OUT e: S I.JICI( 1\ SACl ~ I:> I.JICI( ADD I"l II> SACl OUT I.JICI( SACl ; SClJ( <.ADD SACl OUT OIFh TEIIP,8 TEll' TEII',CIFRGO EINT DATlN, SERiAl DATlN, SERiAl ; SEND DATA OUT TWICE TO GET ; TO SECII1D _ I T REGISTER OUT ZERO,RTS320 ; ASSERT ACTIVE UJI 1lIS32OC17 RTS APPLIC ; lID' INIERRlI'TS, CLEAR FSX INTERRII'T BAa( TO III'I'lIC IN, III COlEC CODIIIl, top , INITIAlIZE POOT I TO ocm bott.. I•• gth .BSS .BSS .BSS .BSS ,BSS ,ElIl .BSS * • RESIlE .BSS IN, III COlEC CODIIIl, XF HIGf, EXTEAoIA1. FRAIIIIIl, SERIAlP!RT I ENAIILE 370 RTS INTERRUPT, CLEAR IU INlEIiRIJ'TS ONE,I I aJlSTANT 1*16 ZERO,I ; COISTANT 0*16 TEl'IP,I ; SCRATCH lOCATiONtl6 DATlN,I ; DATA IN F1DI SERiAl P!RT016 ; FlAG SET FDR DATA 1EE11'ED*16 DATFlG,I bott..-top SPACE,8Oh-II ••gth+1J;.bss POINTER TO TOP IE PAGE (1£ SECTlII1 AT DATA IEDY AIIMESS 080h TOP IE PAGE IIIE ; SClJ( ; ; I.JICI( OUT OUT SClJ( ENAIILE FSX IVF ilIS37OCOIO RTS ; LI'PER CONTRCl. REGISTER ; DlSAIIlf IU INTERRUPTS, ; CLEAR IU INTElRJPTS OCh TEll' CfEh TEII',8 TEll' TEll',ClFRGI OSEh TEll' ADD SACl OUT lAC!( , INITIAlIZE (1£1 IN PlIGEI IN, III CODEC CODIIIl, IF HIGf, ElTEAoIA1. FRAIIIIIl OSEh TEl'IP 054h TEl'IP,8 TEl'IP TEII',CNFRGO SACl ; ; .BSS .BSS .BSS .BSS .BSS .BSS .BSS .IIIEI,I SAI'EAl,I _,I SAVARO,I SAYARl,I SAYEST,I SCRACH,I ; ; ; ; I ; ; INTERRII'T INTERRUPT INTERRUPT INTERRUPT INTERRUPT INTERRII'T INTERRUPT aJlSTANT 1016 UJI ACWILATOR*I6 HlGf ACWILATORol6 _16 ARlol6 STATUSlI6 SCRATCH lOCATlONtl6 ; INIERRlI'TS HHflt.IIIII ..... IIIII .... IIII.,IIIIIIIII •• IIIIIIIIHffHlHHHHHHIHIffH • 110 PORTS III'I'lIC - JUII'I III'I'lltATllI1l11lYER HHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII ... IIIIIII •• IIII111111111111 THIS IWTIIE PW.S TI£ DATA FlAG lDATFlG) TO DETERlIIE lIIAT TI£ NEW DATA HAS IIEI1 IEEII'ED All) lEEDS TO BE IETIRO TO TI£ DlS370c0IO. -• •III'I'lIC .... t-.) ~ lAC BZ DATFlG III'I'lIC 1K. SIICL ; lID' OOll DATFlG SET I DATFlG DATFlG CNFRGO CNFIIGI SERIAl RTS320 .SET •SET .SET ,SET ; I ; ; COFllUlATlII1 REGISTER 0 COFllUlATlII1 REGISTER I SERiAl 110 P!RT 1lIS32OC17 REIIEST TO SEND PORT I I ~ i 214 I ~~ ~ Ii<' .Ii. TMS320C17 and TMS370C010 Serial Interface ~ ti B HHHHtHIHHHHHfHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII.IIIIIIIIIIII APPEIIIIX B - TJtS37Oa)IO SOR:E COIlE EXAIRE 'I TI£ FOlLOIIING SOR:E COlE IS ~ ti C:! Q SPlctR SPICTL SPIBIF SPIDAT SPIPCI SPIPC2 SPIPRI .tqu .tqu •• qa P02E POlF POI7 .tqu s· ;;- - .Iqu OIH 02H 04H 08H lOti 20H .;t, I:> 81T6 ••qu ,'4V 40H SOH ••qa .equ .eqa •• qu BIT7 NBITO NBIT! NBIT2 NBIT3 NBIT4 NBITS NBIT6 NBIT7 ••qu .'ClU OFEH .equ .equ 0f8H ; BlUATES FDR BIT TEST All) SET WITH DR .equ .equ POlO P03I P037 ••qa P039 P03D P03E .equ P03f .equ 07FH .equ R4 ; BlUATES TO ClEAR A BIT WITH AND 51'1 INITIM.IZATlOII .bS5 IlUFFER,4 POINTERI,I POINTER2,1 Q. ~;::'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII .......t VARIABLE ASSIGlllENTS IN BSS SECTION .bss f_. •text lIlY DR I8Oh,SPIctR IOOlIIlIIb,SPICCR lIlY 1OOOOOI000, SPICTL lIlY lIlY lIlY IOOOOOOlIb,SPIPCI IOOIIOOIOb, SPIPC2 1OI0000000,SPIPRI All) "IT7,SPlctR HHHfIHllfHfHHIIIII •• IIIIIIIIIIIIIIIIIII.IIIIIIIHHHHlfHfIHHHHH .bss ; DATA REGISTER TO SEND DATA TO TI£ , TIIS320 0f7H .equ .equ 11I1111111111.IIIIIIIIIIIIIIIIHfHHt+tlfIIIIIIIIIIIIIIII"111111IfHfffHfH DATA OfDH OEFH OIFH OIFH .tqu ••qu ; BUS ; 110 f'(RT OR EXPANSION CIJITR(I. BUS ; 110 If(RT DIRECTION ; EXTERNAL INTEIIRWT A CIlITR!l. ; REGISTER ; SPI CClFIOOIIATION mlTROL REGISTER ; SPI IFERATlOII CIJITR(I. REGISTER ; RECEIVE DATA IIIFFER REGISTER , SERIM. DATA REGISTER ; SPI PIN CIJITR(I. I ;SPIPINCIJITR(I.2 ; 51'1 PRIDRITY CIJITR(I. RAIl BlUATES BlTO BIT! BIT2 BIT3 BIT4 BIT5 ~ INTD FWI RWTIIES' • list ..... ~ IIR(J(EN SPI IIXlllE INlTlM.IZATION ROOTlIE (CIIU. AS SPINITl DIGITM. 110 PII/T INITIM.IZATlOII RWTIIE (CIIU. AS DINITl SEND DATA TO TI£ TIIS32OC17 RWTIIE (CIIU. AS TID) RECEIVE DATA FRO! TI£ TIIS32OCI7 RWTIIE ICIIU. AS RID) !:l.. ~ .tqu .tqu fHHfHHHIIHHHHfIIHItHHHfHIIUI .. 11I1111I1111111I11111111I11I11111 § c DllATA DDIR INTI IElIIIY STalAIlf: FOR PASSED YALlE DATA POINTER OlE DATA POINTER TWO fHfHHHfHHfHfHHtHHHIIIIIIIIIIIIIIIIHlHHfHffHfII .. I .. IIIIIIIII. ; ; ; , , , ; ; ; , I RESET 51'1 SET BIT RATE TO IlXINlI048, SET FOR 8 DATA BITS, .SET SPI a.oac PIlARITV FOR INACTIVE lOll, All) ClEAR SIN RESET SET AS IIASTER, NO TlIANSIIISSIOll FOR NOW, AND DISAILE 51'1 IIITElIIU'TS SET 51'1 a.oac PIN AS 00Tl'UT a.oac SET DATA LIlES AS 51'1 Slltl AND SIIII ClEAR 51'1 STEST BIT, SET 51'1 INTERRIPTS TO LE'IEL 2, DISAILE ; BIlATDR SUIJ'SID BIT I ClEAR S/W RESET BIT TO LOCK IN 51'1 I COf'IGlIIATlIfI PERIMRM. ASSIIlt'ENTS DIGITM. I'OIT INlTlALIZATlIII N VI •IfORTl ".tGU POll: DPORT2 ,'QU POW M.TERNATE EXPANSION IIlIE SElECT FOR CIIITR!l.BUS EXPANSION IIlIE SELEtT FOR CIlNTR!l. :.111111111111111111111111111111111111111.,11111111 I!NIT 111111111111111....... _ lIlY 1OOOOOOOOb,lf(RTi I SET PDRT8 SELECTI AND SELECT2 BITS ~ = N rtO\I 0'1 .11IlV IOOOOOOOOb, 1l'ORT2 toll00100b,DDIR ; TO DIGITAl( 1/0 FLN;TI(IN ; SET PUlTD AS FIllIlllS; ; DJ = READY (WTPUn ; D4 = RTS 320 !INPUT! ;OS = RTS 370 (OUTPUT! ;06 = DATA EN (OUTPUT) ;D7' OS = LNDEFINED (INPUTS) RID (Jl IBITI,DIlATA (Jl IlIITI,DDIR All) IIIBITI,DIlATA rtO\I ''1OOOh,SPlDAT '**fHHHflHHHfHHHHffHfffIHffHfHfHHHHHtfHH+HHHHHHHff RlDI SEND DATA TO THE TI!S32OC17 ROUTINE fffHHffHffH***HfHfH+HHHHHfHH-tHHHfHH.ftu4HfHHHHHHHH •TXD TXDI ~ tlN <:;) f) TXD2 TXDJ ...... '-l ~ ;:, 1:1.. ~ ~ •TlD4 ~ 9 ...... <:;) JIf' AIID TlO6 IIIIBITO,DDATA BTJO AIID rtO\I BTJl rtO\I IBIT1,DIlATA,TXD2 1IIIBlT3,DIlATA DATA,SPlDAT IBIT6,SPICTL, TIDJ SPlBUF,A (Jl IBITO,DDATA rtO\I toOh,SPlDAT BTJZ IBIT6,SPICTL, TXD4 (Jl 1BlT3,DIlATA BTJZ IBm,DDATA, TlD5 SPlBUF,A rtO\I ~ E' ; ; ; ; ZERO A REGISTER a.EAR THE DATA BUFFER F(Jl EACH TRAIISIIIT TllS370 DATA TO THE TItS320C 17 ; 32 TO A REGISTER ; INITIALIZE POINTER 1 All) POINTER 2 ; TO TI£ Ttl' OF TI£ DATA POINTER ; CHECK TO SEE IF A TI!S32OC17 ; _ISSI1ll IS IN PROGRESS, IF SO ; GIl AIID RECEIVE DATA FIIOl TI£ ; TItS32OC17 ; PIll THE TllS370c0I0 RTS LINE LOW TO ; START A TllS370c0I0 _ I T CYa.E ; WAIT Fill READY LINE TO GIl LOW ; SET TI£ DATA EHAIILE LIIIE LOW ; SEND DATA TO TllS320 ; WAIT Fill _ISSI1ll TO CIlII'LETE ; READ TI£ SPIBUF REGISTER TO a.EAR ; 51'1 INTERIU'T FLAG ; SET 370 RTS LINE HIGH TO END THIS ;_ISSI1ll ; ALLOW EXTRA a.OCKS TO LATCH DATA ; INTO TI£ TI1S32O ; WAIT Fill EXTRA a.OCKS TRAIISItlSSl1ll I TO END ; SET TI£ DATA EHAIILE LINE HIGH TO ; SIGNAl. THAT EXTRA a.OCKS HAlE BEEN ; SENT TlOS iJ> ... BTJO toO,A A,BUFFER A,BUFFER-l A,BUFFER-2 A,BUFFER-3 I32,A A,POINTERI A,POINIER2 B1T2,DDATA, TXDI rtO\I lIlY rtO\I rtO\I rtO\I rtO\I rtO\I rtO\I TXD6 AIID RT! 1NBlT7, INTI ; ; ; ; ; WAIT F(Jl REAllY LllIE TO GIl HIIJI READ TI£ SPIBUF REGISTER TO a.EAR 51'1 INTERIU'T FLAG a.EAR INTI FLAG RETUiM FIIOl INTERIU'T SERYIIl: i1' ~ ~ ~ (') ~ RECEIYE DATA FIIOl TI£ TItS32OC17 ROUTINE RXD2 • RID3 RlD4 BTJZ (Jl IBlT6,SPICTL,RlDI IBITI,DDATA rtO\I SPlBUF,A BTJZ IBlT2,DDATA,RID2 rtO\I toOOh,SPlDAT BTJl rtO\I IBLT6,SPICTL,RXD3 SPlBUF,B AIID RTS IIIBIT3,DDIR .end ; PRESET Bl LINE HIGH F(Jl TllS320 ;_ISSI1ll ; CHANGE 81 TO All 0UlPIIT READY LINE ; FIIOl TI£ TIIS37OCOlo ; SET TI£ READY LINE LOW TO ENABLE TI£ ; _ISSI1ll a.OCK (SPICUO ; LDAD WITH _ DATA INlTlATE SPICLK ; TO RECEllE DATA FIIOl TI£ TItS32OC17 ; WAIT f(Jl _ISSI1ll TO CIlII'LETE ; SET TI£ READ'! LINE HIGH TO INDICATE ; TlfIT TI£ DATA If\S BEEN RECEllIED ; READ TI£ _ITIED DATA AIID a.EAR ; TI£ 51'1 INTERRlI'T FLAG ; WAITF(Jl TI£ RTS TItS32OC17 LINE TO ; GIl HIGH TO INDICATE TI£ END OF THIS ; _ISSI1ll C'fa.E ; LDAD WITH _DATA AGAIN TO SEND ; -talE £LOCKS TO a.EAR TI£ TItS32OC17 ; _ I T BUFFER ; IlAIT- f(Jl EITRA a.OCKS TO lIE SENT ; _ READ TO a.EAR 51'1 INTERIM'T ; FLAG ; CHANGE D3 READY LINE TO IIH INPUT ; RETlJIN FRO! SUBROUTINE Appendix C. PAL Reduced Equations and Chip Diagram Reduced Equations For Device U4 SClK_O = ! ( !SPICLK); enab I e SCl..IUl = (! TEMP) ; elK = !(!SClIU); enable CLK = (TEMP); Q_RTS_320 = ! (PAO " PAl " !PA2 " ! WE); FSX = ! ( ! READY 10 !RT5..320) ; FSR = ! (!RTS_370 " !XF); READY = ! (! XFI; enable READY = (!RTS_370); TEl'IP = I (!READY # !XF); Chip aiagru for Device U4 Plbl.8 ------\ /-----20 Vee RTS_370 : 2 19 SCLK_O XF : 3 18 CLK PAO : 4 17 Q_RTS_320 PAl: 5 16 FSX PA2 : I> 15 • FSR SPICLK : WE: 7 14 READY SCLK-I : a 13 TEl'IP RTS_320 : 9 12 GND : 10 11 ---------------- TMS320C17 and TMS370C010 Serial Interface 217 218 TMS320C17 and TMS370COIOSerial Interface Part III. Data Communications 9. Theory and Implementation of a Splitband Modem Using the TMS320lO (George Troullinos, Peter Ehlig, Raj Chirayil, Jon Bradley, and Domingo Garcia) lO. Implementation of an FSK Modem Using the TMS32OCI7 (Phil Evans and AI Lovrich) 11. An All-Digital Automatic Gain Control (AI Lovrich and Raj Chirayil) 219 220 Theory an Implementation ofa Splitband Modem Using the TMS32010 George Troullinos Peter Ehlig Raj Chirayil Jon Bradley Domingo Garcia Digital Signal Processor Products - Semiconductor Group Texas Instruments 221 222 Theory and Implementation of a Splitband Modem Using the TMS32010 Introduction With the predominant usage of computers and especially PCs, data communications are of increasing importance. Communication between the various computer systems and terminals is frequently accomplished by means of the Public Switched Telephone Network (PSTN). The essential element for this data communication is the modem, which interfaces computer systems and terminals with the telephone network. In the past, modems have been traditionally implemented in the analog domain using discrete components. Recently, modem manufacturers have realized the flexibility and high performance offered by digital approaches. With the drastic reduction in the cost of digital signal processors, the power of Digital Signal Processing (DSP) becomes available for the implementation of medium-speed and high-speed modems. This application report discusses the digital implementation of a modem using the TMS32010 Digital Signal Processor. Attention is focused on splitband modems, a class of modems that splits the bandwidth of the communications channel (telephone network) so that full-duplex operation can occur. The splitband technique is mainly used for implementing modems with data rates up to 2400 bps (bits per second). This report describes the theory and implementation of the Bell 2I2A/V.22 Recommendation, a 1200-bps splitband modem. Note that in the remainder of this report, the designations Bell 2I2A and V.22 are used synonymously to refer to the modem implemented. This report is not intended to provide a commercial product, but to introduce the implementation considerations and merits of digital signal processing-based approaches. Some of the protocol requirements for the Bell 2I2A/V .22 Recommendation are not implemented: the answer mode, the 300-bps Frequency Shift Keying (FSK) modem, and the notch filter required to reject the guard tone from the received signal. Modems are sophisticated devices consisting of many functional blocks that must be correctly implemented. The interface of the functional blocks must also be appropriately adjusted for the overall structure to function properly. The different functional blocks can be implemented in many ways. For example, the receiver input bandpass filters can be recursive or. nonrecursive, and different algorithms can be used for the carrier recovery and clock recovery. In addition to the possibility of implementing different algorithms, new algorithms may need to be added to the already existing structure, such as an adaptive equalizer or a second loop within the carrier recovery for the suppression of carrier-phase jitter. These considerations indicate the advantage of the microprocessor-based over the analog-based approach. Using the microprocessor approach, the designer can test different algorithms by simply modifying the software. Additional functional blocks can be included by simply adding new code. Therefore, high-performance modems can be implemented in a very short period of time. Theory and Implementation of a Splitband Modem Using the TMS32010 223 The computational burden. for digital modem implementation is very heavy. This implies the need of special features for the microprocessor to be used. The TMS3201O, with its 200-ns cycle time, ori~chip multiplier, and specialized instruction set is uniquely architected for digital signal processing. Because of this, the TMS32010 can implement the modem functional blocks using only a portion of its available processing power. Another major advantage of the microprocessor approach is the possibility of implementing variable-rate modems using the same hardware. Specifically, the' same hardware used for'the implementation of the Bell 212A/V.22 Recommendation can be used to implement 2400-bps splitband modems (CCITT V.22 bis Recommendation) by merely changing the software. Besides implementing various modems using the same hardware, additional functions can be included, such as speech store-and-forward and the Data Encryption Standard (DES)l for secure data communications. This,report is organized as follows: The first section, Modem Functional Blocks, is a description of the functional blocks required for implementation of the Bell 212A/V .22 Recommendation. The second section, Modem Hardware Description, is a brief discussion of the hardware used for the modem implementation. The functions implemented within the TMS32010 are described in detail in the third section, while the fourth section contains an overview of the functions implemented in the modem controller (the Texas Instruments TMS7742 microcomputer). The performance of the TMS3201O-based modem is presented in the fifth section. Finally, the last section suggests alternative hardware configurations that can result in reduced system cost. The prerequisites for understanding and gaining maximum benefit from this report are the level of a Bachelor's degree in Electrical Engineering and a basic understanding of Digital Signal Processing and Data Communications. Background material can be found in Digital Signal Processing (Chapters 1 through 7) by A. V. Oppenheim and R. W. Schafer; , 'Implementation of FIR/IIR Filters with the TMS320 10/TMS32020, " an application report in the book, Digital Signal Processing Applications with the TMS320 Family, offered by Texas Instruments; and in Understanding Communications Systems and Understanding Data Communications, books published by Texas Instruments. Modem Functional Blocks A modem (MOdulator-DEModulator) is a device that modulates the baseband information at the transmitter, and demodulates the received signal to retrieve the baseband information at the receiver. The Bell 212A is a full-duplex modem with the receiver and transmitter sharing the available bandwidth of the communications channel. This type of modem is said to operate in either the originate or answer mode (see Figure 1). In the originate mode, it initiates the communication process, transmits with a carrier frequency of 1200 Hz, and receives at the frequency of 2400 Hz. At the. other end of the communications channel is a modem that operates in the answer mode, i.e., receives at 1200 Hz and transmits at 2400 Hz. 224 Theory and Implementation of a Splitband Modem Using the TMS32010 DATA TERMINAL EQUIPMENT (DTE) 2400 Hz ANSWER MODEM ORIGINATE MODEM 1200 Hz DATA TERMINAL EQUIPMENT (DTE) Figure 1. Originate/Answer Configuration Table 1 shows the different functional blocks that comprize the modem transmitter and receiver. Table 1. Modem Functional Blocks Modem Transmitter Guard Tone Generator Scrambler Encoder Digital Lowpass Filters Originate Mode Modulator Answer Mode Modulator Modem Receiver Notch Filter Originate Mode Bandpass Filters Answer Mode Bandpass Filters Automatic Gain Control Demodulator Decision Block Decoder Descrambler Clock Recovery Carrier Recovery Implemented No Yes Yes Yes Yes No Implemented No Yes No Yes Yes Yes Yes Yes Yes Yes In the following two subsections, the operation of the modem transmitter and receiver are described. The transmitter accepts data (bits) from the Data Terminal Equipment (DTE). The DTE may be a dumb terminal, a PC, or a mainframe computer. The modem transmitter then performs the necessary processing to place this data in the proper form for transmission through the Public Switched Telephone Network. This processing basically consists of the modulation of the baseband information (logical ones and zeros (bits) sent by the DTE) into the passband of the communications channel for transmission. The receiver collects the information from the telephone network and transforms it back to its original form, i.e., the bits sent by the DTE. Theory and Implementation of a Splitband Modem Using the TMS32010 225 Modem Transmitter The Bell 212A/v.22 is a 1200-bps modem that uses the Differential Phase Shift Keying (DPSK) modulation technique to transmit data through the communications channel. In the first part of this subsection, the equationthat describes the operation of Differential Phase Shift Keying modulation systems is derived from an intuitive approach. A rigorous derivation is given in Appendix A. The rest of this subsection discusses the functional blocks required to correctly implement this equation. In Differential Phase Shift Keying, the information is encoded as the phase change of the transmitter carrier. With q,(n) denoting the phase that contains the information to be transmitted, the transmitted signal s(n) is represented mathematically by s(n) = A cos(wn + q,(n» (1) where w is the carrier frequency. The parameter A determines the amplitude of the transmitted signal. Use of the trigonometric identity cos(X + Y) == cos(X) cos(Y) - sin (X) sin(Y) gives s(n) = A {cos(wn) cos[q,(n)] sin(wn) sin[q,(n)]} (2) The substitution of I(n) A cos[q,(n)] Q(n) - A sin[q,(n)l into (2) results in (3) used to describe DPSK modulation systems. s(n) = I(n) cos(wn) + Q(n) sin(wn) (3) From (3) it can be seen that the transmission of the baseband sequence {I(n),Q(n)} is accomplished by using two separate modulation carriers, a sine wave and a cosine wave. These waves are orthogonal; Le., the information in the direction of the one wave (cosine) is independent of the information in the direction of the other wave (sine), and therefore this information is recoverable. Each value of the {I(n),Q(n)} sequence corresponds to one signaling element (symbol) transmitted. The number of signaling elements transmitted per second is commonly referred to as the baud rate, which for the Bell 212A/V.22 is set by the protocol to 600. 226 Theory and Implementation of a Splitband Modem Using the TMS32010 Some widely used terminology becomes apparent from (3). The baseband sequence that modulates the cosine wave is called the In-phase sequence. The baseband sequence that modul!ltes the sine wave is called the Quadrature-phase sequence since the sine-wave carrier is 90 degrees (one Quadrant) out-of-phase from the cosine-wave carrier. The part of the transmitter/receiver that processes the In-phase sequence is commonly referred to as the I-channel, while the part of the transmitter/receiver that processes the Quadraturephase sequence is referred to as the Q-channel. The derivation of (3) indicates that the incoming sequence ds(n) is encoded into the sequence {I(n),Q(n)}, and the latter is transmitted. The mapping rule used is unique for each system; i.e., the mapping rule used for the Bell 212A/V.22 is different from the mapping rules used for other modems (V.22 bis, V.27, V.29, etc.). For example, for the Bell 212A/V.22, the sequence {I(n),Q(n)} contains phase information, while for the V.22 bis, it contains phase and amplitude information. The set of possible values of the sequence {I(n),Q(n)} determines the signal constellation, which is given in a twodimensional representation) The signal constellation, commonly referred to as the constellation diagram, is a geometric picture that emphasizes the fact that the two channels are 90 degrees (Quadrature) out-of-phase. The Bell 212A/V.22, with a 6OO-baud rate, accomplishes the transmission of 1200 bps by encoding two incoming bits (dibit) in a single baud. Since there are four possible values for every dibit, the constellation diagram for the Bell 212A/V.22 contains four points. Each constellation point, i.e., each value of the {I(n),Q(n)} sequence, corresponds to a total phase value to be transmitted. The calculation of the total phase from the incoming dibits will be discussed later .. Figure 2 shows the constellation diagram for the Bell 212A/V.22. The four constellation points, notated A, B, C, and D, lie on a circle. Since there is no amplitude information transmitted, the radius of this circle is normalized to unity. The total phase information represented by each constellation point is enclosed in parentheses. The encoding of the incoming sequence ds(n) into the values of the sequence {I(n),Q(n)} is implemented by the encoder. The encoder is a one-input, two-output functional block, whose function is to map every two incoming bits (dibit) of the incoming sequence ds(n) to a total phase. The total phase is then represented by the values of the sequence {I(n),Q(n)}, and the latter is transmitted. The mapping rule used to encode the total phase into the values of the coder outputs {I(n),Q(n)} is shown in Table 2. Each {I,Q} entry in this table corresponds to one point in the constellation diagram of Figure 2. This is indicated in the third column of Table 2. Theory and Implementation of a Splitband Modem Using the TMS32010 227 Q -- (270 0 ) /-- -- .... I I I / I I / 0 -............. .... .....,., , / \ \ \ \ \ c (0 0 ) A (180 0 ) \ \ \ \ \ \ , ' ...., ..... ......... -- B (90 0 ) Figure 2. Signal Constellation for the Bell 212A/V.22 Table 2. Total-Phase-to-Coder-Output Mapping Rule Total Phase Encoder Output { I. Q } Point in Constellation Diagram of Figure 2 o degrees 90 degrees 180 degress 270 degrees { 1 , 0 } {0,-1} {-1,0} { 0 , 1 } A B C 0 The calculation of the total phase from the incoming dibits is accomplished in two steps. First, each incoming dibit is mapped to a unique phase change. Second, this phase change is added to the previous total phase to obtain the new total phase. The mapping ' rule used to uniquely map each dibit to a phase change is shown in Table 3. Table 3. Dibit-to-Phase Change Correspondence 228 Dlbit Phase Change 00 01 10 11 90 degrees o degrees 180 degrees 270 degrees Theory and Implementation of a Splitband Modem Using the TMS32010 To illustrate the two-step procedure used to calculate the total phase, consider the following example. The previous total phase is 90 degrees, and the incoming dibit is 10. From Table 3, the phase change corresponding to a 10 dibit is 180 degrees. Therefore, the new total phase is modulo 360 (previous total phase + phase change) new total phase = (90 degrees) + (180 degrees) = 270 degrees . Using Table 2, for this value of total phase (270 degrees), the encoder output is {I,Q} = {O,i}. For the next incoming dibit, the above procedure is repeated with a 270-degree previous total phase. At the receiver, the total phase is determined from the received {I,Q} value. This total phase is subtracted from the previous total phase (the one transmitted during the previous baud), and the difference is the phase change. Since the phase-change-to-dibit mapping is unique, using the calculated value of the phase change results in the transmitted dibit being uniquely recovered at the receiver. This differential approach (Le., the calculation of the phase change instead of an absolute phase) is used because if the dibits were to correspond to an absolute phase, then a common-phase reference for both the receiver and the transmitter would be required. This in tum implies the need of a training sequence between the transmitter and the receiver so that a common-phase reference can be established. This training sequence, however, is not provided for the Bell 212AIV.22. An overall block diagram for the modem transmitter is shown in Figure 3.3 The basic structural blocks are the scrambler, encoder, digital lowpass filter, and digital modulator. COSINE IInTsl DATA ACCESS ARRANGEMENT IDAAI DIGITAL QlnT51 LOWPASS FILTER SINE Figure 3. Modem Transmitter Block Diagram Theory and Implementation of a Splitband Modem Using the TMS32010 229 Scrambler The scrambler scrambles the bits sent by the OTE. To understand the need for a scrambler, consider the situation where the OTE sends a series of 01 dibits. From Tabl~ 3, each 1 dibit corresponds to a O-degree phase change. Therefore, the total phase transmitted is the same. From the geometrical point of view, this results in transmitting the same constellation point.(same total phase). At the receiver end, however, phase changes are required for correct clock recovery (see the clock recovery discussion in the Modem Receiver subsection). Therefore, the transmission of a series of 01 dibits generates problems for the receiving modem, such as losing carrier lock. To avoid this, the scrambler is introduced to minimize the probability that such 'ill-conditioned' dibits occur. With denT) input to the scrambler, the output ds(nT) is given by ds(nT) = (4) denT) XOR ds«n -14)T) XOR ds«n -17)T) where XOR indicates the exclusive-OR operation and T is the data period, i.e., the time between two successive bits sent by the Oata Terminal Equipment. The signal flowgraph of the modem transmitter scrambler is shown in Figure 4 in which z - n is used to indicated an n-sample delay. ds((n - 14)T) ds((n - 17)T) Z-3 dInT) Z-14 ds(nT) Figure 4. Signal Flowgraph of Transmitter Scrambler Encoder The function of the encoder, i.e., the mapping of the incoming sequence ds(n) to the values ofthe sequence {1(n),Q(n)}, was discussed earlier. However, there is one more related issue associated with the encoder, i.e., the change of the sampling frequency at the encoder output. Every two bits that the modem transmitter accepts from the OTE correspond to a unique phase to be transmitted. Therefore, at the encoder output, the sampling period changes from T (sampling period of incoming data) to Tb, i.e., from 1/1200 s to 1/600 s. The subscript b in Tb represents baud since the encoder output (I and Q channels) changes at the baud rate. The above discussion implies that Tb = 2T; i.e., the I and Q channels are updated after every pair of bits received from the OTE. 230 Theory and Implementation of a Splitband Modem Using the TMS32010 Digital Modulators and Lowpass Filters Since the telephone network behaves as a bandpass filter with the passband starting around 300 Hz and ending around 3200 Hz, the baseband encoder outputs, I(nTb) and Q(nTb), cannot be directly transmitted through the communications medium. They first must be modulated up in frequency. The modulation is not attempted directly on the encoder outputs for two reasons. First, as discussed at the end of this subsection, the sampling frequency must increase from lITb to l/Ts, with lITs being at leaSt 6.4 kHz. This increase in the sampling frequency is accomplished by interpolation. Second, if the modulation is attempted directly on the encoder outputs, the instantaneous changes of the I(nTb) and Q(nTb) generate higher-order harmonics. Some of these harmonics fall in the frequency region reserved for the receiver. To eliminate the harmonics and to also increase the sampling frequency by interpolation, the encoder outputs must be digitally lowpass-filtered. The characteristics and the implementation of the digital lowpass filters are discussed in detail in the Transmit Filters subsection of "Functions Implemented in the TMS3201O." At the output of the lowpass filters, the I-channel modulates a cosine wave and the Q-channel a sine wave. The modulating frequency is 1200 Hz for an originate modem and 2400 Hz for a answer modem. Finally, the two chaimels are summed before they are transformed into the analog signal transmitted through the telephone network. The output of the digital transmitter (before the D/A converter) is given by equation (3), repeated . below for convenience. s(nTs) = I(nTs) cos(wnTs) + Q(nTs) sin(wnTs) The sampling period T s is Ts = lIfs where fs is the sampling frequency. This frequency must be at least twice the highest frequency component of the transmitted information (Nyquist rate) to satisfy the sampling theorem. Since the telephone network cuts off at approximately 3.2 kHz, the sampling frequency must be at least 6.4 kHz. Practical considerations (integer number of samples per baud, etc.) impose the necessity of higher sampling rates. For the present application, the sampling frequency used was 9.6 kHz. Since the baud frequency is 600 Hz, 16 (9600/600) samples correspond to each baud interval. Modem Receiver This subsection discusses the issues associated with the functional blocks required to implement a Bell 212A/V.22 modem receiver. The receiver structure is more sophisticated than that of the transmitter. For a low bit-error-rate performance (percentage of error bits received), an Automatic Gain Control (AGC) subsystem, adaptive equalization of the overall transmitting system, and a noise-independent carrier recovery and clock recovery are required. Since the issues associated with the carrier recovery and the clock recovery are critical in a modem design and difficult to understand, a good portion of this subsection is devoted to their discussion. Theory and Implementation of a Splitband Modem Using the TMS32010 231 The adaptive equalizer is an adaptive filter that compensates for intersymbol interference and Doppler spread effects introduced during transmission over the telephone liiles. 4 The magnitude of these effects depends on the bit rate and the quality of the , telephone line. The effects are more ~evere at high bit rates (2400 bps and above) and dver a worst~case telephone line, which is commonly represented by the 3002 line simulator.S The Bell 212A/V.22 protocol does not require the presence of an adaptive equalizer; therefore, this implementation does not include one. However, for increased performance on a 3002 line where even at medium speeds, such as 1200 bps, intersymbol interference and Doppler spread effects become severe, an adaptive equalizer is recommended. An important point here is that the addition of an adaptive equalizer in the ,current TMS32010 implementation of the Bell 2l2A/v .22 modem does not require any hardware changes. Increased performance results from an increase in the algorithmic sophistication. An overall block diagram of the modem receiver is shown in Figure 5. The basic structural blocks of the modem receiver are the input bandpass filters, the automatic gain control (AGC), the demodulator, the decision block, the decoder, the descrambler, the carrier recovery, and the clock recovery . .Figure 5., Modem Receiver Block Diagram Input Bandpass Filters The iricoming analog signal s(t) is digitized at the sampling frequency fs to obtain its digital counterpart s(nTs). This signal is then bandpass-filtered for three reasons: 1. Rejection of out-of-band noise, including the rejection of the transmit signal spectrum due to the near-end echo path, 2. Introduction of 90-degree relative phase shift required for the I and Q channel separation (see Appendix A), and 3. Fixed equalization for line distortion. 232 Theory and Implementation of a Splitband Modem Using the TMS32010 The second reason mentioned above implies the need of receiver bandpass filters that achieve a 90-degree relative phase shift. It is theoretically justified in Appendix B that if the two bandpass filters, denoted by BPF 1 and BPF 2 in Figure 5, achieve an exact 90-degree relative phase shift, there are no harmonics at the output of the receiver demodulator. If this condition is not met, harmonics appear at twice the carrier frequency. These harmonics were observed in the modem implementation when a set of bandpass filters not meeting the above condition was used. Elimination of the harmonics due to an inexact 90-degree relative phase shift involves the use of lowpass filters at the output of the demodulator. However, the group delay and the possible phase distortion introduced by the lowpass filters affect the carrier recovery and decision algorithms. Compensation for these side-effects of the lowpass filters results in a more complicated modem receiver design. In the analog domain, where component drift is due to aging and/or temperature, it is virtually impossible to design bandpass filters or Hilbert transformers that achieve an exact 90-degree relative phase shift. Hilbert transformers, a special class of filters, are discussed in Appendices A and B. In the digital domain, however, the design of bandpass filters or Hilbert transformers that achieve an exact 90-degree relative phase shift is relatively easy. Digital filter design packages, such as the Digital Filter Design Package (DFDP) offered by the Atlanta Signal Processors Incorporated (ASPI), can be used to design modem receiver input fllters on the TMS32010 that meet the exact 9O-degree relative phase shift requirement. The characteristics and implementation of the modem receiver input bandpass fllters are discussed in detail in the Receive Filters subsection of "Functions Implemented in the TMS3201O." Automatic Gain Control (AGC) Because of the attenuation introduced by the telephone lines, the peak-to-peak voltage of the incoming analog signal s(t) ra~ges between 2 mV and 700 mV. However, sigmd levels in the receiver must be independent of the attenuation introduced by the communications channel. This is of paramount importance because the carrier recovery and clock recovery algorithms use error signals and thresholds dependent on the I and Q channel values. Therefore, the Automatic Gain Control subsystem is required to adjust the envelope of the I and Q channels so that they are of the same magnitude. The AGC algorithm used and its implementation is discussed in the Automatic Gain Control Implementation subsection of "Functions Implemented in the TMS3201O." Demodulator The demodulator translates the passband information back to the baseband. With Ip(nTs) and Qp(nTs) inputs to the demodulator (see Figure 5), the outputs T(nTs) and Q'(nTs) are.given by (see derivation in Appendix A) + Qp(nTs) sin(w'nTs) (5) Ip(nTs) sin(w'nTs) - Qp(nTs) cos(w'nTs) (6) Ip(nTs) cos(w'nTs) Theory and Implementation of a Splitband Modem Using the TMS32010 233 where w' is the local carrier frequency. Figure 6 shows the demodulator structure that implements (5) and (6). sin(w'nTs) .----~ XJ------, + + cos(w'nt s ) "(nTs ) + ' p ( n T s ) - - - + -....--i~ X)-__...J cos(w'nT s) Qp(nT s) - - -....--t---I~ X1---..., sin(w'nT s) + 1 - - -..... Q'(nT s) + '--...-f X J-----I Figure 6. Demodulator Structure Even with an ideal receiver, the I'(nTs) and Q'(nTs) channels shown in Figure 6 are 'noisy' replicas of the baseband I and Q channels at the output of the transmitter digitallowpass filters. The 'noise' has been injected by the telephone network as group delay, frequency jitter, and Gaussian noise. 4 Decision Block and Descrambler The decision block in Figure 5 calculates the total phase from the values of the baseband I and Q channels. By subtracting it from the previous total phase (the phase transmitted during the previous baud interval), the phase change is computed. Each phase change (total of four) has a corresponding unique dibit (see Modem Transmitter subsection). This dibit is fed into the descrambler (see Figure 5) to recover the originally transmitted dibit. The output of the descrambler is described by d(nT) = ds(nT) XOR ds«n -14)T) XOR ds«n -17)T) 234 (7) Theory and Implementation of a Splitband Modem Using the TMS32010 where T is the data period (1/1200 s for the Bell 212A). The signal flowgraph of the receiver descrambler is shown in Figure 7. d s (nTl-_....jz-14t--....- ......... ds((n - 14)T) Figure 7. Signal Flowgraph of Receiver Descrambler Carrier Recovery A very important task of the modem receiver is the generation of a carrier that has the same frequency and phase with the incoming carrier. This receiver-generated carrier, called the local carrier, is used by the demodulator of Figure 6 to demodulate the incoming signal and therefore retrieve the baseband information. The process of generating this carrier is called carrier recovery. The standard approach to this is to use a phase-locked 100p.6 Figure 8 shows the basic blocks of a phase-locked loop: the phase detector (PD), loop filter and Voltage Controlled Oscillator (VCO). INCOM ING CARRIER PHASE DETECTOR DEMODULA TOR LOCAL CARRIER ERROR LOOP FILTER f-- VOLTAGE CONTROLLED OSCILLATOR Figure 8. Carrier Recovery Phase-Locked Loop For a microprocessor implementation, the blocks in Figure 6 are implemented digitally. The digital implementation is discussed in the Carrier Recovery Implementation subsection of "Functions Implemented in the TMS3201O." Only the issues associated with the carrier recovery phase-locked loop are considered here. Theory and Implementation of a Splitband Modem Using the TMS32010 235 The phase detector (PD) generates an error signal that is used to synchronize the local carrier to the incoming carrier. This error signal must contain the information about the phase and frequency difference between the local and the incoming carriers. To implement the correct carrier recovery algorithm, it is critical to know the exact dependence of the phase detector output on the frequency and phase difference between the two carriers (discussed later in this subsection). The phase detector output is of the form 7 ,8 (8) where I and Q are the I and Q channel decisions and Tb is the baud period (1/600 s). If the decisions are correct, then Q(nTb) = Q(nTb) I(nTb) = I(nTb) (9) (10) i.e., the outputs of the transmitter coder (see Figure 3) have been successfully recovered. The probability that these decisions are correct is maximum in the middle of each baud because the incoming signal energy is maximum here. Based on the error signal E(nTb), the local carrier is corrected once every baud, i.e., at a 6OO-Hz frequency. Geometrically, the error E(nTb) is a measure of the geometrical distance between the point used to make the decision and the optimum one. The optimum decision points are the constellation points. It is shown later that when the local carrier has the same phase and frequency with the incoming carrier, the error E(nTb) = O. In this case, the point used to make the decision coincides with a constellation point. The optimality of the receiver constellation points is discussed next. Optimality in the receiver, in terms of low probability of error, is determined only by the geometrical distance between the constellation points. 9 The four constellation points of Figure 2, notated as A, B, C, and D, are optimum. The following intuitive argument helps to illustrate this. The four points lie on a circle of normalized unity radius. In the configuration of Figure 2, point A is equidistant from points Band D. This means that the probability of error p when deciding between points A or B, i.e., deciding point A when point B is correct and vice versa, is equal to the probability of error when deciding between points A or D. If point A moves counterclockwise, it moves away from point B but closer to point D. Since at the new location, point A is farther from point B, the probability of error PI when deciding between points A or B decreases, i.e., PI < p. However, at this new location, point A is closer to point D, and therefore, the probability of error P2 when deciding between points A or D increases, i.e., P2 > p. Using the analytical tools discussed in [9], it can be shown that PI + P2 > 2p. Since the overall probability of error increases (PI + P2 > 2p) if point A moves away from the location indicated in Figure 2, the resulting structure is no longer optimum. This is not true, however, if all four constellation points are equally rotated by an arbitrary amount in the clockwise or counterclockwise direction. Therefore, an infinite set of constellation points that preserve optimality in the receiver exist. The final choice depends on implementation considerations. 236 Theory and Implementation of a Splitband Modem Using the TMS32010 For the modem implementation described in this report, two considerations lead to a 45-degree rotation (see Figure 9) of the transmitter constellation diagram of Figure 2. 1. For the constellation points of Figure 9, the decision boundaries are the I and Q axes. That is, the decision region for point A is the first quadrant, the decision region for point D the second quadrant, and so on. Therefore, a decision can be made based only on the sign of the demodulated I ( I'(nTs) ) and Q ( Q'(nT s) ) channels. 2. For this set of constellation points, the products Q(nTb) I'(nTb) and I(nTb) Q'(nTb), required to calculate the phase error E(nTb) (see equation (8», obtain on the average maximum values. Therefore, an optimum utilization of the dynamic range is achieved, and the error function calculated by (8) is the least-noise sensitive. Q (0,1) 'J, ,I '45° , -- , .,,/ I I I Yo (0, -1) Figure 9. Modem Receiver Decision Points The error E(nTb), the output of the phase detector, as given by (8) shows no apparent dependence on the phase or frequency difference between the local and incoming carriers. The discussion that follows shows the dependence of E(nTb) on the phase difference between the two carriers. This discussion is then extended to include the case of frequency as well as phase difference. The inputs Ip(nTs) and Qp(nTs) of the receiver demodulator (see Figure 6) are given by (see Appendix A) Ip(nTs) = I(nTs) cos(wnT s + Or) + Q(nTs) sin(wnTs + Or) (11) Qp(nTs) = I(nTs) sin(wnTs+Or) - Q(nTs) cos(wnTs+Or) (12) Theory and Implementation of a Splitband Modem Using the TMS32010 237 where wand Or are the incoming (received) carrier frequency and phase, respectively. The outputs I' (nT s) and Q' (nTs) of the demodulator are described by equations (5) and (6), respectively. Introducing an arbitrary phase 0\ in the local carrier, (5) and (6) can be rewritten as = I'(nT s ) Ip(nTs) cos(w'nTs+OJ} + Qp(nTs) sin(w'nTs+O\) Q'(nTs) = Ip(nTs) sin(w'nTs + OJ} - Qp(nTs) cos(w'nTs +0\) (13) . (14) where w' is the local carrier frequency. Assuming no frequency difference (w' (13) and (14) gives = I' (nTb) w), substitution of (11) and (12) into I(nTb) cos(Oe) + Q(nTb) sin(Oe) (15) Q' (nTb) = Q(nTb) cos(Oe) - I(nTb) sin(Oe) (16) where Oe = Or - 0\ is the phase difference between the two carriers. Note that if Or = OJ, then Oe = O. From (15) and (16), I'(nTb) = I(nTb) Q' (nTb) = Q(nTb) i.e., the output of the receiver demodulator at the middle of the baud is the same as the output of the transmitter coder (baseband information). Assuming the decisions are correct, equations (9) and (10) hold. Substitution of (9), (10), (15), and (16) into the error signal defined by (8) gives E(nTb) = {I2(nTb) + Q2(nTb)} sin(Oe) (17) The quantity 12(nTb) + Q2(nTb) is a positive quantity (sum of squares). With 12(nTb) + Q2(nTb) = K, (17) can be rewritten as where K > 0 (18) Equation (18) is the same as (8) under the assumption of correct decisions «9) and (10». However, the phase information is more apparent in (18) than in (8), and leads to the following algorithm for the carrier recovery: If the phase of the received carrier is greater than the phase of the local carrier (Or > OJ}, the phase error Oe is positive (Oe > 0). From (1-8), this implies that the output of the phase detector is also positive (E(nTb) > 0). Therefore, if E(nTb) > 0, the phase of the local carrier must be advanced, resulting in a smaller phase error. On the other hand, if the phase of the received carrier is less than the phase of the local carrier (Or < OJ), the phase error is negative (Oe < 0). From (18), this implies that the output of the phase detector is also negative (E(nTb) < 0). Therefore, if E(nTb) < 0, the phase of the local carrier must be delayed. 238 Theory and Implementation of a Splitband Modem Using the TMS32010 In the case of frequency as well as phase difference, a similar development leads to where K > 0 (19) where We = W - w' is the frequency difference between the incoming and local carriers. Since this frequency is very small (on the order of a few Hz) and the phase error correction is applied every baud (600 Hz), the term We nTb can be considered to be constant and the term We nTb + Be in (19) an overall phase error. Therefore, using the algorithm discussed earlier, the frequency difference is compensated for as phase difference. Also note that in (19), E(nTb) = 0 when We = 0 and Be = 0; i.e., the local carrier is completely synchronized with the incoming carrier. Therefore, the error signal E(nTb) generated by the phase detector contains the information about the frequency and phase difference between the incoming and local carriers. The error signal E(nTb) generated by the phase detector is processed by the loop filter as shown in Figure 8. Only the DC and low-frequency components of this signal must drive the Yoltage Controlled Oscillator (YCO).6 Therefore, the loop filter is basically a lowpass filter, whose most important characteristic is its bandwidth. A large bandwidth of the loop filter implies that high-frequency components pass through the filter. Since the high-frequency information is applied to the YCO, the local carrier quickly locks-on to the incoming carrier. However, noise also passes through the filter, and the Bit Error Rate (BER) of the receiver increases. A narrow bandwidth decreases the BER but the lock-on time increases. An intelligent solution consists of starting with a wide bandwidth and, after the receiver is locked-on to the incoming carrier, narrow it down. This approach is used in this implementation and is described further in the Carrier Recovery Implementation subsection of "Functions Implemented in the TMS3201O." Clock Recovery The purpose of the Clock Recovery block in Figure 5 is to detect the middle of each baud. O~ce this is known, the decision block can make decisions with minimum probability of error because the energy of the incoming signal is maximum at the middle of the baud. The following paragraphs discuss a robust clock recovery approach. As the demodulation point moves from one constellation point to another, at least one of the two channels is expected to cross zero (see Figure 9). This zero crossing indicates the beginning of a new baud interval. Therefore, one approach is to look at the zero crossings of the I'(nTs) and/or Q'(nT s) channels. However, there are two problems with that approach: 1. From (15) and (16), it can be seen that the presence of a phase difference Be between the two carriers can cause severe distortion of the zero crossings. To illustate this point, consider the first of the two equations, repeated here for convenience. Theory and Implementation of a Splitband Modem Using the TMS32010 239 The correct zero crossing information lies in I(nTb). Multiplication by cos(Oe) scales the I(nTb) curve, but does not change the location of the zero crossings. This is accomplished by the second additive term Q(nTb) sin(Oe), which moves the scaled curve up or down depending on theterm's sign. 2. The quantization noise in a digital implementation may result in undesirable nonlinearities and mislocation of the zero crossings. This is because finding the z~ro crossings involves monitoring the change of the sign of a particular variable (I channel and/or Q channel). A zero crossing occurs when this variable changes from a small positive value to a small negative value, and vice versa. Since the quantization noise can seriously affect small quantities (numbers), inislocation of the zero crossings may result. The first of the above problems indicates that a clock recovery approach is required that is independent of the phase or frequency difference between the two carriers. This becomes clearer by considering the operation of the modem. The first task that the receiver must perform is to adjust the baud clock. During this adjustment, the two carriers are most likely to have a phase and/or frequency difference. Then, once the baud clock is adjusted, the carrier recovery algorithm places the local carrier in phase and in frequency with the incoming carrier. Consider the energy of the incoming signal Energy = I'2(nTs) + Q'2(nTs) (20) Substitution of (15) and (16) into (20), and the use of the identity sin 2(Oe) + cos2(Oe) = 1 gives Energy = I2(nT s) + Q2(nTs) (21) This is the energy sent out by the transmitting modem. Equation (21) shows that the energy is independent of any phase and/or frequency difference between the two carriers. Geometrically, the energy is the square of the length of the vector that has its beginning at the intersection of the I and Q axis of Figure 9 and its tip at the demodulation point plotted on the constellation diagram. The path traced by the tip of the energy vector for a series of four consecutive baud intervals, each corresponding to a 9O-degree phase change, is shown in Figure 10. 240 Theory and Implementation of a Splitband Modem Using the TMS32010 a Figure 10. Trace of Demodulation Point Plotted on the Constellation Diagram The plot shown in Figure 10 was obtained using a simulator. It can be seen that the signal energy (12 + Q2) achieves its maximum value at the middle of each baud. Before and after the middle of the baud, the length of this vector is less than maximum. If there is a transition from one quadrant to another, this vector goes through a minimum, thus indicating the beginning of a new baud interval. Only if the same constellation point is transmitted because of a zero-degree phase change does such a transition not occur. It is easy to explain now why a series of zero-degree phase changes can create problems for the receiver. Zero-degree phase changes imply that the transmitter keeps sending the same constellation point. Therefore, the energy vector at the receiver does not go through a minimum for a series of baud intervals; i.e., during these intervals the receiver cannot adjust the baud clock and therefore may lose lock. This situation is avoided with the inclusion of the scrambler in the transmitter structure. The frequency of the energy minima is discussed next. From Figure 9, it can be seen that there are four possible transitions for each constellation point. For example, consider constellation point A. The four possible transitions are: from point A to B, from A to C, from A to D, and from point A to A (i.e., receiving a zero-degree phase change). Three out of the four possible transitions result in a quadrant change (transitions from point A to points B, C, or D). For these transitions, the energy vector goes ,through a minimum. The fourth transition (from point A to itself), does not result in a quadrant change, but due to the presence of the scrambler, the probability of its occurrence is less than 0.25 (one out of four). Therefore, the average frequency of these minima is greater than 450 Hz for a 6OO-Hz baud frequency. For the baud clock adjustment, the advantages of the energy-based approach over the zero crossings-based approach are: 1. The energy-based approach is independent of the phase and frequency difference between the two carriers, and therefore it gives the correct information about the incoming baud boundaries. Theory and Implementation of a Splitband Modem Using the TMS32010 241 2. The average frequency of the energy minima is greater than 450 Hz while the average frequency of the zero crossings of the I or Q channels is between 300 and 400 Hz. The explanation follows. In the four possible transitions for each constellation point, two of them result in a zero crossing for a particular channel. Considering, for example, the transitions of constellation point A of Figure 9, the transitions from point A to points C or D result in a zero crossing for channel I. The transitions from point A to points B or C result in a zero crossing for channel Q. This implies that for a baud frequency of 600 Hz, the frequency of the zero crossings of a particular channel (lor Q) is on the average 300 Hz (two out of four). Because of the scrambler, the probability of retransmitting the same constellation point (zero-degree phase change) is minimized. This implies that on the average the frequency of the zero crossings of a particular channel increases. In the limit (no zero-degree phase changes), the average frequency of the zero crossings approaches 400 Hz (two out of three). Therefore, the average frequency of the zero crossings of a particular channel is between 300 and 400 Hz. To obtain more information from the zero crossings (greater average zero crossings frequency), the zero crossings of both the I and Q channels must be considered. However, this approach involves monitoring two quantities (I channel and Q channel) compared to monitoring only one (energy) if the energy-based approach is used. 3. Using the energy-based clock recovery technique described in the Baud Clock Alignment Implementation subsection of "Functions Implemented in the TMS3201O," the quantization noise effects are less severe compared to those of a zero crossing-based approach. Modem Hardware Description A brief description of the hardware used for the implementation of the Bell 212A/V.22 modem is covered in this section. Most of the signal processing required for the implementation of the modem functional blocks described in the previous section is performed digitally by the TMS32010 digital signal processor (see "Functions Implemented in the TMS3201O"). The DTE interface and the protocol are handled by the TMS774210, 11, an 8-bit EPROM microcomputer with an on-chip UART. Therefore, the hardware required for the system is minimal and consists primarily of the TMS32010 and TMS7742 processors, their memory, the AID and DI A converters, and the associated antialiasing and smoothing filters. To aid in the development and prototyping of this project, off-the~shelf development tools were used to build the modem hardware. The TMS32010 and the TMS7742 were emulated using Extended Development Systems (XDS) (part # TMDS3262211 for the TMS32010, and part # TMDS7062230 for the TMS7742). For the AID and D/A conversions, the TMS32010 Analog Interface Board (AlB) ( part # RTC/EVM32OC/06) was used. The Cermetek CH181O, Data Access Arrangement (DAA) approved by the Federal Communications Commission (FCC), is used for the telephoneline interface. A block diagram of the modem system hardware is shown in Figure 11. 242 Theory and Implementation of a Splitband Modem Using the TMS32010 XDS XDS iI , I I I I .-----.,.------------------------1 I I I I I I ANALOG INTERFACE BOARD (AlB) SMOOTHING FILTER TMS7742 I I I I I I TELEPHONE LINE I ANTlALlASING FILTER - ) I I I I - - - - - - - - - - ______ 1 Figure 11. Modem Hardware Block Diagram Analog Interface Compensative gain circuits have been placed between the DAA and the analog-to-digital converter. The gain circuit on the receiver side (see Figure 5) was added to match the peak amplitude of the signal from the phone line (- 9 dbm or 0.77 V peak-to-peak) with the maximum range of the analog-to-digital converter (10 V peak-to-peak). This allows as much as possible of the AID's dynamic range to be used without causing saturation. The gain circuit on the transmitter side,(see Figure 3) is designed to attenuate the output of the digital-to-analog converter (10 V peak-to-peak) to a level consistent with the phone system signal strength limits (-12 dbm or 0.55 V peak-to-peak). Filters The analog antialiasing and smoothing filters used by the AID, and DI A converters are sixth-order lowpass filters existing on the AlB, implemented using cascaded second-order opamp filter sections. These filters are designed with cutoff frequencies around 4.7 kHz in order to satisfy the Nyquist criterion requirements of the system. Data Converters Analog Devices' AD565A and ADC80, monolithic AID and DIA converters on the AlB, are configured for a ± 10 V full-scale range and are interfaced to 110 port 2 of the TMS3201O. The sampling rate for the conversions is determined by a set ofpresettable counters configured as frequency dividers. These counters are driven by the TMS3201O's CLKOUT signal and produce a periodic sampling clock that initiates AID and DI A conversions. The sampling frequency used is 9.6 kHz. TMS32010/TMS7742 Interface The TMS32010 interfaces to the TMS7742 in parallel as shown in Figure 12. Theory and Implementation of a Splitband Modem Using the TMS32010 243 RNBIT O~ - a SN74lS32. r-- p '1' RACK TMS7742 06 l B6 ~ o~ B7 F WAC - SN74lS32 A' TMS32010 1 - CIsN'7'4LSi3B P ),OC a DEN ' - - AO - ClK DO Y6 Bt-- o~ a t- 0 A1 A2 WE DO 01 01 02 02 03 03 04 04 05 a 0 05 SN74lS374 ClK V CO 0 roc BID ClKOUT a r--- C1 20 MHz C2 ~D~ C3 C4 C5 B5 0 a T T SN74lS374 XTL2 Figure 12. T:MS7742 and TMS32010 Interface The TMS7742 is mapped as an 110 device at Port 6 of the TMS3201O. When the TMS32010 writes to Port 6, the WNBIT line goes active (D7). The TMS7742 polls this line and when active, reads data and status bits from the buffer into Port D. It also resets the WNBIT by sending a low pulse to the write acknowledge (WACK) line. Similarly, when the TMS32010 reads from Port 6, the RNBIT line goes active. The TMS7742 immediately writes the new data to Port C and resets the read acknowledge (RACK) line. Six bits are used to interface the TMS32010 to the TMS7742. Two of these are used to pass the dibit data, two are used to send. commands or status, and the other two are reserved to pass additional data if implementing the V.22 bis. The V.22 bis is a 2400-bps splitband modem that uses quad (four) bits instead of dibits. Table 4 lists the commands. The symbol X is used to indicate a don't care condition. 244 Theory and Implementation of a Splitband Modem Using the TMS32010 Table 4. Modem Controller Commands Bit5 Bit4 Bit3 Bit2 Bit1 BitO O· 0 X X X X Idle 0 1 X X X X Run local digital loopback 1 0 X X 01 00 Run modem 1 1 03 02 01 00 Configure TMS32010 according to 03-00 Command Description In the idle mode, the TMS32010 continues to monitor the commands from the TMS7742. In the local digitalloopback mode, the TMS32010 reads the scrambled dibits from the TMS7742 and sends them back to the TMS7742. In the run mode, the TMS32010 reads the scrambled dibits from the TMS7742 and does the required encoding and modulation for the transmission through the telephone network. It also decodes the demodulated data and sends it to the TMS7742 for descrambling. Bits DO and D1 are used to carry the dibit information. Bits D2 and D3 can be used when implementing the V.22 bis. In the configuration mode, the TMS32010 configures the transmit and receive filters for the originate or answer mode, depending on the data on D3-DO (see TMS7742 source code provided in Appendix E). Functions Implemented in the TMS32010 The functions discussed in this section include all of the functional blocks described in the Modem Transmitter and Modem Receiver subsections with the exception of the transmitter scrambler and the receiver descrambler, which are implemented in the TMS7742. Table 5 shows the modem functions that are implemented on each device. Theory and Implementation of a Splitband Modem Using the TMS32010 245 Table 5. Modem Functions Implemented in the TMS32010 and TMS7742 Modem Transmitter Implemented Guard Tone Generator No Scrambler TMS7742 Encoder TMS32010 Digital Lowpass Filters TMS32010 Originate Mode Modulator TMS32010 Answer Mode Modulator No DTE Interface Modem Receiver TMS7742 Implemented Notch Filter No Originate Mode Bandpass Filters TMS32010 Answer Mode Bandpass Filters No Automatic Gain Control TMS32010 Demodulator TMS32010 Decision Block TMS32010 Decoder TMS32010 TMS7742 Descrambler Clock Recovery TMS32010 Carrier Recovery TMS32010 DTE Interface Each variable used in this section is referred to program enclosed in parentheses (see Appendix D). TMS7742 ~y its name in the TMS32010 Transmit Filters The transmit lowpass filters are implemented using 48-tap FIR structures, whose frequency responses exhibit a raised-cosine shape. A raised-cosine response is a filter response whose pass and stopbands are flat and whose rolloff characteristic is defined as a constant times a (l + cos) term. The (1 + cos) term results in the rolloff shape being a portion of a cosine wave raised above the X-axis by one, hence the term 'raised-cosine response'. The raised-cosine response is used since it has been shown that it minimizes the intersymbol. interference. 12 The response shape of the transmit filters is actually defined by the square root of a raised-cosine response since the raised-cosine characteristic is split equally between the transmitter and receiver; i.e., both the transmitter and receiver filters are designed to exhibit the square root of the raised-cosine response. This results in the combined, end-to-end response of the path from transmitter to receiver being the full raised-cosine response. 246 Theory and Implementation of a Splitband Modem Using the TMS32010 The frequency-response characteristic of the transmit lowpass filters, as shown in Figure 13, rolls off smoothly to approximately -40 dB at 600 Hz. 10 8 w 6 c ~ ..... 2: CJ ~ 4 2 o o 200 400 600 800 1000 FREQUENCY Figure 13. Frequency Response Characteristics of Transmit Lowpass Filters The FIR structure is well suited to implementation of these filters, because FIR filters are stable, simple in structure, and can be designed to exhibit linear phase. These filters are easily implemented on the TMS32010 since the processor provides special instructions and architectural features that facilitate this type of algorithm. A signal flowgraph of the FIR filter structure is shown in Figure 14. a x(n) z-1 x(n-1) }II 1°' z-1 x(n-2) }21 z-1 ~ h(N-2) x(n-N+ 1) h(N-1) .,.. - y In) Figure 14. Signal Flowgraph of the FIR Filter Structure As the flowgraph illustrates, this type of filter uses no feedback, which accounts for its stable behavior. FIR filters implement a transfer function of the form H(z) = BO + Bl z-l + B2 z-2 + B3 z-3 + ... + Bn z-n Theory and Implementation of a Splitband Modem Using the TMS320lO (22) 247 The parameters in (22) that determine the characteristics of the specific filter implemented are the B coefficients BO-Bn. In the. case of the motlem filters, the primary task in designing the filter is the determination of these coefficients so that the filter has the desired response shape, in this case, the raised-cosine response shape. For a detailed description of FIR and IIR filter design for the TMS3201O, refer to "Implementation of FIRIIIR Filters with the TMS3201O/TMS32020," an application report 13 , and to Digital Filter Design, a book by T.W. Parks and C.S. Burrus.14 The raised-cosine response shape is defined by If I < fl fl < IfI < 2 Bt 2 Bt H(f) 4 Bt {I + cos [11" ( IfI - fl) ] } 2 Bt - 2 fl - fl (23) If I > 2 Bt - fl 0 where fl =(1 - p) Bt · For this design, Bt = 300 Hz and p = 0.75. Note that (23) describes the ideal zerophase version of the raised-cosine response. The actual frequency response of the transmit filters, shown in Figure 13, is the square root of the raised-cosine response described by (16). To calculate the B coefficients required to implement this response in an FIR filter, the square root of (23) is first calculated. The Inverse Fourier Transform of the response is then used to generate the time-domain representation of the filter transfer function (the impulse response of the filter). In an FIR filter, the impulse response of the filter corresponds directly to the filter coefficients. Therefore, obtaining the coefficients requires merely shifting the impulse response in time to obtain a linear-phase version of the filter, and then sampling the impulse response at the system sampling rate. After the filter coefficients are obtained, implementation of the filter digitally in the TMS32010 is accomplished by directly translating the signal flowgraph of Figure 14 into assembly language code. As shown in Figure 14, the output of the filter is defined to be the sum of each of the delayed versions of the input, mJ.lltiplied by the appropriate coefficient. In the TMS3201O, the delayed versions of the previous input samples are stored in a table with the oldest sample stored at the highest address and the newest sample stored at the lowest address. In the TMS32010 implementation, the transmit filters are arranged in a somewhat different manner from that which is commonly used for digital filters. In many digital filters, the input sample rate is the same as the output sample rate. In the transmit filters, however, the input sample rate is reduced because the rate of change of the information 248 Theory and Implementation ofa Splitband Modem Using the TMS32010 entering the filter is known to be slower than the filter sample rate. Filters of this type are known as interpolating filters, and the ratio of the output sample rate to the input sample rate is referred to as the interpolation factor. In the modem transmit filters, the input sample rate is 600 Hz (the baud rate), and the output sample rate is 9.6 kHz, resulting in an interpolation factor of 16. As a result, the input of the filter is updated only after every 16 output samples, and is zero otherwise. Thus, the effective input a(nTs) to the transmit filters can be described for the I channel as for n 0, ± L, ± 2L, etc. (24) otherwise and for the Q channel as for n 0, ± L, ± 2L, etc. (25) otherwise This technique reduces the number of multiplications required to compute the filter output from N to NIL where N is the length of the filter and L is the interpolation factor. In both the transmit and receive filters, sampling of the nonzero portion of the filter impulse response at the system sample rate results in only 37 taps required for proper implementation of the filters. However, since the transmit filters are interpolating filters with an interpolation factor of 16, 16 taps are processed for each sample of the input. As a result, the number of taps in the filter must be an integer multiple of 16. In this case, 48 actual taps are used. With a 48-tap filter and an interpolation factor of 16, only three multiplies are required to calculate the output of the filter. Because of this, these filters are coded on the TMS32010 somewhat differently than FIR filters that are not interpolated. In most filters, the data is shifted each time a sample is processed. With interpolation, the data is shifted only when a new input is processed, i.e., every 16 samples. During the remaining samples (when a new input is not being received), instead of shifting the data, a pointer (XPTR) is shifted through the table of coefficients so that effectively the coefficients are shifted. Thus, the complete filter output can be calculated with the following short section of code: Theory and Implementation of a Splitband Modem Using the TMS32010 249 ZAC LT MPY LTD MPY LTD MPY APAC SACH XIBUF2 CX2 XIBUFl CXl XIBUFO CXO XIOUT,1 * .CLEAR ACCUMULATOR * LOAD OLDEST SAMPLE * MPY BY COEFF 2 * LOAD NEXT SAMPLE * MPY BY COEFF 1 * LOAD NEWEST SAMP;LE \ * MPY BY COEFF 0 * MAKE FINAL SUM * STORE OUTPUT This code calculates the output of the I channel filter when a new input sample is being processed. The code that implements the filter output calculation when a new sample is not being input is similar to this code except that LTA instructions are used in place of LTD instructions. . During samples in which new inputs are being received, the inputs and the coefficients are shifted. This results in savings in data RAM space since only three data values must be stored. Receive Filters The receiver bandpass filters are implemented using 37-tap FIR structures, which also exhibit a raised-cosine frequency response characteristic. These filters are virtually identical in structure to the transmit lowpass filters, with the exceptions that the cutoff frequencies are different and the rec~ive bandpass filters do not interpolate since the input and ouput sample rates are the same. Like the transmit lowpass filters, the actual response implemented in these filters is the square root of the raised-cosine response since this response is split equally between the transmit and receive sections. The receive filters are centered around the carrier frequency fc (1200 Hz for originate and 2400 Hz for answer), and roll off smoothly to approximately - 40 dB at fc ± 600 Hz. The frequency response characteristic of these filters is shown in Figure 15. 250 Theory and Implementation of a Splitband Modem Using the TMS32010 12 2 / \ -8 / -18 I 1/1 .... w co (j w 0 -28 A- I , ~ w 0 ::I I- -38 2 CI c( :!: \, ~ 1'1 1\ 1\/ I I If' AI (\ "I, "A J -48 I ~"I -58 -68 o 0.5 1.5 2 2.5 3 3.5 4 4.5 5 FREQUENCY IN KILOHERTZ Figure 15. Frequency Response of Receiver Bandpass Filters Except for the difference in filter order (the number of taps in the filter), the signal flowgraph and transfer function equation for the receive filters are identical to those of the transmit lowpass filters shown in Figure 13 and described by equation (22), respectively. Besides being similar in structure to the transmit lowpass filters, the receive filters are actually designed directly from the transmit filters by simply shifting the filters' center frequencies. This is possible because the bandwidth of the transmit filters is the same as that required for the receive filters, and the transmit filters exhibit the raised-cosine response also required for the receive filters. In order to generate the proper coefficients to implement the receive filters, the coefficients of the transmit filter are mUltiplied by a sine wave to obtain the I channel coefficients and by a cosine wave to obtain the Q channel coefficients. Specifically, if h(nT s) are the transmit filter coefficients, the receive filter coefficients hI (nTs)and h2(nT s) are obtained by Theory and Implementation of a Splitband Modem Using the TMS32010 251 2 h(nT s) cos(nwT s) (I channel) 2 h(nT s) sin(nwTs) (Q channel) (26) where T s is the sampling period. Note that the factor of two must be included for the original frequency spectrum to be translated to the new frequency with the same magnitude. The result of multiplying the transmit filter coefficients by sine and cosine is to effectively modulate their frequency response characteristics by a carrier at the frequency of the sine and cosine waves. This translates the frequency spectrum of the resultant filter up in frequency to a point centered around the frequency ofthe modulating signal, which is precisely what is required for the receive bandpass filters. Accordingly, bandpass filters for the originate mode are multiplied by sine and cosine functions at 1200 Hz and those for the answer mode are multiplied by sine and cosine functions at 2400 Hz, thus yielding the exact filters required. In addition to shifting the frequency spectrum of the filters to the appropriate center frequencies, the fact that the I channel filter is multiplied by a sine function and the Q by a cosine function results in another important characteristic of these filters; the outputs of these filters are exactly 90 degrees out of phase with respect to each other. This provides a convenient method for implementing the phase shift required for proper demodulation of the I and Q channels. Also, since the filters are symmetric FIR structures, their phase response is linear, and the difference in phase shift between the two filters is precisely 90 degrees. This is beneficial because deviations from a precise 90-degree phase shift can cause serious distortion in other parts of the modem receiver. In a direct implementation of this type of filter on the TMS3201O, the filter output is calculated by repeatedly using the following two-instruction sequence: LTD MPY * LOAD T, ACCUMULATE, DATA SHIFT * MULTIPLY BY NEW COEFFICIENT This sequence performs the following four operations: 1. Loads the T register with the input value, 2. MUltiplies the input value by the appropriate coefficient, 3. Adds the product to the accumulator, and 4. Shifts the input data one place in the table, making room for the next input sample. For FIR filters, a sequence of pairs of the LTD and MPY instructions is all that is required to implement the complete filter. In the TMS3201O, the receive filters are implemented in a somewhat more conventional manner than the transmit filters. The receive filters do not interpolate;. however, due to careful choice of sample points on the impulse response, every second 252 Theory and Implementation of a Splitband Modem Using the TMS32010 coefficient in each filter is zero, reducing by a factor of two the number of LTD/MPY instruction pairs that must be executed to calculate the filter output. Another feature of the FIR structure, which simplifies the implementation of these filters, is that since there is no feedback, the delay path (x(n -1), x(n - 2), ... , in Figure 14) for the two filters contains the same values for input samples in data RAM. Because of this, the same delay path can be used for both the I and the Q channel filters. This reduces by a factor of two the RAM required for data storage. As a result, the code that implements the I channel filter (processed first) uses LTA instructions instead of LTDs, performing no shift of the input data table within memory. A one-position shift of the data table is then performed when the Q channel filter output is calculated. Even though every other coefficient is zero, each sample in the delay table must still be shifted by one memory location during each pass through the filter. Since the Q channel filter performs this shifting but only operates on every second data point, an additional DMOV instruction is coded between each LTD/MPY instruction pair in order to shift the even-numbered data table entries. The assembly code that implements the Q channel bandpass filter is shown below. * * * FIRST (Nth) TAP SETS UP FOR REST OF FILTER RBUF35 RBUF35 QCF35 RBUF34 * CLEAR ACCUMULATOR * LOAD T REGISTER * SHIFT OLD VALUE * MPY BY COEFFICIENT * PERFORM EXTRA SHIFT RBUF33 QCF33 RBUF32 * LOAD T, ACCUMULATE, DATA SHIFT * MULTIPLY BY COEFFICIENT * PERFORM EXTRA SHIFT LTD MPYK DMOV RBUFI QCFl RBUFO * LOAD T, ACCUMULATE, DATA SHIFT * MULTIPLY BY COEFFICIENT * PERFORM EXTRA SHIFT APAC SACH QSUM,4 * ADD LAST SUM * STORE FILTER OUTPUT ZAC LT DMOV MPYK DMOV * * * SECOND TAP * * * LAST TAP * LTD MPYK DMOV Theory and Implementation of a Splitband Modem Using the TMS320lO 253 Automatic Gain Control Implementation To better control the signal strength of the receiver, a software Automatic Gain Control (AGe) algorithm was added. The need of an AGC stems from the use of thresholds in both the carrier recovery and clock recovery algorithms. For increased performance, these thresholds (discussed in the following two subsectiqns) must remain valid (unchanged) for different levels of the incoming signal. This is achieved with the use of the software AGC. The arrangement of the AGC with respect to the other functional blocks of the modem receiver was shown in Figure 5. The AGC monitors the I channel of the receiver and calculates a gail]. correction factor. Both the I and Q channels are then multiplied by this gain correction factor so that the signal maxima remain within a certain range. This range is narrow compared to the range of the incoming signal maxima. The peak-to-peak voltage of the incoming signal is between 2 mV and 700 mY. In 16-bit hexadecimal Q15 format, 15 this range is from >5C to >5999. However, with the use of the software AGe, the signal maxima are in the range 780 mV (>6400) to 820 mV (>6900). The gain corr~ction factor is calculated once every three bauds by a two-step process. First, the three maximum values of the signal (BSMAX), each one corresponding to one baud (16 samples), are monitored and added to each other. A counter (AGCNT) is used to keep the count of the signal maxima. The previous running average is then added to this sum, and the result is divided by four to obtain the new running average (AGCRA). The division by four is accomplished by shifting the final sum, contained in the accumulator, two locations to the right before storing it in the memory as the new running average . (AGCRA). The section of code that implements this step is listed below. * * * * DETECT MAX SIGNAL STRENGTH OF I CHANNEL PER BAUD (THIS CODE IS EXECUTED EVERY CYCLE) AGCAL * * * EQU LAC ABS SUB BLZ ADD SACL $ ISUM BSMAX OVRMAX BSMAX BSMAX * AGC VALUE CALCULATED USING ISUM * GET MAGNITUDE OF SIGNAL * COMPARE TO PREVIOJjS MAX VALUE * IF LESS THAN, THEN SKIP UPDATE * RESTORE VALUE AND * STORE AS NEW MAX MULTIPLY I AND Q CHANNELS BY AGC FACTOR OVRMAX 254 Theory and Implementation ola Splitband Modem Using the TMS32010 * * * UPDATE THE RUNNING AVERAGE ONCE EVERY THREE BAUDS (THIS CODE IS EXECUTED ONCE EVERY BAUD) '" AGCUPT OVROUT ZALH ADD SACH LAC SUB SACL SACH BZ RET LACK SACL LAC SACL LAC SACH AGCRA BSMAX,14 AGCRA AGCNT ONE AGCNT BSMAX OVROUT 3 AGeNT AGeRA AGCLEV AGCRA,14 AGCRA * ADD THE NEW BSMAX VALUE * TO THE RUNNING AVERAGE * AND SAVE IT * DECREMENT RUNNING AVERAGE * SAVE IT AND * CHECK FOR ZERO * ZERO OUT RUNNING SIGNAL MAX * IF ZERO, THEN UPDATE AGC * ELSE RETURN TO CALLING SEQUENCE * RESET RUNNING AVERAGE COUNT * TO THREE * MOVE AGCRA * TO THE CALCULATION LEVEL * DIVIDE RUNNING AVERAGE SUM * BY 4 TO GET NEW RUNNING AVERAGE At the second step, the gain correction factor (AGC) is calculated, based on the running average. A brute force approach is to divide the maximum-allowed signal level by the running average and obtain the gain correction factor as the result of this division. The maximum value of the product of the signal times the gain correction factor should then remain close to the maximum-allowed signal level. However, since divisions are costly in processing time, the second step is implemented by using the running average as an index (AGCLEV) to a 32-word lookup table. The offset to this table (AGCOFF) is added to the index (AGCLEV) to calculate the table entry on which the gain correction factor (AGC) is located. The TBLR instruction is then used to transfer the gain correction factor from program memory to data memory. To lessen the code space required to handle the AGC lookup table, the code uses only the six most significant bits of the running average. This requires a 64-word lookup table. However, since the most significant bit of the six bits is always one, only 32 entries of the table are needed. The gain correction factor, obtained by the table lookup, is shifted so that the product of the gain correction factor times the incoming signal is in Q14 format (designer's choice). The shift factor is provided by the BASIC program used to generate the AGC lookup table (see Appendix C). The TMS32010 code that implements the calculation of the gain correction factor is shown below. LAC SUB BLZ LAC SACH AGCLEV ONE, 14 ASHFI AGCLEV,7 TEMP * GET AVERAGE MAX SIGNAL LEVEL * COMPARE TO 16384 * IF LESS THAN SHIFT TABLE LOOKUP * GET LOOKUP VALUE * MOVE LOOKUP VALUE TO Theory and Implementation of a Splitband Modem Using the TMS32010 255 ASHFI ASHF2 ASHF6 LAC ADD TBLR LAC SACH RET ADD BLZ LAC,· SACH LAC ADD TBLR RET ADD BLZ LAC SACH LAC ADD TBLR LAC SACL RET ADD BLZ LAC SACH LAC ADD TBLR LAC SACL RET TEMP AGCOFF AGC AGC,I5 AGC ONE,13 ASHF2 AGCLEV,8 TEMP TEMP AGCOFF AGC ONE,I2 ASHF3 AGCLEV,9 TEMP TEMP AGCOFF AGC AGC,I AGC ONE,5 NOEDT AGCLEV,13 TEMP TEMP AGCOFF AGC AGC,5 AGC * * * * * * * * * * * * * * * * * * * * * * * * THE LOW HALF OF THE ACC ADD IN TABLE OFFSET AND GET AGC VALUE DIVIDE THE. AGC VALUE BY 2 TO FORCE TO QI4 MODE RETURN TO CALLING SEQUENCE COMPARE TO 8192 IF LESS THAN SHIFT TABLE LOOKUP GET LOOKUP VALUE MOVE LOOKUP VALUE TO THE LOW HALF OF THE Ace ADD IN TABLE OFFSET AND GET AGC VALUE RETURN TO CALLING SEQUENCE COMPARE TO 4096 IF LESS THAN SHIFT TABLE LOOKUP GET LOOKUP VALUE MOVE LOOKUP VALUE TO THE LOW HALF OF THE ACC ADD IN TABLE OFFSET AND GET AGC VALUE AGC VALUE*2 TO ADJUST fOR LOWER SIGNAL STRENGTH RETURN TO CALLING SEQUENCE * * * * * * * * * * COMPARE TO 32 LOST MINIMUM ENERGY LEVEL GET LOOKUP VALUE MOVE LOOKUP VALUE TO THE LOW HALF OF THE ACC ADD IN TABLE OFFSET AND GET AGC VALUE AGC VALUE*32 TO ADJUST FOR LOWER SIGNAL STRENGTH RETURN TO CALLING SEQUENCE The AGC table was generated by the BASIC program listed in Appendix C. This program is written to execute on any MS-DOS operating system. The program prompts the user for the table size and gain range factor, and then generates and stores the AGC table. The table is stored in a format that allows insertion directly into the user's code. 256 Theory and Implementation of a Splirband Modem Using the TMS32010 Carrier Recovery Implementation The carrier recovery is implemented with a phase-locked loop, as explained in the Modem Receiver subsection. In Figure 8, the functional blocks that must be digitally implemented are the phase detector, loop filter, and Voltage Controlled Oscillator (VCO). Phase Detector In the middle of each baud, the phase detector block calculates an equation equivalent to (8), repeated below for convenience, E(nTb) = Q(nTb) I'(nTb) - i(nTb) Q'(nTb) where I' (REel) and Q' (RECQ) are the baseband (demodulated) I and Q channels, and i and Q are the I and Q channel decisions. The derivation of the equivalent equation to (8) is discussed next. In Figure 9, the I channel decision for constellation point A is the length of the projection of the vector OA on the I axis. Similarly, the Q channel decision for constellation point A is the length of the projection of the vector OA on the Q axis. Since the four constellation points A, B, C, and D are located on the 45 and -45 degree lines, the lengths of these projections are the same. With this common length denoted by L, the I channel decisions can be expressed as A { + L for points A and B l(nTb) = (27) - L for points C and D The value of L depends on the radius of the cirCle on which the four constellation points are located. Equation (27) can equivalently be expressed as (28) where sgn is the sign function defined as sgn(I'(nTb» +1 if I'(nTb) > 0 (points A and B) -1 if {'(nTb) < 0 (points C and = { (29) D) Similarly, Q(nTb) = sgn(Q'(nTb» L (30) Substitution of (28) and (30) into (8) gives E(nTb) =L {sgn(Q' (nTb» I' (nTb) - sgn(I'(nTb» Q' (nTb)} (31) Equations (31) and (8) are identical. However, (31) is the final step towards the equation, implemented in the TMS3201O. Since L in (31) is a positive constant, an equivalent error function that contains the phase and frequency information is (32) Theory and Implementation of a Splitband Modem Using the TMS32010 257 Equation (32) is the one implemented in the TMS32010 as part of the carrier recovery algorithm. In this equation, sgn(I') (SIGNI) and sgn(Q') (SIGNQ) are the I and Q channel decisions, respectively. The TMS32010 code used to implement (32) is shown below. * * COMPUTE CARRIER ERROR SIGNAL * * e(t) = RECI*SIGNQ - RECQ*SIGNI * COMERR LT MPY LTP MPY SPAC SACH RECI SIGNQ RECQ SIGNI ERROR,l * * * * * * T=RECI P = RECI*SIGNQ T = RECQ, ACC = RECI*SGNQ P =RECQ*SIGNI ACC = RECI*SIGNQ - RECQ*SIGNI STORE IN ERROR Loop Filter The error signal E'(nTb) (ERROR), generated by the phase detector (equation (32», is filtered by the carrier recovery loop filter (see Figure 8). The filter was implemented as a first-order Infinite Impulse Response structure. In other words, the loop filter is just an integrator with transfer function BI (33) HI(Z) = - - - I-AIZ-I where Al (PLLl) and BI (PLL2) are the filter coefficients. A higher-order filter was not used, because high-order filter structures usually introduce more phase delay than first-order sections. Phase delaysl6 are critical in the operation of a phase-locked loop, and their effects are difficult to analyze. The time-domain equivalent of (33) is y(n) = BI x(n) + Al y(n - 1) (34) where x(n) is the input to the filter and y(n) the output. The signal flowgraph of the carrier recovery loop filter is shown in Figure 16. yIn) Figure 16, Carrier' Recovery Loop Filter 258 Theory and Implementation of a Splitband Modem Using the TMS32010 The TMS3201O, with a hardware on-chip multiplier, is most efficient in the implementation of such filter structures. 13 The code used to implement the carrier recovery loop filter (equation (34» is shown below. The filter's input x(n) is stored in ERROR, and the filter's outputy(n) is stored in ERRSIG. * * LOOP FILTER * LT MPY LTP MPY APAC SACH PLL2 ERROR PLU ERRSIG ERRSIG,1 * * * * * * T=PLL2 P = PLL2*ERROR ACC = PLL2 ERROR, T = PLU P = PLU *ERRSIG ACC = PLL2 *ERROR + PLU *ERRSIG STORE IN ERRSIG The effect of the loop filter's bandwidth in the modem performance is considered in the following discussion where the bandwidth of the loop filter is defined as the frequency at which the magnitude of the filter's transfer function is 3 db below its maximum value. Therefore, the bandwidth of the loop filter is the frequency Wb at which (35) where IHIlmax is the maximum value of the magnitude of the filter's transfer function. Substituting z = ejw in (33) gives { 1 + A 12 - 2A 1 cos(w) } % (36) Equation (36) is maximum when the denominator is minimum. This is true for w=O, i.e., at DC. Substituting w=O in (36) gives I-AI where 0 < Al < 1 (37) Substitution of (36) and (37) into (35) gives the following quadratic equation that relates the bandwidth of the loop filter Wb to the coefficient AI. (38) Therefore, the value of the coefficient A 1 determines the bandwidth of the loop filter. Figure 17 shows a plot of the values of Al versus the bandwidth Wb, i.e., a plot of (38) . .Theory and Implementation of a Splitband Modem Using the TMS3201Q 259 " ------------------~~--------------~A1=1 ", • ••• , . , . , ,.' " 0 • • "0 •• --~~~~------~--~----------~~~---1~Wb 11" Figure 17. Parameter Al vs. the Bandwidth of HI(z) = BI I-AI z-I The two curves in Figure 17 represent the solutions of the quadratic equation (38). From this figure, it can be seen that the closer Al is to unity, the narrower the bandwidth of the filter. If Al = 1; the magnitude response begins rolling off at zero frequency (w =0). However, this situation must be avoided since Al = 1 results in placing a pole on the unit circle in the z-domain, thereby causing the filter to oscillate. Since only values less than unity of the coefficient Al result in a stable filter structure, Q15 format I5 was used to represent AI. The bandwidth Wb is expressed in radians. Since the sampling frequency fb corresponds to 21!' n;tdians, the bandwidth of the loop filter in Hz is given by Bandwidth = Hz (39) Since the loop filter runs once every baud, the sampling frequency fb is 1 fb=-=600Hz Tb with Tb as the baud interval. This frequency should not be confused with the AID and DIA sampling frequency designated by fs and having the value of 9600 Hz. The bandwidth of the loop filter affects the Bit Error Rate (BER) and the time it takes for the modem receiver to lock-on to the incoming carrier. Initially, a large bandwidth results in a fast lock-on while a narrow bandwidth provides a good BER. Therefore, the ability to switch from a large bandwidth to a narrow one results in a better modem design. With the TMS3201O, this is easily implemented using the TBLR instruction that transfers data from program memory to data memory,15 On startup, Al (PLLl) is 0.539 or >4500 in Q15 format. This corresponds to a bandwidth of approximately 63 Hz. Once locked-on with the use of the TBLR instruction, the value of Al (PLLl) is changed to 0.953 or >7AOO in Q15 format. This corresponds to a bandwidth of approximately 6 Hz. Lock-on criterion is based on the magnitude of the error function 260 Theory and Implementation of a SplitbandModem Using the TMS32010 calculated by (32) being less than a certain threshold. The need and calculation of this threshold is covered later in this subsection. The TMS32010 code used to switch the loop filter's bandwidth is given below. The fifth bit of RECST is used as a flag, which if set indicates that the local carrier is locked-on to the incoming carrier. LAC AND BNZ B * CARLCK LACK TBLR ONE,4 RECST CARLCK NORMAL * * * * CHECK IF LOCAL CARRIER IS LOCKED. IF SO, SWITCH PLL FILTERS' BANDWIDTH EXECUTE NORMAL SEQUENCE PLLC PLU * CHANGE CARRIER PLL COEF. 1 Voltage-Controlled Oscillator Both the carrier used in the transmitter to modulate the data and the one used in the receiver for the demodulation (local carrier) were implemented in the TMS32010 using a 128-point sine table and a routine to drive it. 17 The voltage-controlled oscillator in the phase-locked loop for the carrier recovery generates the local carrier using this 128-point sine table. The frequency of this digital sine wave is 2400 Hz for an originate modem and 1200 Hz for an answer modem. Carrier Recovery Threshold The lowpass-filtered value of the error signal generated by the phase detector contains the information about the phase and frequency difference between the local and incoming carriers. If this value (ERRSIG) is positive, the local carrier must be advanced in phase. If negative, the local carrier must be delayed (see the Modem Receiver subsection). Since there are 128 points in the sine table, there is a 360/128 or 2.8125-degree jump going from one table entry to the next. This implies that corrections should not be made unless the magnitude of the error signal is greater than one table entry because redundant corrections introduce inaccuracies and noise. Therefore, the value of this threshold should correspond to the magnitude of the error signal when there is a 2. 8125-degree phase error. An estimate of the threshold can be obtained as described below. The relation of the phase error signal E(nTb) to the phase error Be is given by (18). Substituting 2.8125 for Be in (18) and taking the magnitude of both sides gives (40) IE(nTb) I = IK sin(2.8125)1 K (1 2 + Q2) is the signal energy, i.e., the maximum value of the I and Q channels. This value is set by the Automatic Gain Control. Since the software AGC used in this implementation of the Bell 212AIV.22 limits the signal maxima between 0.78 and 0.82 (see Automatic Gain Control Implementation in the Modem Receiver subsection), K is between 0.78 and 0.82. Using the average value of 0.80 for K, (40) gives IE(nTb) I = 0.039. Theory and Implementation of a Splitband Modem Using the TMS3201 a 261 The threshold level should be at 0.039 if the gain of the loop filter given by (33) is unity. For DC, the gain GI of the loop filter is given by (37), repeated below for convenience. GI = IHllmax = BI where 0 I-AI < AI < 1 The coefficient BI (PLL2) was chosen to be 0.0039 (or >50 in the Q15 format). As explained earlier, once the receiver is locked, the value of coefficient Al (PLLl) is 0.953. From (37), the gain GI of the loop filter is GI = 0.082. Therefore, the threshold is scaled down to Effective Threshold = 0.039 x 0.082 = 0.0032. This corresponds to > D in Q12, the format used for the threshold (designer's choice). After this initial estimate of the threshold was obtained, the final value of the carrier recovery threshold (TRSHD 1), > 7, was determined by trial and error. The calculated threshold is greater than the one obtained by trial and error, because of the use of the maximum value of the loop filter's gain in the threshold calculation. To improve the lock-on characteristics of the modem, a two-level correction was used for the carrier recovery. If the 'magnitude of the error (ERRSIG) is less than the threshold (TRSHDI), no correction is applied. If the magnitude of the error is greater than the threshold but less than twice the threshold, one sine-table entry correction is applied by incrementing or decrementing the table entry pointer (RALPHA) by one. If the magnitude of the error is greater than twice the threshold value, then a two-table entry correction is applied by incrementing or decrementing the table entry pointer (RALPHA) by two. All of the corrections are applied to advance or delay the local carrier according to the algorithm described in the Modem Receiver subsection. Baud Clock Alignment Implementation The purpose of the clock recovery is to identify the baud boundaries and inform the decision block when the middle of each baud occurs and there fort< the optimum time to make an errore free decision (see Figure 5). As explained in the Modem Receiver subsection, one approach for clock recovery (adjustment of the baud clock) is to use the energy of the incoming signal. The energy is the sum of the squares of the demodulated I and Q channels (see equation (20)). As implied by (21), this quantity is independent of any phase and/or frequency difference between the incoming and local ~arriers. The minima of the signal energy indicate the beginning of a new baud. This can be seen in Figure 18 where the signal energy is plotted every sample for several consecutive baud intervals. 262 .Theory and Implementation of a Splitband Modem Using the TM~32010 Figure 18. Signal Energy Plotted Every Sample For Several Baud Intervals Each of the short vertical lines along the horizontal axis in Figure 18 corresponds to a sample time. This data was obtained using the XDS/22 emulator for the TMS3201O. The block diagram for the clock recovery algorithm is shown in Figure 19. The functional blocks to be implemented are the error signal generator, loop filter, and baud clock. I' Q' ...- DE CISION BLOCK ERROR SIGNAL GENERATOR eb LOOP FILTER e'b - BAUD CLOCK Figure 19. Baud Clock Alignment Block Diagram Error Signal Generator The error signal generator calculates the signal energy and from it generates an error signal eb. This error signal contains the information about how close the local baud boundaries are to the incoming baud boundariers. The error signal is then lowpass-filtered so that noise and high-frequency components are removed. The output of the loop filter corrects the local baud clock. The critical issue is how to calculate this error signal. Figure 20 shows the signal energy for a single baud interval. This figure was motivated from the realtime data of Figure 18. The 16 energy samples for this baud are indicated as E(0),E(1), ... ,E(15). Theory and Implementation of a Splitband Modem Using the TMS32010 263 EI61 EI71 EI81 EI51 ... e,... - EI91 EI41 ••.•. • e..• E(101 EI31 ••• •• > EI2I,"" C1 t "', E(11) \. EI121 II: w Z w EI1 I II' EIOI .. •· ". EI131 .... EI141 '. EI151 '. TIME Figure 20. Signal Energy Samples over a Baud From Figure 20, it can be seen that the energy sample E(7) is located at the middle of the baud (top of the 'energy hill'), and the rest ofthe saniples are located symmetrically around it, i.e., E(6) = E(8), E(5) = E(9) , and so on. Therefore, E(7) is taken to be the middle of the local baud. Consider now the difference between the energy sample E(11) that is four samples after E(7) and the energy sample E(3) that is four samples before E(7). If the local baud clock is correctly aligned so that E(7) corresponds to the middle of the incoming baud, then E(ll) - E(3) = 0. If E(11) - E(3) > 0, then the sample E(7) is located to the left of the middle of the baud. This means that the middle of the local baud Occurred earlier than the middle of the incoming baud. Therefore, the local baud clock must be delayed. On the other hand, if E(11) - E(3) < 0, the middle of the local baud occurred later than the middle of the incoming baud. Therefore, the local baud dock must be advanced. In summary, the error signal generator computes the signal energy at sample points 3 (PENRGY) and 11 (ENRGY). The sample count information (SAMPLE) is provided by the baud clock shown in Figure 19. The error signal generator then calculates the error signal eb (BERROR) defined by eb = (41) E(II) - E(3) The subscript b represents baud since this signal is calculated once every baud. 264 Theory and Implementation of a Splitband Modem Using the TMS32010 Loop Filter Perturbations that may occur in the communications medium pass onto the demodulated I and Q channels. This can be seen from the data of Figure 18 where even with the presence of the automatic gain control, the energy levels are not exactly the same for every baud. Also, the duration of each baud in Figure 18 is not exactly sixteen samples (sixteen short vertical lines) as it theoretically should be. These perturbations result 'in abrupt changes of the signal generated by the error signal generator. Therefore, the error signal is not directly fed into the baud clock. Instead, it is lowpass-filtered by the loop filter. This removes noise and high-frequency components and results in a stable clock recovery. The loop filter was implemented as a first-order recursive filter. The 'transfer function is of the same form as (33). B2 H2(z) = (42) l-A2 z-l Just as with the loop filter used for the carrier recovery, the most important characteristic of the loop filter used for the clock recovery is its bandwidth. A wide bandwidth results in a quick adjustment of the local baud boundaries to the incoming baud boundaries. A narrow bandwidth results ifi a more stable clock recovery. A good approach for this filter's design is to start with a wide bandwidth and then switch to a narrow one. All of the information provided in the Carrier Recovery Implementation subsection relating the coefficient Al to the loop filter's bandwidth apply here as well. With the use of the TBLR instruction, after the receiver is locked-on to the incoming carrier, the initial wide bandwidth is switched to a narrow one. The initial value of A2 is 0.5, which is >4000 in Q15 format and corresponds to approximately a 70-Hz bandwidth. After the receiver is locked, this value changes to 0.91 (> 7500 in Q15 format), which corresponds to a bandwidth of approximately 10 Hz. The criterion used for the receiver being locked-on is the magnitude of the error function calculated by (32) being less than the threshold used for the carrier recovery (TRSHD 1). Baud Clock The output of the loop filter, designated by e'b in Figure 19, drives the local baud clock. The baud clock tracks the sample count (SAMPLE) and thus informs: 1. The decision block when it is the middle of the baud (sample 7) and thus the optimum time for demodulation, and 2. The error signal generator when the sample count is 3 and 11 so that the error signal eb can be calculated. Theory and Implementation of a Splitband Modem Using the TMS3Z010 265 These two objectives are achieved with the use of a 16-entry table in the program memory. Each table entry contains the address of a subroutine task to be performed between two consecutive samples. The tasks are numbered 0, 1, ... , 15. Table 6 shows the memory map of the 16 tasks performed by the modem receiver. Table 6. Memory Map of Tasks Performed by the Modem Receiver * "* * * TASK MASTER SEQUENCE TABLE (RECEIVE) TASKS ARE EXECUTED FROM BOTTOM TO TOP TSKSEQ EQU DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA $ DUMMY DUMMY DUMMY DUMMY BDCLK2 DUMMY OUT DECODE DEMODB DUMMY AGCUPT DUMMY BDCLK1 DUMMY DUMMY DUMMY * UNUSED CYCLE 15 14 * UNUSED CYCLE * UNUSED CYCLE 13 12 * UNUSED CYCLE * COMPUTE ENERGY E(11) 11 * UNUSED CYCLE 10 * COMMUNICATE WITH TMS7742 9 * DECODE/GET SCRAMBLED DIBIT 8 * DEMODULATE IN MIDDLE OF BAUD 7 6· * UNUSED CYCLE * UPDATE THE AGC EVERY 3RD BAUD 5 4 * UNUSED CYCLE * COMPUTE ENERGY E(3) 3 2 * UNUSED CYCLE 1 * UNUSED CYCLE * UNUSED CYCLE 0 Task 3 (BDCLK1) calculates the signal energy E(3) (PENRGY). Task 5 updates (once every three bauds) the automatic gain control value. Task 7 (DEMODB) implements the demodulation in the middle of the baud. Task 8 (DECODE) makes the channel decisions based on the demodulated (from Task 7) I and Q values, and decodes the decisions to obtain the scrambled dibits. Task 9 (OUT) performs the data exchange between the TMS32010 and the TMS7742. Task 11 calculates the signal energy E(ll) (ENRGY). The TMS32010 code used to drive the table of the modem receiver tasks is shown below. * * * RECEIVER TASK SEQUENCE DRIVER ROUTINE 266 LAC SUB BGEZ LACK SAMPLE ONE OVRSAM 15 * DECREMENT THE SAMPLE COUNT * TO CHECK FOR END OF BAUD * IF NOT, THEN SKIP COUNT RESET * RESTART THE SAMPLE COUNTER AT 15 Iheory and Implementation of a Splitband Modem Using the TMS32010 OVRSAM SACL LACK ADD TBLR LAC CALA SAMPLE TSKSEQ SAMPLE TEMP TEMP * SAVE NEW COUNT VALUE * GET ADDRESS OF TOP OF TABLE * ADD IN OFFSET * GET THE PROGRAM ADDRESS * FOR THE TASK CALL * EXECUTE THE APPROPRIATE TASK Initially, the sample count (SAMPLE) contains the task number of the previous task performed. This number is decremented so that the next task in the sequence is performed. If the sample count becomes negative, it is reset to 15. The sample count is then added to the address of the top of the task table (TSKSEQ). With the use of the TBLR instruction, the table entry is transferred to the data memory. Each table entry is the address of the subroutine task to be performed. Using the CALA instruction, the equivalent of the 'computed GOTO' used in FORTRAN, the program control transfers to the selected subroutine. For a 9.6-kHz sampling rate, the TMS32010 with a 200-ns cycle time has 512 cycles available to implement each of these tasks. This number of cycles is more than enough since the worst-case task takes approximately 300 cycles. Also, since only 6 out of the 16 tasks are used, 10 more tasks are available for the designer to incorporate additional functions such as an adaptive equalizer, scrambling/descrambling, and synchronous-toasynchronous and asynchronous-to-synchronous conversions. The algorithm of adjusting· the baud clock based on the filtered error signal e'b (BEROUT) is the same as the one described earlier for the unfiltered error signal eb (BERROR), and is summarized below. e'b > 0 delay local baud clock e'b < 0 advance local baud clock (43) The advance or delay of the baud clock is implemented by changing the sample count (SAMPLE) appropriately. In the case of delaying the clock, the middle of the local baud clock (sample 7) occurs earlier than the middle of the incoming baud. Geometrically, sample 7 is located on the left side of the 'energy hill' of Figure 20 instead of at the top. If the sample count does not change, then 16 samples later, sample 7 of the next local baud will again be located on the left side of the 'energy hill' of the next incoming baud. Therefore, the sample count must be decremented by one. Instead of 16 samples, the middle of the next baud is taken to be 17 samples later. Hopefully then, the middle of the local baud is on or at least closer to the top of the 'energy hill.' The case of advancing the clock is similar, except that the sample count is incremented by one, and thus the middle of the next baud is taken 15 samples after the middle of the current baud. Clock Recove~ ThreshoLd One more issue, the clock recovery threshold, is associated with the alignment of the baud clock. Since there is a finite number of samples in each baud interval, the Theory and Implementation of a Splitband Modem Using the TMS32010 267 baud clock has a finite resolution. Therefore, if the middle of the local baud (sample 7) is within one sample of the middle of the incoming baud, no correction must be applied. A threshold can be used so that corrections are applied only if the magnitude of the filtered error signal is greater than the threshold value. An initial estimate of this threshold is obtained by computing the magnitude of the error signal that corresponds to a one-sample change in the local baud clock. Consider the effect of a one-sample change in Figure 20. The middle of the local baud clock E(7) is translated to E(6) (or E(8)); E(3) is translated to E(2) (or E(4)); and E(11) is to E(10) (or E(12)). Therefore, a one sample change results in an error signal eb given by (41) of magnitude () as indicated in Figure 20. Approximating the 'energy hill' with the positive half of a sine wave (see Figure 20), results in () = 0.12. This would be the threshold if the gain of the clock recovery loop filter were unity. For DC, the gain of this filter is (see equation (37)) G2 = IH21max B2 = 1-A2 where 0 < A2 < 1 The value chosen for the coefficient B2 (BPLL2) is 0.0024 or '>50 in Q15 format. After the receiver is locked-on to the incoming carrier, the coefficient A2 (BPLLl) is 0.91. The gain G2 of the loop filter is computed to be G2 = 0.026. The gain G2 results in an 'effective threshold' of () = 0.00312. This corresponds to >33 in Q14 format used for the clock recovery threshold by designer's choice. However, this is just an initial estimate since the mathematical model used is only an approximation. After this estimate was obtained, the final value of the clock recovery threshold (TRSHD2), > 8, was determined by trial and error. The calculation of the thresholds for both the clock and carrier recoveries was performed based on the DC gain of the loop filters. A reason why the calculated thresholds are greater than thoseobtained by trial and error is that the filter gain is maximum at DC. Just as in the carrier recovery, a two-level correction is used for the baud clock. If the magnitude of the error signal is less than the threshold, no correction is applied. If the magnitude of the error signal (BERROUT) is greater than the threshold (TRSHD2) but less than twice the threshold, the baud clock is advanced or delayed by one sample. If the magnitude of the error is greater than twice the threshold, then the baud clock is adjusted by two samples. Functions Implemented in the TMS7742 The Texas Instruments TMS7742 is a microcomputer with an on-chip UART and 4K bytes of internal EPROM. It was included in the modem design to increase its flexibility and upgradability. With the use of the TMS7742, both serial and parallel interfaces with the DTE can be efficiently implemented. The TMS7742 can also perform some of the modem functions, thus allowing the TMS32010 to do more complicated tasks. This flexibility allows the hardware design to be upgradable to 2400-bps splitband modems 268 Theory and Implementation of a Splitband Modem Using the TMS32010 (V.22 bis). The TMS7742 acts as a modem controller and performs the asynchronous-tosynchronous and synchronous-to-asynchronous data conversions. It also scrambles the data from the DTE and descrambles the decoded dibits received from the TMS32010 before sending them to the DTE. The TMS7742 code is given in Appendix E. Asynchronous-to-Synchronous and Synchronous-to-Asynchronous Conversions Asynchronous data received from the DTE may include a start bit, seven or eight data bits, and one or more stop bits. When the DTE is not sending any data, the modem must still continue to transmit scrambled marks. Even though the DTE can send faster than 1200 bits per second, the modem must transmit only 1200 bits per second to the teiephone line. This means that the modem must delete some of the bits received from the DTE. The Bell 212A protocol permits deleting one stop bit every nine characters. The data received from the TMS32010 demodulator may have characters with a deleted stop bit. The TMS7742 must detect the deleted stop bit and add it to the character before sending it to the DTE. The TMS7742 assembles the descrambled dibits into a character, checks for missing stop bits, and adds the missing stop bit if detected. The speed of the DART is set to enable inserting one stop bit in every nine characters; i.e., when transmitting 10 bits per character, adding one bit in nine characters (a total of90 bits) should not change the speed. Thus, the DART is set to 1I90th of a bit interval faster. Scrambler/Descrambler The data that has been converted into synchronous dibits is scrambled using equation (2), which is repeated below. ds(n) = d(n) XOR ds(n - 14) XOR ds(n - 17) The TMS7742 holds the previous 17 scrambler outputs in its internal registers and uses the XOR instruction to exclusively-OR the proper bits to generate the new scrambled output. After scrambling each bit, these registers are shifted by one and saved to provide the (n - 7) outputs for the next bit. A similar routine is used to descramble the decoded data received from the TMS3201O. The descrambling is performed using equation (3) repeated below. d(n) = ds(n) XOR ds(n - 14) XOR ds(n - 17) Performance The performance of the modem implemented using the TMS32010 was evaluated using automatic modem testing equipment. A block diagram of this testing equipment is shown in Figure 21. Theory and Implementation of a Splitband Modem Using the TMS32010 269 MODEM UNDER TEST AC LINE ,------------------I : AC LINE CENTRAL OFFICE SIMULATOR REFERENCE MODEM (BELL 212A) I I I ATTENUATOR "'-- II ATTENUATOR AVERAGE LONG·HAUL LINE r-- f ATTENUATOR WHITE·NOISE GENERATOR DIGITAL DATA PATTERN GENERATOR BLOCK ERROR COMPUTATION (TIPC) DIGITAL DATA Figure 21. Modem Testing Equipment The testing environment in Figure 21 provides a Central Office simulator, an average long-haul line simulator, and a C-notched white-noise generator. The attenuators provide'signal-Ievel and noise-level attenuation. The testing is performed under full-duplex and maximum data throughput conditions. The average long-haul line effects are evident from the differences between the signal constellation diagrams of Figures 22(a) and 22(b). Figure 22(a) shows the signal constellation with the TMS32010 modem in the analog loop-back mode. Figure 22(b) shows the signal constellation with the TMS32910 modem operating over an average long-haul line at a 14-db signal-to-noise ratio. The presence of the average long-haul line results in a 'spreading' of the signal constellation points. this spreading implies a higher probability of error since the signal points used to make the decisions approach the decision boundaries. 270 Theory and Implementation of a Splitband Modem Using the TMS32010 Q la) SIGNAL CONSTELLATION IN ANALOG LOOP-BACK MODE Q •• Ib) SIGNAL CONSTELLATION OVER AVERAGE LONG-HAUL LINE Figure 22. Signal Constellation Diagrams Referring to Figure 21, the Texas Instruments Professional Computer generates random characters. These characters are sent to the reference modem and the modem under testing. The modems transmit the characters they receive to each other, and each modem sends the characters received to the Professional Computer. The computer then compares the received characters with the ones originally created to determine the error rate. The error rate is determined in terms of percent error-free blocks. Each block consists of 512 characters (5120 bits) and is considered to be error-free only if all of the bits in the block are received with no error. In all the tests performed, the Bell 212A modem was the reference modem configured in the answer mode. The reason for this is that only an originate Theory and Implementation of a Splitband Modem Using the TMS32010 271 TMS3201O-based modem is implemented. The answer mode is not included because, its mentioned in the "Introduction," this is beyond the purpose Of this report. To incorporate the answer mode, two tables must be added in the TMS32010 code presented in Appendix D. The first table should contain the coefficients of the two receiver input bandpass filters with a passband centered around 1200 Hz. The second table Should contain the increments used by the sine-table driver routine so that a 2400-Hz carrier is generated for the transmitter and a 1200-Hz carrier is generated for the receiver. When the TMS7742 configures the TMS32010 in the answer mode, the filter coefficients and the sine-table increments can be transferred from the program memory to the data memory with the use of the TBLR instruction. No performance difference is expected between the answer and originate modes. In Figure 23, the vertical axis indicates the percentage of blocks received error-free and the horizontal axis is the signal-to-noise ratio in db .. The percentage of error-free blocks is calculated at each signal-to-noise ratio level (30, 29, 28, ... ) based on the number of error-free blocks received out of 1024 transmitted. All tests were performed at a - 26 dbm (0.1 V) signal level. Figure 23(a) shows the test results with the TMS320 10-based modem as the modem under testing. The vertical axis of Figure 23(a) is the percentage of blocks received error-free by the Bell modem. Figure 23(b) shows the results when the AT&T Dataphone II is used instead of the TMS32010-based modem. Since the Bell modem is used as a reference modem, the above results indicate how well the transmitters of the TMS3201O-based modem and the AT&T modem are performing. From Figures 23(a) and 23(b), it can be seen that for both the TMS32010 and AT&T modems, block errors start occurring at a signal-to-noise ratio of approximately 13 db and that the curve corresponding to the TMS32010 modem falls slightly faster. Therefore, the performance of both modem transmitters is approximately the same with the AT&T transmitter performing slightly better than the TMS32010 transmitter. Figure 24(a) shows the percentage of blocks received error-free by the TMS3201O-based modem. The·Bell modem (reference modem) is used to transmit these blocks. Figure 24(b) shows the percentage of blocks received error-free by the AT&T modem with the Bell modem transmitting. It can be seen that the AT&T receiver performs approximately 2 db better than the TMS32010 receiver. The performance of the TMS32010 modem receiver could be improved with the inclusion of more filter taps in the receiver input bandpass filters. 272 Theory and Implementation of a Splitband Modem Using the TMS32010 30 20 25 15 10 5 o III ~ Ii: ~ 90 90 80 OVER AVG LINE AT 1200 8PS -26 dBM II: III fil 80 70 70 1rl 60 II: 60 '" 50 g .... 50 40 40 30 30 20 20 10 10 > iii '"ou. III CI ~ III ri! ... III 30 25 20 15 10 5 o SIGNAl/C-NOTCHEO· NOISE RATIO (a) PERCENTAGE OF BLOCKS RECEIVED ERROR-FREE BY THE BELL 212A MODEM VS. SNR WITH THE TMS32010 MODEM ORIGINATING 30 ~ IL 25 20 15 10 5 o 90 90 Ii: ~ III 80 OVER A VG LINE AT 1200 BPS -26 dBM 80 Q ~ 70 70 60 60 50 50 40 40 30 30 20 20 10 10 III U ::! :t.l u 9 '":!i III CI ;: 2 III ri! ~ 30 25 20 15 10 5 o SIGNAl/C·NOTCHED NOISE RATIO (b) PERCENTAGE OF BLOCKS RECEIVED ERROR-FREE BY THE BELL 212A MODEM VS. SNR WITH THE AT&T MODEM ORIGINATING Figure 23. Performance of TMS32010 and AT&T Modem Transmitters Theory and Implementation of a SplitbandModem Using the TMS3201Q 273 30 25 20 15 10 5 o 90 90 OVER AVG LINE AT 1200 BPS -26 dBM 80 80 70 70 60 60 60 50 40 40 30 30 20 20 10 10 30 25 20 15 10 5 o SIGNAL IC-NOTCHED NOISE RATIO lal PERCENTAGE OF BLOCKS RECEIVED ERROR-FREE BY THE TMS32010 MODEM VS_ SNR WITH THE BELL MODEM TRANSMITTING 30 25 20 15 10 5 o 90 90 OVER AVG LINE AT 1200 BPS -26 dBM BO 80 70 70 60 ... I 50 50 40 40 30 30 20 20 11:1 ~I 10 30 26 20 15 10 6 o SIGNAL IC-NOTCHED NOISE RATIO Ibl PERCENTAGE OF BLOCKS RECEIVED ERROR~FREE BY THE AT&T MODEM VS_ SNR WITH THE BELL MODEM TRANSMITTING Figure 24. Performance of TMS32010 and AT&T Modem Receivers 274 Theory and Implementation of a Splitband Modem Using the TMS32010 Other Implementation Considerations The implementation approach of the Bell 212AIV .22 modem presented in the previous sections is not unique. There are other and possibly more efficient ways of implementing the modem. Drastic reduction of the hardware cost results from the use of a codec for the AID and DIA conversions instead of the 12-bit linear AID and DIA converters used in this implementation. This approach becomes even more attractive with the use of the TMS32011 digital signal processor in place of the TMS3201O. The TMS32011 is a microcomputer (no external memory expansion) having the same architecture as the TMS32010 with the additional feature of containing the necessary logic for interfacing to a codec. In this implementation, the necessary input bandpass filtering for the modem receiver can be performed with an AMI S35212A analog filter chip. The modem hardware block diagram of this implementation is shown in Figure 25. I -..... ~ CONTROL LOGIC I OSCILLATOR ~ r-INT w < u.. N q- ,.... ,.... II: w I- iiE !II DATA BUS ~ !II :E l- ;:) ca --- r--. '---- DATA LATCH r. ) CLKIN -- - ' - - PCM '--- 'r- CS (.J - r--".... ...... 0 N M !II CO DEC ANLGIN SCLK DAA ANLGOUT :E I- CLKOUT CONTROL BUS --- rr L S35212A f - FILTeR CLOCK DIVIDER I q U Figure 25. Modem Hardware Block Diagram Using a Codec for the AID and DIA Conversions If this approach is used, the receiver input has the configuration shown in Figure 26. The bandpass filtering is implemented in the analog domain and the Automatic Gain Control and Hilbert Transformer Pair implemented in the digital domain inside the TMS320 11. Implementing the bandpass filtering in the analog domain should save adequate .program memory, data memory, and processing power to allow the design to be upgraded to the V.22 bis specification. If only the Bell 212A is of interest, the bandpass filtering could be performed digitally within the TMS32011. Theory and Implementation of a Splitband Modem Using the TMS32010 275 slnT s) BANDPASS FILTER Figure 26. Alternative Modem Receiver Input Configuration Conclusions This application report discussed the digital implementation of splitband modems using the TMS32010 general-purpose high-speed digital signal processor. The theory and implementation of the Bell 212AIV.22 full-duplex modem was covered in detail. With a modification of some of the functional blocks of the Bell 212AIV.22, 24oo-bps splitband modems (V.22 bis) can be implemented. Modems are sophisticated devices, consisting of many functional blocks. This implies the need of special features for the microprocessor to be used. The TMS32010 with a 2oo-ns cycle, an on-board single-cycle multiplier, and a special instruction set tailored for digital signal processing is able to implement the modem functional blocks (see Table 5) with approximately 60-percent use of the available processing power. The modem program utilizes 103 words of data memory out of the 144 words available. This corresponds to approximately 71 percent ofthe data memory. The program also utilizes 954 words of program memory out of the 1536 words available, corresponding to approximately 62 percent of the on-chip program memory. Therefore, the use of the full-speed off-chip memory feature of the TMS32010 was not utilized. Since a large portion ofthe power ofthe TMS32010 is still available, additional functions, such as an adaptive equalizer and the Data Encryption Standard (DES)l, can be implemented with the inclusion of new code. With a 6-percent loading of the TMS3201O, the DES can provide secure communication between 1200-bps full-duplex modems. The TMS32010 is one of many digital signal processors in the TMS320 family. The flexibility and processing power of the TMS320 family provide high performance, high reliability, and cost-effective solutions for medium-.and high-speed modems. 276 Theory and Implementation of a Splitband Modem Using the TMS32010 References 1. P. E. Papamichalis and J. Reimer, "Implementation of the Data Encryption Standard with the TMS3201O," Digital Signal Processing Applications with the TMS320 Family, Texas Instruments (1986). 2. C.F. Foschini, R.D. Gitlin, and S.B. Weinstein, "On the Selection of a Two-Dimensional Signal Constellation in the Presence of Phase Jitter and Gaussian Noise," Bell System Technical Journal, Vol. 52, 927-965 (July-August 1973). 3. P.J. Van Gerwen, N.A.M. Verhoeckx, H.A. Van Essen, and F.A.M. Snijders, "Microprocessor Implementation of High Speed Data Modems," IEEE Trans. on Communications, Vol. COM-25, No.2, 238-250 (February 1977). 4. M.J. Di Toro, "Communication in Time Frequency Spread Using Adaptive Equalization," Proceedings of the IEEE, Vol. 56, No. 10, 1653-1679 (October 1968). 5. "Data Communications Using Voice Band Private Line Channels," Bell Systems Technical Reference, No. 41004 (1973). 6. F.M. Gardner, Phaselock Techniques, John Wiley & Sons (1979). 7. M.K. Simon and J.D. Smith, "Carrier Synchronization and Detection of QASK Signal Sets," IEEE Trans. on Communications, Vol. COM-22, 98-106 (February 1974). 8. W.C. Lindsey and M.K. Simon, "Carrier Synchronization and Detection of Polyphase Signals," IEEE Trans. on Communications, Vol. COM-20, 441-454 (June 1972). 9. H.L. Van Trees, Detection, Estimation and Modulation Theory, John Wiley and Sons (1968). 10. TMS7742 Data Sheet, Texas Instruments (1985). 11. TMS7000 Family Data Manual, Texas Instruments (1986). 12. M. Schwartz, Information Transmission, Modulation, and Noise, McGraw-Hill (1970). 13. A. Lovrich and R. Simar, "Implementation of FIRIIIR Filters with the TMS3201O/TMS32020," Digital Signal Processing Applications with the TMS320 Family, Texas Instruments (1986). 14. T.W. Parks and C.S. Burrus, Digital Filter Desi$n, John Wiley and Sons (1987). 15. 'TMS32010 User's Guide, Texas Instruments (1983). 16. A. Papoulis, The Fourier Integral and Its Applications, McGraw-Hill (1962). 17. D. Garcia, "Precision Digital Sine-Wave Generation with the TMS3201O," Digital Signal Processing Applications with the TMS320 Family, Texas Instruments (1986). 18. H. Stark and F.B. Tuteur, Modern Electrical Communications, Prentice-Hall (1979). Theory and Implementation of a Splitband Modem Using the TMS3201Q 277 Appendix A Derivation of Demodulator Structure Equations The equations that describe the demodulator structlire (see Figure 6) of the modem receiver are derived in this Appendix. The background material required for this derivation is presented first. The following discussion requires a basic ktiowledge of complex variables. The baseband signal, at the output Of the transmitter digital lowpass filters (see Figure 3), can be expressed as a complex value (A-I) c(nTs) = I(nT s) - j Q(nT s) For transmission through the telephone network, this signal is modulated to the voice frequencies. Modulation involves multiplication by a complex exponential. 18 The modulated signal is then given by m(nT s) = c(nT s) ejwe nT s (A-2) where We is the carrier frequency. Substitution of (A-I) into (A-2), and the use of the identity ejwenTs = cos(wenTs) + j sin(wenTs) give m(nT s) {I(nTs) cos(wenTs) + Q(nTs) sin(wenTs)} + j {I(nTs) sin(wenTs) - Q(nTs) cos(wenTs)} (A-3) The real and imaginary parts of (A-3) are later shown to be a Hilbert transform pair. Two signals are referred to as a Hilbert transform pair if they are related with a Hilbert transform. A Hilbert transform is implemented with a filter called a Hilbert transformer. The Hilbert transform pair property that relates the real and imaginary parts of (A-3) allows the transmission of the real part of (A-3) only. The imaginary part is recovered at the receiver by Hilbert transforming the incoming signal. Figure A-I shows the spectrum of the complex baseband information c(nTs). Figure A-2 shows the spectrum after modulation by the complex exponential (see equation (A-2». This is the spectrum of m(nTs). Figure A-3 shows the spectrum of the transmitted signal, i.e., the spectrum of the real part of m(nTs). 278 Theory and Implementation of a Splitband Modem Using the TMS32010 c(w) w Figure A-I. Spectrum of Complex Baseband Information M(w) 1 Figure A-2. Spectrum after Modulation s(w) Figure A-3. Transmitted Spectrum A Hilbert transformer is defined to be a filter with the transfer function 18 Ht(w) = 11' -ej2 sgn(w) = -j sgn(w) (A-4) (A-4) where sgn is the sign function defined by equation (29). The transfer function characteristics of the Hilbert transformer are shown in Figure A-4, where it is seen that the Hilbert transformer introduces a -90 degree phase shift for positive frequencies (w > 0), and a +90 degree phase shift for negative frequencies (w < 0). Theory and Implementation of a Splitband Modem Using the TMS32010 279 w -jl------ Figure A-4. Hilbert Transformer Transfer Function The Hilbert transform pair relationship between the real and imaginary parts of (A-3) is discussed next. It is shown tha.t the imaginary part of m(nT s) is the output of a Hilbert transformer with the input being the real part ofm(nTs). The analysis is performed in the frequency domain where multiplication is replaced by convolution. Let S(w) and S(w) be the Fourier transforms of the real and imaginary parts of m(nT s), respectively. Then (see equation (A-3» 1 j S(w) = '2{I(w-wc) + I(w+wd} + '2 {Q(w+wC> - Q(w-wc)} j 1 S(w) = '2 {I(w+wc) - I(w-wc)} - '2 {Q(w-wc) + Q(w+wd} A (A-5) (A-6) where I(w) and Q(w) are the Fourier transforms of I(nTs) and Q(nT s), respectively. With S(w) as the input to the Hilbert transformer (transfer function Ht(w», the output in the frequency domain is given by O(w) = S(w) Ht(w) = -j S(w) sgn(w) (A-7) Substitution of (A-5) into (A-7) gives 1 ' O(w) = ,- j { '2 [I(w - wc) + I(w + wc)] J + [Q(w+wd - Q(w-wd]} sgn(w) 2 Since for positive frequencies (w o o 280 (A-8) > 0), (A-9) , Theory and Implementation of a Splitband Modem Using the TMS32010 and for negative frequencies (w < 0), o o (A-lO) equation (A-8) simplifies to O(w) = { ~ I(w - wc) - ~ Q(w - wc) where w > 0 2 I(w +Wc) - 21 Q(w +wc) where w < 0 . J (A-ll) Substitution of (A-9) and (A-lO) into (A-6) and comparison of the result with (A-II) shows that Sew) = O(w). Therefore, the real and imaginary parts of m(nTs) (see equation (A-3» represent a Hilbert tranform pair . .with s(nTs) and s(nTs) denoting the real and imaginary parts of m(nTs), respectively, ,(A-3) can be written as (A-I2) m(nT s) = senTs) + j senT s) At the receiver end, recovery of the imaginary part senT s) involves Hilbert transforming the real part s(nTs) (incoming signal), as shown in Figure A-5. s(nTsl II: 0 .... I'(nT sl ~ 0 where w < 0 where W (A-13) i.e., the spectrum of m(nT s) is zero for negative frequencies (see Figure A-2). If this property does not hold due to the use of a nonideal Hilbert transformer, harmonics appear at the output of the receiver demodulator (see Appendix B). The equations that describe the receiver demodulator are derived next. The demodulator translates the recovered complex modulated information back to the baseband. This is accomplished by multiplying the passband information with a complex exponential. c'(nTs) = m(nTs) e-jwenTs (A-I4) where c'(nTs) is the recovered baseband signal, m(nTs) is the passband signal given by (A-12), and We is the carrier frequency recovered at the receiver by the carrier recovery algorithm. Substitution of (A-12) into (A-I4) gives c'(nTs) = {s(nTs) cos(wenTs) + s (nTs) sin(wenTs)} + j {s(nTs) cos(wenTs) - s(nTs) sin(wenTs)} (A-I5) The complex baseband information c'(nTs) is also given: by (see equation (A-I) and Figure 5) c'(nTs) = I'(nTs) - j Q'(nTs) (A-I6) Equating the real and imaginary parts of (A-I5) to those of (A-I6) results in I'(nTs) Q'(nTs) = s(nTs) cos(wcnTs) + s(nTs) sin(wcnTs) = s(nTs) sin(wcnTs) - s(nTs) cos(wcnTs) (A-l7) (A-I8) Equations (A-I7) and (A-I8) describe the receiver demodulator of Figure 6. 282 Theory and Implementation of a Splitband Modem Using the TMS3201~ Appendix B Effects of Nonideal Hilbert Transformers The effect of nonideal Hilbert Transformers in modem design is studied in this Appendix. The following discussion requires a basic knowledge of complex variables. The nonideal Hilbert transformer characteristics differ from the ideal ones shown in Figure 28 and described by equation (A-4) in Appendix A. The phase shift introduced by the non ideal filter is not exactly 90 degrees. The transfer function characteristics of such a filter are given by 11" H'(w) = - e j (2" + c.) sgn(w) = - j e ja sgn(w) (B-1) where 'c{' is a nonzero constant indicating the deviation from the ideal filter. Consider the effect of a nonideal Hilbert transformer described by equation (B-1). The incoming signal s(nTs) is the real part of m(nTs). This signal is filtered by the non ideal Hilbert transformer to generate at the output a signal s' (nT s) different from s(nTs) (see Appendix A). With S'(w) as the Fourier transform of s'(nT s), the output of the nonideal Hilbert transformer can be described in the frequency domain by S'(w) = H'(w) = Sew) (B-2) -j eja sgn(w) Sew) The complex signal at the input of the receiver demodulator is described by m'(nT s) = s(nTs) + j s'(nTs) (B-3) The frequency-domain equivalent of (B-3) is M'(w) = Sew) +j (B-4) S'(w) Substitution of (B-2) into (B-4) gives M'(w) = Sew) + (B-5) eja sgn(w) Sew) Equation (B-5) can be written as M'(w) = Sew) { where Sew) { I where w w > 0 < 0 (B-6) For a non ideal Hilbert transformer, the parameter 'c{' is nonzero. This results in M'(w) having nonzero components at negative frequencies as indicated by (B-6). The spectrum of the sig,nal at the input of the receiver demodulator is shown in Figure B-1. Comparison of Figures A-2 and B-1 indicates that the effect of the nonideal Hilbert transformer is the generation of nonzero spectral components at negative frequencies. Theory and Implementation of a Splitband Modem Using the TMS32010 283 M'(wl 0.5--)2+2 cosO! w Figure B-1. Effect of Nonideal Hilbert Transformer on the Spectrum of the Complex Signal at the Input of the Demodulator The effect of the receiver demodulator on the spectrum of Figure B-1 is shown in Figure B-2. C'(wl w Figure B-2. Effect of .Nonideal Hilbert Transformer on the Spectrum of the Baseband Complex Signal Figure B-2 indicates that harmonics appear at the output of the demodulator. The frequency of these harmonics is twice the carrier frequency. Their elimination involves the use of lowpass filters at the output of the demodulator. These filters, however, introduce group delay and possibly phase delay effects that affect the carrier recovery and decision algorithms. Compensation for the lowpass filter side-effects results in a more complicated modem receiver design. Such nonideal Hilbert transformers are encountered. in analog modems. This appendix has demonstrated one more advantage of a digital implementation of a modem using the TMS32010 digital signal processor. 284 Theory and Implementation of a Splitband Modem Using the TMS32010 Appendix C Automatic Gain Control Table Generator Code Theory and Implementation of a Splitband Modem Using the TMS32010 285 10 ' THIS PROGRAM GENERAlES THE GAIN TABLE FOR THE AUTOMAT"iC 20 ' GAIN CONTROL ALGORITHM IN THE MODEM CODE 30 40 THE PROGRAM PROMPTS THE USER IN THE FOLLOWING MANNER: 50 60 AGC TABLE ADJUST FACTOR 1 70 ThIs reature allows the AGC to gaIn to a level lower 80 ' than unIty. The entry ror unIty gaIn Is 256, to set the gaIn lower than unIty enter the approprIate per90 100 ' centage or 256. 110 ' ENTER NAME OF OUTPUT FilE = 120 ThIs prompt request the name or a MSDOS rormat rIle 130 name to store the generated table. 140 ' 150 160 TABLE LENGTH = ThIs reature allows the user to generate dlrrerent 170 length AGC tables. ThIs allows the accuracy or the 180 ' 190 ' table to vary by the number Or entries. The number or entrIes Is tIed to the number or bIts used In the 200 ' table lookup. In the modem algorIthm sIx bIts were 210 used In the lookup, thererore the table length wIll be 220 ' 230 64 words. 240 THE TABLE GENERATED WILL INCLUDE DESCRIPTIVE COMMENTS AND WILL 250 ' BE IN A FORM READY TO BE ADDED DIRECTLY INTO THE ASSEMBLY CODE 260 ' FOR AN ALGORITHM. SINCE THE AGC SOFTWARE SHIFTS THE LOOKUP 270 VALUE TO THE MOST SIGNIFICANT BIT THE fiRST HALF OF THE AGC TABLE 280 (THE LESS ACCURATE HALF) WILL NOT BE USED. THEREFORE THE USER 290 CAN DELETE THE FIRST HALF AND SAVE A CONSIDERABLE AMOUNT OF PROGRAM 300 310 MEMORY SPACE. 320 THIS PROGRAM WAS WRITTEN BY PETER EHllG FOR USE ON A 330 ' TEXAS INSTRUMENTS PROFESSIONAL COMPUTER 340 350 ' THE CODE TO MY KNOWLEDGE IS WRITTEN IN STANDARD MS-BASIC AND SHOULD OPERATE ON ANY MSDOS SYSTEM. 360 370 ' 380 PRINT 'PROGRAM STARTED" 390 DIM TBlD(500),HTB$(500) 400 OPEN "lPTI:" FOR OUTPUT AS #1 410 INPUT "AGC TABLE ADJUSTMENT FACTOR? ",GAINADJ 420 INPUT'''ENTER NAME OF OUTPUT FilE ",OUTFIlE$ 430 OPEN OUTFIlE$ FOR OUTPUT AS #3 440 PI = 3.1415927# 450 PI2 = PI • 2 460 INPUT "TABLE lENGTH = ",TBlEN 470 GOSUB 820 • GENERATE TABLE HEADER 480 DELTA = 3276BI / TBlEN 490 FOR I = I TO TBlEN 500 TBl = INT(32767 / (I • DELTA) • GAINADJ) 510 TBlD(I) = TBL S20 HTBl$ = HEX$(TBL) 530 HTB$(I) = HTBl$ 540 GOSUB 690 'DISPLAY RANGE ACCURACY (OPTIONAL) 550 NEXT 560 GOTO 650 570 ' SAVE AGC TABLE TO DISK 580 PRINT#3, " DATA "; 590 PRINT#3, USING ">, ,";HTB$(I); 600 PRINT#3, " "; 610 TBlD. rBLD(I) / 256 620 PRINT#3, USING "###.#######";TBLDI 630 RETURN 640 • END OF AGC TABLE SAVE ROUTINE 650 GOSUB 940 • DISPLAY SECOND LEVEL LOOKUP 660 GOSUB 880 • GENERATE TABLE TERMINATION COMMENTS 670 PRINT "PROGRAM FINISHED" 680 END 286 Theory and Implementation ofa SplitbandModem Using the TMS32010 690 700 710 720 730 740 750 760 770 780 790 800 810 820 ' THIS ROUTINE DISPLAYS INFORMATION ABOUT THE RANGE ' ACCURACY OF EACH STEP OF THE TABLE TBLRL = (I - I) • DELTA - 256 IF TBLRL < 0 THEN TBLRL s 0 SHI$ = HEX$(TBLRL) SHIA$ = HEX$(TBLRL • TBL I 256) TBLRH .. (I - I) • DELTA + 255 SH2$ .. HEX$(TBLRH) SH2A$ = HEX$(TBLRH • TBL I 256) PRINT I;TBL;HTBL$;" ";SHI$;" ";5HIA$;" ";SH2$;" ";SH2A$ ' PRINT#I,I;TBL;HTBL$;" ";SHI$;" ";SHIA$;" ";SH2$;" ";SH2A$ RETURN ' END OF RANGE INFORMATION ' THE ROUTINE GENERATES THE HEADER COMMENTS FOR THE TABLE 840 850 860 870 880 PRINT#3, USING "###";TBLEN RETURN ' END OF HEADER ROUTINE ' THIS ROUTINE GENERATES THE TABLE TERMINATION COMMENTS 830 PRINT#3."············································· ......•.•.•...., PRINT#3,"AGCTBL EQU $ AGC TABLE LENGTH = "; 890 PRINT#3."············································· .....•.•.••.•• " 900 PRINT#3, " PAGE" 910 CLOSE 920 RETURN 930 ' END OF TERMINATOR ROUTINE 940 ' TRY SECOND LEVEL LOOKUP 950 DELTAI .. DELTA· 8 960 FOR I = I TO 64 970 GOSUB 570 SAVE AGC TABLE TO DISK 980 TBLRL .. (I - I) • DELTA - 256 990 IF TBLRL < 0 THEN TBLRL .. 0 1000 TBLRH .. (I - I) • DELTA + 255 1010 SHI$ = HEX$(TBLRL) 1020 SH2$ = HEX$(TBLRH) 1030 GOSUB 1100 ' CALCULATE ACCURACY STEPS 1040 SHIA$ • HEX$(TBLRL • TBLD(TBLRI) I SHFI) 1050 SH2A$ = HEX$(TBLRH • TBLD(TBLR2) I SHFI) 1060 PRINT I;TBL;HTBL$;" ";SHI$;" ";SHIA$;" ";SH2$;" ";SH2A$;TBLRI;TBLR2;SHFI 1070 ' PRINT#I,I;TBL;HTBL$;" ";SHI$;" ";SHIA$;" ";SH2$;" ";SH2A$;TBLRI;TBLR2;SHF I 1080 1090 1100 1110 1120 1130 1140 1150 1160 1170 1180 I 190 1200 1210 1220 1230 1240 1250 1260 1270 1280 1290 1300 1310 1320 1330 NEXT RETURN 'TABLE LOOKUP SHIFTER TBLEV = TBLRH - 4096 IF TBLEV > 0 GOTO 1180 TBLEV = TBLEV + 2048 IF TBLEV > 0 GOTO 1220 TBLEV = TBLEV + 1024 IF TBLEV > 0 GOTO 1260 GOTO 1300 TBLRI .. I TBLR2 .. I SHFI = 256 RETURN TBLR2 .. FIX(TBLRH I 64) T8LRI = FIX(TBLRL I 64) SHFI = 32 RETURN TBLR2 .. FIX(TBLRH I 32) TBLRI = FIX(TBLRL I 32) SHFI = 16 RETURN TBLR2 = FIX(TBLRH I 16) TBLRI = FIX(TBLRL I 16) SHFI .. 8 RETURN + + + + + + Theory and Implementation of a Splitband Modem Using the TMS3201o. 287 The following 64-polnt table was generated using the 124 for the AGC table adjust factor. ••...•...•..••.•.........•..•.••.....•.•••••••.•.••.•.••••. AGCTBL EQU DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA 288 $ >IEFF >F7F· >A55 >7BF >633 >52A >460 >3DF >371 >319 >201 >295 >262 >236 >211 >IEF >102 >IB8 >IAI > 18C >179 >168 >159 >14A >130 >131 >125 > liB > III >108 >FF >F7 >FO >E9 >E2 >DC >06 >00 >CB >C6 >C1 >BC >68 >64 >60 >AC >A8 >A5 >Al >9E >96 >98 >95 >92 >90 >80 >86 >88 >86 >84 >82 >7F AGe TABLE LENGTH = 64 30.9961000 15.4960900 10.3320300 7.7460940 6.1992190 5.1640630 4.4257820 3.8710940 3.4414060 3.0976560 2.8164060 2.5820310 2.3828130 2.2109380 2.0664060 1.9335940 1.8203130 1.7187500 1.6289060 1.5468750 1.4726560 1.4062500 1.3476560 1.2890630 1.2382810 1.1914060 1.1445310 1.1054690 1.0664060 1.0312500 0.9960938 0.9648438 0.9375000 0.9101562 0.8828125 0.8593750 0.8359375 0.8125000 0.7929688 0.7734375 0.7539063 0.7343750 0.7187500 0.7031250 0.6875000 0.6718750 0.6562500 0.6445313 0.6289063 0.6171875 0.6054688 0.5937500 0.5820313 0.5703125 0.5625000 0.5507813 0.5429688 0.5312500 0.5234375 0.5156250 0.5078125 0.4960938 Theory and Implementation of a Splitband Modem Using the TMS32010 DATA >70 0.4B82813 DATA >7B 0.4804688 ...............................•........................... PAGE 10 20 30 ' 40 50 60 70 80 90 100 110 120 130 140 150 ' 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 ' ' This program generates sine table In a Format compatible to the 3Z0 assembler. This allows the user to generate any length sine table and this program will calculate the table entries, conFigure them In a Format compatible to the assembler, and document the code. The program prompts the user In the Following manner: ENTER NAME OF OUTPUT FILE = This prompt request the name of a MSOOS Format File name to store the generated table. TABLE LENGTH = Th I s Feature allows the user to se 1e.ct the length of the sine table to be generated and thereFore the accuracy of the table steps. This program was written by Peter Ehllg For use on a Texas Instruments ProFessional Computer The code to my knowledge Is written In standard MS-BASIC and should operate on any MSOOS system. PRINT 'PROGRAM STARTED" INPUT "ENTER NAME OF OUTPUT FILE = ",OUTFILE$ OPEN OUTFILE$ FOR OUTPUT AS #3 PI = 3.1415927# PI2 = PI * 2 INPUT "TABLE LENGTH ",TBLEN DELTA = PIZ I TBLEN INDXI = -DELTA NETOEG = 360 I TBLEN 340 PRINT#3,"············································· .............. " EQU $ 350 PRINT#3,"SINE SINE TABLE LENGTH = "; 360 PRINT#3, USING "###";TBLEN 370 FOR I = 1 TO TBLEN 380 INDXI = INOXI + DELTA 390 TBL = SIN( INOXI) 400 HTBL$ = HEX$(TBL*16384) 410 RAOS = INOXI I PI 420 DEGR = NETOEG * (I - I) DATA "; 430 PRINT#3, .. 440 PRINT#3, USING ">\ ,";HTBL$; 450 PRINT#3, " ANGLE = "; 460 PRINT#3, USING "###.####";DEGR; 470 PRINT#3, .. SINE = ."; 480 PRINT#3, USING "#.######";TBL 490 NEXT 500 510 PRINT#3, " PAGE" 520 CLOSE 530 PRINT "PROGRAM FINISHEO" 540 END PRINT#3."············································· .............. " Theory and Implementation of a Splitband Modem Using the TMS32010 289 ..•..•.•••••...••.•.•..••.....•.......••.....•...•••••....• S[NE EQU DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA $ >0 >C7C > 187E >236E >2041 >3537 >3621 >3EC5 >4000 >3EC5 >3621 >3537 >2041 >238E >187E >C7C >0 >F384 >E782 >DC72 >D26F >CAC9 >C4DF >CI3B >COOO >CI3B >C4DF >CAC9 >D2BF >DC72 >082 >F384 S[NE TA6LE LENGTH ANGLE 0.0000 ANGLE 11.2500 ANGLE 22.5000 ANGLE 33.7500 ANGLE 45.0000 ANGLE 56.2500 ANGLE 67.5000 ANGLE 78.7500 ANGLE 90.0000 ANGLE 101.2500 ANGLE 112.5000 ANGLE 123.7500 ANGLE [35.0000 ANGLE 146.2500 ANGLE 157.5000 ANGLE 168.7500 ANGLE 180.0000 ANGLE 191.2500 ANGLE 202.5000 ANGLE 213.7500 ANGLE 225.0000 ANGLE 236.2500 ANGLE 247.5000 ANGLE 258.7500 ANGLE 270.0000 ANGLE 281.2500 ANGLE 292.5000 ANGLE 303.7500 ANGLE 315.0000 ANGLE 326.2500 ANGLE 337.5000 ANGLE 348.7500 32 S[NE S[NE SINE SINE S[NE SINE SINE SINE S[NE S[NE SINE S[NE S[NE SINE SINE SINE SINE SINE SINE SINE SINE SINE SINE SINE SINE SINE SINE SINE SINE SINE SINE SINE = 0.000000 0.195090 0.382683 0.555570 0.707107 0.831470 0.923880 0.980765 1.000000 0.980765 0.923880 0.831470 0.707107 0.555570 0.382683 0.195090 -.000000 -.195091 -.382684 -.'555571 -.707107 -.831470 -.923880 -.980786 ~-I.OOOOOO = -.980785 -.923879 -.831469 -.707106 -.555569 -.382682 -.195089 •..•....•.•.......•.•..•........••••...........•••••••••... PAGE 290 Theory and Implementation of a Splitband Modem Using the TMS32010 Appendix D TMS32010 Source Code Theory and Implementation of a Splitband Modem Using the TMS32010 291 .*** ••••••••••• *.* •••••••••••••••••••••••••••••••••••••• *. DSP MODEM PROGRAM THIS CODE IMPLEMENTS A BELL 2I2A I V.22 MODEM ON THE TMS320IO. SCRAMBLING AND DESCRAMBLING ON THE TMS7742 . ARE IMPLEMENTED •••••••••••••••••••••••••••••••••••••••• * ••••••••••••••••• lOT OPTION AORG 'TASK6212' XREF . B START o ••••••• *-----------------------------------------_ ••••••• * DATA MEMORY USED . •••••••• ------------------------------------------~ ••• * ••• XDELTA XALPHA SINA COSA ONE MASK. I MASK2 MASK3 OFSETO OFSETI XPTR CXO CXI CX2 XIBUFO XIBUFI XIBUF2 XQBUFO XQBUFI XQBUF2 XIOUT XQOUT XMTOUT XOLDPH XNEWPH RDIBIT INDXPH XDIBIT PLUSI XMTD RBUFO RBUFI RBUF2 RBUF3 RBUF4 RBUF5 RBUF6 RBUF7 RBUF8 RBUF9 RBUFIO RBUF II RBUFI2 RBUFI3 RBUFI4 RBUFI5 RBUFI6 RBUFI7 RBUFI8 RBUFI9 RBUF20 RBUF21 292 EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU 0 I 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 • * • • • • • • • • • • • • • • * • • • • • • • • • • • • • • OZ OZ OZ OZ OZ "I. OZ OZ OZ OZ OZ OZ OZ OZ OZ OZ OZ OZ "I. 1. OZ SWAVE MACRO CARRIER RATE SWAVE MACRO CARRIER ANGLE XMIT SIN CARRIER MAGNETUDE XMIT COS CARRIER MAGNETUDE VALUE I HELD FOR MASKING SWAVE MACRO TBL RANGE ADJ >7F SWAVE MACRO TBL RANGE ADJ >7FFF XMIT PHASE ENCODE MASK >0006 SWAVE MACRO POINT TO COS TABLE XMIT POINT TO DIBIT ENCODE TABLE XMIT POINT TO RAISED COS TABLE XMIT COEF FOR RAISED COS XMIT COEF FOR RAISED COS XMIT COEF FOR RAISED COS XMIT STORE DATA FOR RAISED COS XMIT STORE DATA FOR RAISED COS XMIT STORE DATA FOR RAISED COS XMIT STORE DATA FOR RAISED COS XMIT STORE DATA FOR RAISED COS XMIT STORE DATA FOR RAISED COS XMIT HOLD FILTERED I VALUE XMIT HOLD FILTERED 0 VALUE XMIT HOLD FOR TRANSMIT OUTPUT XMIT HOLD LAST PHASE XMIT HOLD NEW PHASE DECODED DIBIT XMIT POINT TO PHASE ENCODE TABLE XMIT DIBIT ISOLATION MASK +1 012 >FFF &. MASK VALUE XMIT HOLD DTE INPUT HOLD LOWPASS FILTERED SAMPLE RECEIVE BPF COEFFIC·IENT RECEIVE BPF COEFFICIENT RFCEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECE I VE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT RECEIVE BPF COEFFICIENT Theory and Implementation of a Splitband Modem Using the TMS32010 RBUF22 EQU 52 ~ RECEIVE BPF COEFFICIENT RBUF23 EQU 53 ~ RECEIVE BPF COEFFICIENT RBUF24 EQU 54 ~ RECEIVE BPF COEFFICIENT RBUF25 EQU 55 ~ RECEIVE BPF COEFFICIENT ~ RECEIVE BPF COEFFICIENT RBUF26 EQU 56 RBUF27 EQU 57 7. RECEIVE BPF COEFFICIENT 7. RECEIVE BPF COEFFICIENT RBUF28 EQU 58 RBUF29 EQU 59 ~ RECEIVE BPF COEFFICIENT RBUF30 EQU 60 7. RECEIVE BPF COEFFICIENT RBUF31 EQU 61 7. RECEIVE BPF COEFFICIENT RBUF32 EQU 62 7. RECEIVE BPF COEFFICIENT RBUF33 EQU 63 ~ RECEIVE BPF COEFFICIENT RBUF34 EQU 64 7. RECEIVE BPF COEFFICIENT RBUF35 EQU 65 ~ RECEIVE BPF COEFFICIENT RBUF36 EQU 66 ~ RECEIVE BPF COEFFICIENT RBUF37 EQU 67 7. RECEIVE BPF COEFFICIENT AGC EQU 68 * AUTOMATIC GAIN FACTOR AGCRA EQU 69 * SIGNAL MAX RUNNING AVERAGE FOR AGC RECST EQU 70 * RECEIVER STATUS * AGC CALCULATION LOOKUP TABLE AGCOFF EQU 71 BSMAX EQU 72 * BAUD SIGNAL MAX AGCNT EQU 73 * BAUD SAMPLE COUNT AGCLEV EQU 74 * TEMPORARY AGC LEVEL (AGCUPT) SAMPLE EQU 75 * BAUD LIMIT SAMPLE COUNT SAMXMT EQU 76 • TRANSMITTER SAMPLE COUNT B !TOUT EQU 77 • DIBIT POSITIONED TO XMIT TO 7041 RPHSE EQU 78 • OFFSET FOR RECEIVE PHASE DECODE TRSHDI EQU 79 • THRESHOLD FOR CARRIER RECOVERY RALPHA EQU 80 • RECEIVE CARRIER POINTER RDELTA EQU 81 • DELTA TO GENERATE RECEIVE CARRIER ISUM EQU 82 • FILTERED/PHASE SHIFTED SAMPLE QSUM EQU 83 • FILTERED/PHASE SHIFTED SAMPLE REC I EQU 84 • BASEBAND I CHANNEL ROLDPH EQU 85 • PREVIOUS ABSOLUTE PHASE (QUADRANT) RNEWPH EQU 86 • CURRENT ABSOLUTE PHASE (QUADRANT) ERRSIG EQU 87 • FILTERED CARRIER ERROR SIGNAL MINUSI EQU 88 • MINUS I IN THE QI2 FORMAT PLL I EQU 89 • CARRIER RECOVERY PLL FILTER COEFFICIENT I PLL2 EQU 90 • CARRIER RECOVERY PLL FILTER COEFFICIENT 2 FOUR EQU 91 • )4 ( MASK VALUE FOR PHASE CODE/DECODE) SIGNI EQU 92 • SIGN OF I CHANNEL (TO COMPUTE CARRIER ERROR) SIGNQ EQU 93 • SIGN OF Q CHANNEL (TO COMPUTE CARRIER ERROR) ERROR EQU 94 • CARRIER PHASE ERROR TEMP EQU 95 • MISC. TEMPERORY REGISTER RECQ EQU 96 • BASEBAND Q CHANNEL *-----DEFINE REGISTERS FOR BAUD CLOCK ENRGY EQU 97 • CURRENT ENERGY PENRGY EQU 98 • PREVIOUS ENERGY BERROR EQU 99 • BAUD CLOCK ERROR BEROUT EQU 100 • OUTPUT OF BAUD PLL LOOP FILTER BPLL I EQU 101 • CLOCK RECOVERY PLL FILTER COEFFICIENT I BPLL2 EQU 102 • CLOCK RECOVERY PLL FILTER COEFFICIENT 2 TRSHD2 EQU 103 • CLOCK RECOVERY TRESHOLD *--------------- TRANSMITTER DIBIT ENCODER TABLE. ·· ********------------------------------------------******** ENCODE XPHASE DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA )0002 )0000 )0004 )0006 )7FFF )0000 )0000 )8000 )SOOO )0000 )0000 )7FFF ·· · · · · '0 I' ' 00' ' 10' 'I I' I Q 90 deg. I Q ISO deg. I Q 270 deg. I Q DIBIT DIBIT DIBIT DIBIT 0 deg. 90 deg. = 0 deg. IBO deg 270 deg. CHANNEL I CHANNEL 0 CHANNEL 0 CHANNEL -I CHANNEL -I CHANNEL 0 CHANNEL 0 CHANNEL I = = *.**.*.*------------------------------------------*.****** Theory and Implementation of a Splitband Modem Using the TMS32010 293 RECEIVER DIBIT ENCODER TABLE. DIBITS are Tormed as 'MSB.LSB' • ••• * •••• ---------------------~-------------------- •• * • •••• '01' RPHASE DATA >0001 0 deg .• DIBIT DATA 90 deg .• DIBIT '00' >0000 IBO deg .• DIBIT ' 10' DATA >0002 '11-' DATA >0003 270 deg .• DIBIT MI M2 M3 CK MD ST DT THI TH2 MINI PLSI DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA >7FFF >007F >0006 >0208 >OOOA > 1800 >0000 >1000 >2000 >0007 >0008 >FOOO >OFFF · ··· '.·· ·· ·· · MASK 1 MASK 2 MASK 3 CLOCK FOR AlB MODE FOR AlB TRANSMIT DELTA. RECEIVE DELTA. 0.01 Q12 TRSHD FOR CARRIER 0.01 QI2 TRSHD FOR 8AUD CLOCK -I QI2 1 Q12 •••••• **-----------------------------------------_ •• ** •••• PLL LOOP FILTER COFFECIENTS . ........ _----------------------------------------_ ..... _.PLLCI PLLC2 BPLLCI BPLLC2 PLLC BPLLC DATA DATA DATA DATA DATA DATA >4500 >80 >4000 >50 >7AOO >7S00 • Q15 * Q15 • () IS * Q15 • QI5 • Q15 CARRIER PLL INITIAL COEF. I CARRIER PLL COEFFICIENT 2 8AUD CLOCK PLL INITIAL COEF. BAUD CLOCK PLL COEFFICIENT 2 CARRIER PLL STEADY STATE COEF. 1 BAUD CLOCK PLL STEADY STATE COEF. ** ••••••• *----------------------------------------*** •••• - TASK MASTER SEQUENCE TABLE (RECEIVE) TASKS ARE EXECUTED FROM BOTTOM TO TOP ...•...•.. _--------------------------------------_ .... _._. TSKSEQ EQU DATA DATA - DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA $ DUMMY DUMMY DUMMY DUMMY BDCLK2 DUMMY OUT DECODE DEMODB DUMMY AGCUPT DUMMY 8DCLKI DUMMY DUMMY DUMMY UNUSED CYCLE UNUSED CYCLE UNUSED CYCLE UNUSED CYCLE COMPUTE ENERGY E( 11) UNUSED CYCLE COMMUNICATE WITH TMS7742 DECODE/GET SCRAMBLED 'DIBIT DEMODULATE IN THE MIDDLE OF BAUD UNUSED CYCLE UPDATE THE AGC (IF NECESSARY) UNUSED CYCLE COMPUTE ENERGY E(3) UNUSED CYCLE UNUSED CYCLE UNUSED CYCLE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ***.*.* ••• _---------------------------------------* ••• _.-. TASK MASTER SEQUENCE TABLE (TRANSMIT) TASKS ARE EXECUTED FROM BOTTOM TO TOP .* •••••••• _--------------------------------------_ •••••••• TSKXMT 294 EQU DATA DATA DATA DATA DATA DATA DATA $ GETDBT DUMXMT DUMXMT DUMXMT DUMXMT DUMXMT DUMXMT GET THE NEXT DIBIT NO CYCLE NO CYCLE NO CYCLE NO CYCLE NO CYCLE NO CYCLE 16 15 14 13 12 11 10 Theory and Implementation of a Splitband Modem Using the TMS3201Q DATA DATA DATA DATA DATA DATA DATA DATA DATA PAGE DUMXMT DUMXMT DUMXMT DUMXMT DUMXMT DUMXMT DUMXMT DUMXMT DUMXMT NO NO NO NO NO NO NO NO NO CYCLE CYCLE CYCLE CYCLE CYCLE CYCLE CYCLE CYCLE CYCLE 9 8 7 6 5 4 3 Z I ........ _-----------------------------------------_ ....... . RAISED COSINE COEFFICIENT TABLE • ........ _----------------------------------------_ ....... . )I COEF DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA )49A )394 )FFD9 )5AZ )Z9A )FFAB )6AO ) IB5 )FF7A )789 )ED )FF4C )853 )45 )FFZ7 )8F4 )FFC3 )FF II )963 )FF65 )FF I 0 )99C )FFZA )FFZA )99C )FFIO )FF65 )963 )FFII )FFC3 )BF4 )FFZ7 )45 )853 )FF4C )ED )789 >FF7A )IB5 )6AO >FFAB >Z9A >5AZ >FFD9 >394 )49A >I ......•...•.•..........•..........•..••....•..•.......••.•• AGC DIVIDE LOOKUP TABLE STANDARD GAIN RANGE -- >3CC3 - >3F79 WITH 5~ SIGNAL VARIATION -- >3966 - )4106 ..... •••••••••••• * ••••••••• *.* ••••• *.~ •..••.•••••••••••••• * ••••• Theory and Implementation of a Splitband Modem Using the TMS32010 295 AGCTBL EQU DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA PAGE AGC TABLE LENGTH = 0.9687500 0.9375000 0.9140625 0.8867188 0.8632812 0.8398438 0.8203125 0.7968750 0.7773438 0.7617188 0.7421875 0.7265625 0.7109375 0.6953125 0.6796875 0.6640625 0.6523438 0.6367188 0.6250000 0.6132813 0.6015625 0.5898438 0.5781250 0.5703125 0.5585938 0.5507813 0.5390625 0.531250.0 0.5234375 0.5156250 0.5078125 0.4960938 $-32 >FB >FO >EA >E3 >00 >07 >02 >CC >C7 >C3 >BE >BA >B6 >B2 >AE >AA >A7 >A3 >AO >90 >9A >97 >94 >92 >8F >80 >8A >88 >86 >84 >82 >7F 32 35 - 39 - 43 - 47 - 51 - 55 - 59 - 63 - ••••••• *-----------------------------------------_ •••••••• SINE(COSINE) TABLE •••••••• _----------------------------------------_ ••••••• * SINE 296 DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA >0 >648 >C8C >12C8 > 18F9 )IFIA >2528 )2BIF >30FC )36BA )3C57 >41CE >4710 >4C40 >5134 >55F6 >5A82 )5ED7 >62F2 >6600 >6A6E >6DCA >70E3 >73B6 >7642 >7885 >7A7D >7C2A >7D8A >7E9D >7F62 Theory and Implementation of a Splitband Modem Using the TMS32010 COSINE DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA >7FD9 >7FFF >7FD9 >7F62 >7E9D >7D8A >7C2A >7A7D >7885 >7642 >73B6 >70E3 >6DCA >6A6E >66DO >62F2 >5ED7 >5A82 >55F6 >5134 )4C40 )471D )4ICE )3C57 >36BA )30FC >2BIF )2528 )IFIA )18F9 >12C8 )C8C >648 )0 )F9B8 )F374 )ED38 >E707 >EOE6 )DAD8 >D4El )CF04 )C946 )C3A9 >BE32 )B8E3 )B3CO )AECC >AAOA )A57E )A129 )9DOE >9930 )9592 >9236 )8FID )8C4A )89BE )8778 >8583 )83D6 )8276 )8163 >809E >8027 )8000 )8027 >809E )8163 Theory and Implementation of a Splitband Modem Using the TMS32010 297 DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA )8276 )8306 )8583 )8778 )898E )8C4A )8FID )9236 )9592 )9930 )9DOE )A129 )A57E )AAOA )AECC )B3CO )B8E3 )BE32 )C3A9 )C946 )CF04 )D4E I )DAD8 )EOE6 )E707 )ED38 )F374 )F9B8 ••• * •••• _----------------------------------------_ •••••••• I CHANNEL BPASS FILTER COEFFICIENTS ........RECEIVER _----------------------------------------_ .... *.*. ICFO *ICFI ICF2 *ICF3 ICF4 *ICF5 ICF6 *ICF7 ICF8 *iCF9 ICFIO *ICFII ICFI2 *ICFI3 ICFI4 *ICFI5 lCFI6 *ICFI7 lCFI8 *ICFI9 lCF20 *ICF21 ICF22 *ICF23 lCF24 *ICF25 ICF26 *ICF27 ICF28 *ICF29 ICF30 "ICF31 ICF32 "ICF33 ICF34 "ICF35 ICf36 298 EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU 58 o -58 o 28 o 37 o -137 o 262 o -393 o 509 o -588 o 617 o -588 o 509 o -393 o 262 o • 3A 0.014064 0 0.000000 • FFC6 -0.014067 • 0 0.000000 * IC 0.006883 • 0 0.000000 * 25 0.009069 • 0 0.000000 • FF77 -0.033477 • 0 0.000000 • 106 0.063862 • 0 0.000000 • FE77 -0.095882 • 0 0.000000 • IFD 0.124198 • 0 0.000000 * FDB4 -0.143676 • 0 0.000000 • 269 0.150616 • 0 0.000000 • FDB4 -0.143676 • 0 0.000000 • IFD 0.124198 • 0 0.000000 • FE77 -0.095882 • • • • -137 * 37 " o o 28 o -58 • • • • • o • 58 • 0 O~OOOOOO 106 0.063862 0 0.000000 FF77 -0.033477 0 0.000000 25 0.009069 0 0.000000 IC 0.006883 0 0.000000 FFC6 -0.014067 0 0.000000 3A 0.014064 Theory and Implementation of a Splitband Modem Using the TMS32010 ........ _----------------------------------------_ ....... . Q CHANNEL BPASS FILTER COEFFICIENTS ........RECEIVER _----------------------------------------_ ........ "QCFO QCFI "QCF2 QCF3 "QCF4 QCF5 "QCF6 QCF7 "QCF8 QCF9 "QCFIO QCFII "QCFI2 QCFI3 "QCFI4 QCFI5 "QCFI6 QCFI7 *QCFI8 QCFI9 *QCF20 QCF21 *QCF22 QCF23 "QCF24 QCF25 "QCF26 QCF27 *QCF28 QCF29 *QCF30 QCF31 "QCF32 QCF33 *QCF34 QCF35 "QCF36 EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU 0 61 0 -47 0 0 0 83 0 -197 0 328 0 -454 0 554 0 -610 0 610 0 -554 0 454 0 -328 0 197 0 -83 0 0 0 47 0 -61 a " 0 0.000000 .. " * " " " " " * " " " " * " * * * " * * * " * * " * * " " " * * " " 3D 0.014B09 0 0.000000 FFDI -0.011510 0 0.000000 0 0.000034 0 0.000000 53 0.020321 0 0.000000 FF3B -0.048158 0 0.000000 148 0.079991 0 0.000000 FE3A -0.110844 0 0.000000 22A 0.135320 0 0.000000 FD9E -0.148859 0 0.000000 262 0.148859 0 0.000000 FDD6 -0.135320 0 0.000000 IC6 O. 110844 0 0.000000 FEB8 -0.079991 0 0.000000 C5 0.048158 0 0.000000 FFAD -0.020321 0 0.000000 0 -0.000034 0 0.000000 2F 0.011510 0 0.000000 FFC3 -0.014809 0 0.000000 PAGE .......•...........•....•...........................•..... Inftializtion routine START DINT LDPK ROVM LACK SACL LACK TBLR LACK TBLR LACK TBLR I ONE MI MASKI M2 MASK2 M3 MASK3 LACK TBLR OUT LACK TBLR OUT MD TEMP TEMP.PAO CK TEMP TEMP.PAI * AlB BOARD I NIT I AL I ZA T ION . " MD IS MODE CNTRL FOR A18. LACK SACL LACK SINE OFSETO ENCODE " TABLE OFFSET INITIALIZATION. " SINE TABLE OFFSET a " IN ITI AL IZE MASK " IN ITI AL I ZE MASK 2 " I NI TI AL IZE MASK 3 " CK IS SAMPLE RATE FOR AlB. * SENT CLOCK VALUE TO PORT I(NEW AlB) Theory and Implementation of a Splitband Modem Using the TMS3201Q 299 * TABLE SACL LACK SACL LACK SACL LACK SACL LACK SACL ZAC SACL OFSETI COEF XPTR XPHASE INDXPH RPHASE RPHSE ROLDPH * INITIALIZE PREVIOUS TOTAL PHASE SACL SACL LACK TBLR ADD TBLR RALPHA XALPHA DT XDELTA ONE RDELTA * SWAVE INITIALIZATIONS. LACK TBLR ADD TBLR LACK TBLR LACK TBLR THI TRSHDI ONE TRSHD2 MINI MINUSI PLSI PLUSI • CARRIER PLL THRESHOLD TBLR ADD TBLR ADD TBLR ADD TBLR PLLl ONE PLL2 ONE BPLLI ONE BPLL2 * RAISED COS COEF. TABLE. * OFSET FOR XMIT PHASE TABLE * OFSET FOR RCVR PHASE TABLE 4 FOUR * MISC. INITIALIZATIONS. * READ SWAVEDELTAs * BAUD CLOCK PLL THRESHOLD • -I IN 012 * +1 IN 012 *------------------------------PLLCI * CARRIER PLL INITIAL COEF. I LACK * CARRIER PLL COEF. 2 * BAUD CLOCK PLL INITIAL COEF. I • BAUD CLOCK COEF. 2 *-------------------------------- LACK SACL LAC SACL LACK SACL ZAC SACL LACK SACL LACK SACL LACK SACL ZAC SACL AGCTBL AGCOFF ONE,I3 AGCRA >FF AGC • * • * * * * BSMAX * * • • • 3 AGCNT >20 RECST 15 SAMPLE SAMXMT SET THE AGC TABLE LOOKUP OFF SET VALUE INITIALIZE RUNNING AVERAGE TO >2000 INITIALIZE THE AGC FACTOR TO ONE INITIALIZE THE BAUD SIGNAL MAX TO ZERO RUNNING AVERAGE COUNT TO THREE SET THE ENERGY DETECT BIT IN THE STATUS FLAG WORD • SET THE REC SAMPLE COUNT • TO 16 * SET THE XMT SAMPLE COUNT • TO ZERO PAGE .-------------------~--------------------------------- ----------* THE FOLLOWING CODE HANDLES COMMANDS FROM THE 7042 *---------------------------------------------------------------* COMD LOOK LOOK I 300 LAC SACL BIOZ B NOP IN IN LACK AND ONE,4 TEMP LOOK COMD SET COUNTER VALUE TO RUN DLB AT 600 BAUD WAIT FOR 9600HZ SAMPLE PULSE RBUFO,PA2 XMTD.PA6 >30 XMTD *--- DUMMY READ TO GET COUNTER GOING LOOK FOR COMMAND MASK OFF ALL BUT COMMAND BITS CHECK COMMAND BITS FOR NEW COMMAND Theory and Implementation of a Splitband Modem Using the TMS32010 COMD IF ZERO THEN NO COMMAND YET ONE,4 CHECK FOR DIGITAL LOOP BACK TEST LDLB IF SO THEN EXECUTE TEST ONE,4 CHECK FOR MODEM RUN COMMAND WAIT IF SO THEN RUN MODEM )F MASK OFF COMMAND BITS XMTD TO GET SPECIFIC CONFIGURATION FOR CONFIGURATION CODES COMD ZERO I S NOT VAL I D COMMAND ONE CHECK FOR COMMAND ONE SETALB SETUP ,THE MODEM TO RUN ALB ONE CHECK FOR COMMAND TWO SETORG SETUP THE MODEM TO RUN ORIGINATE ONE CHECK FOR COMMAND THREE SQTREC SHUT DOWN RECEIVER TO RUN XMIT ONLY COMD CHECK FOR NEXT COMMAND ONE,I3 LOAD ACC WITH 2000 TO PUT XDELTA XMIT IN SAME BAND AS RECEIVE COMD CHECK FOR NEXT COMMAND ONE,I2 LOAD ACC WITH 1000 TO PUT XDELTA XMIT IN ORIGINATE MODE COMD CHECK FOR NEXT COMMAND ONE.8 SET RECEIVER SQUELCH BIT RECST IN THE RECEIVE STATUS REG RECST TO DISABLE RECEIVER CODE COMD CHECK FOR NEXT COMMAND BZ SUB BZ SUB BZ LACK AND THIS IS BZ SUB BZ SUB BZ SUB BZ B SETALB LAC SACL B SETORG LAC SACL B SQTREC LAC OR SACL B WAIT FOR NEXT SAMPLE PERIOD BIOZ DLBOUT LDLB LOOP ON TIMER *--- DUMMY READ TO GET COUNTER GOING DLBOUT IN RBUFO,PA2 LAC TEMP GET 16 SAMPLE BAUD COUNTER SUB ONE DECREMENT IT SAVE COUNT SACL TEMP BNZ LDLB COUNT ANOTHER SAMPLE PERIOD RESET COUNTER VALUE TO RUN LAC ONE,4 DLB AT 600 BAUD SACL TEMP XMTD, 10 LAC ADJUST FOR OUTPUT RANGE OR MINUSI * MASK COMMAND BITS(15-12)TO I'S SACL XMTD STORE IT FOR OUTPUT OUT XMTD,PA6 ECHO INPUT REPEAT LOOP BACK TEST B LOOK I *---------------------------------------------------------------* LDLB B • • • • • • • w ________________________________________________ • • • • • • • • THE FOLLOWING SECTION IMPLEMENTS MODEM FUNCTIONS • • • • • • • • ________________________________________________ w • • • • • • • *---------------------------------------------------------------* WAIT BIOZ GO * WAIT FOR 9600HZ SAMPLE PULSE WAlT B GO NOP XMTOUT,PA2 * OUTPUT TO D/A OUT RBUFO,PA2 * INPUT FROM AID IN _----------------------------------------_ _ TRANSMITER SECTION STARTS HERE . _----------------------------------------_ XMITER EQU $ ........ .... ... ........ ....... . ........ _----------------------------------------_ ....... . SINE(COSINE) WAVE GENERATION * ••••••• --------------~--------------------------- •••• •••• SWAVE EQU LAC SACH LAC ADD TBLR LACK ADD AND ADD $ XALPHA.8 TEMP TEMP OFSETO SINA )20 TEMP MASK2 OFSETO * DELTA IS THE INCREMENT. * ISOLATE INTEGER PORTION. * ADD INDEX TO SINE TABLE. * SINE VALUE, (QI5). * OFFSET TO COSINE VALUE (Q15). • ADD INDEX TO COSINE TABLE. Theory and Implementation of a Splitband Modem Using the TMS32010 301 TBLR LAC ADD AND SACL COSA XALPHA XDELTA MASKI XALPHA • • • • • COSINE VALUE. (015). COMPUTE ADDRESS OF NEXT POINT FOR TABLE. KEEP MODI28. MASK=>7FFF. SAVE NEXT ADDRESS •••••••• _-----------------------------------------** •• *.** ••••• TRANSMITTER 48 TAP RAISED COSINE FILTER. INPUTS UPDATED AT 600HZ RATE. OUTPUT UPDATED AT 9600HZ RATE . •• ** •••• _----------------------------------------_ •••••• *. RACS XMIT EOU LAC TBLR ADD TBLR ADD TBLR ADD SACl XPTR CXO ONE CXI ONE CX2 ONE XPTR · ZAC LT MPY LTA MPY LTA MPY APAC SACH XIBUF2 CX2 XIBUFI CXI XIBUFO CXO • COMPUTE FILTER TAPS ICHAN. ZAC LT MPY LTA MPY LTA MPY APAC SACH XOBUF2 CX2 XOBUFI CXI XOBUFO CXO ZAC LT MPY LTA MPY APAC SACH XIOUT COSA XQOUT SINA $ RETRIEVE COEFFICIENTS XIOUT .1 · COMPUTE FILTER TAPS OCHAN. · ICHAN·cos(wt)+ QCHAN*sin(wt) XQOUT .1 XMTOUT .1 PAGE * •• * •••• _----------------------------------------_ ••• * •••• RECEIVER I CHANNEL BANDPASS FILTER. SAMPLING RATE IS 9600HZ . ••• ** •• *------------------------------------------** ••• *.* CONT6 302 ZAC LT MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK LTA RBUF36 ICF36 RBUF34 ICF34 RBUF32 ICF32 RBUF30 ICF30 RBUF2B ICF2B RBUF26 ICF26 RBUF24 Theory and Implementation of a Splitband Modem Using the TMS3201Q MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK LTA MPYK APAC SACH ICF24 RBUF22 ICF22 RBUF20 ICF20 RBUFIB ICFIB RBUFl6 ICFl6 RBUFl4 ICFl4 RBUFl2 ICFl2 RBUFIO ICFIO RBUFB ICFB RBUF6 ICF6 RBUF4 ICF4 RBUF2 ICF2 RBUFO ICFO ISUM,4 !I' • OUTPUT OF I CHAN . ........ _----------------------------------------_ ....... . RECEIVER Q CHANNEL BANDPASS FILTER. RATE IS 9600HZ . ........ SAMPLING _----------------------------------------_ ....... . LTD ZAC MPYK DMOV LTD MPYK DMOV LTD MPYK DMOV LTD MPYK DMOV LTD MPYK OMOV LTD MPYK DMOV LTD MPYK DMOV LTD MPYK DMOV LTO MPYK DMOV LTD MPYK DMOV LTD MPYK DMOV LTD MPYK DMOV RBUF35 QCF35 RBUF34 RBUF33 QCF33 RBUF32 RBUF31 QCF31 RBUF30 RBUF29 QCF29 RBUF2B RBUF27 QCF27 RBUF26 RBUF25 QCF25 RBUF24 RBUF23 QCF23 RBUF22 RBUF21 QCF21 RBUF20 RBUF19 OCF 19 RBUF1B RBUF 17 QCF17 RBUF 16 RBUF15 QCF15 RBUF 14 RBUF 13 QCFl3 RBUFI2 Theory and Implementation of a Splitband Modem Using the TMS32010 303 RBUFII QCFII RBUFIO RBUF9 QCF9 RBUF8 RBUF7 QCF7 RBUF6 RBUF5 QCF5 RBUF4 R8UF3 QCF3 RBUF2 RBUFI QCFI RBUFO LTD MPYK DMOV LTD MPYK DMOV LTD MPYK DMOV LTD MPYK DMOV LTD MPYK DMOV LTD MPYK DMOV APAC SACH QSUM.4 • OUTPUT OF Q CHAN. PAGE AGCAL OVRMAX MPYI MPYQ DETECT MAXIMUM SIGNAL STRENGTH OF RECI PER BAUD EQU $ LAC ISUM * AGC VALUE CALCULATED USING ISUM ABS GET MAGNETUDE OF SIGNAL SUB BSMAX COMPARE TO PREVIOUS MAX VALUE BLZ OVRMAX IF LESS THAN THEN JUMP OVER UPDATE ADD BSMAX RESTORE VALUE AND SACL BSMAX STORE AS NEW MAX MULTIPLY IN AGC FACTOR TO FILTERED SIGNAL LT AGC MULTIPLY THE AGC FACTOR MPY ISUM BY THE FILTERED DATA ELEMENT PAC MOVE THE PRODUCT TO THE ACC SACH TEMP.4 SAVE TOP HALF OF ACC AND PLUSI MASK OFF UNUSABLE BITS SACL ISUM SAVE BOTTOM HALF OF ACC ZALH TEMP RE~OAD HIGH ACC VALUE ADD ISUM.4 SHIFT LOW HALF INTO POSITION SACH ISUM.4 STORE QI5 GAINED FILTERED DATA LT AGC MULTIPLY THE AGC FACTOR MPY QSUM BY THE FILTERED DATA ELEMENT PAC MOVE THE PRODUCT TO THE ACC SACH TEMP.4 SAVE TOP HALF OF ACC AN'D PLUS I MASK OFF UNUSABLE BITS SACL QSUM SAVE BOTTOM HALF OF ACC ZALH TEMP RELOAD HIGH ACC VALUE ADD QSUM.4 SHIFT LOW HALF INTO POSITION SACH QSUM.4 STORE QI5 GAINED FILTERED DATA PAGE ----* .......................................................... . The rollowing code is the time sliced code task master. The routine monitors the status Or the modem operations and sequences the code appropriately . .•...•............•...•••••...•.••...... _•..•..••.•...•••..•... MASTER CARLCK 304 EQU LAC AND BZ LAC AND BNZ B $ ONE.5 RECST HANGUP ONE.4 RECST CARLCK NORMAL LACK PLLC TBLR PLLl LACK BPLLC CHECK OPERATING STATUS FOR ENERGY DETECT IF NO ENERGY DETECT THEN HANG UP CHECK IF LOCAL CARRIER is LOCKED. IF SO SWITCH PLL' FILTERS BANDWIDTH EXECUTE NORMAL SEQUENCE * CHANGE CARRIER PLL COEF. • CHANGE BAUD CLOCK PLL COEF. Theory and Implementation of a Splitband Modem Using the TMS32010 NORMAL OVRSAM TBlR EQU lAC SUB BGEZ lACK SACl LACK ADD TBlR lAC CALA BPLLI $ SAMPLE ONE OVRSAM 15 SAMPLE TSKSEQ SAMPLE TEMP TEMP • DECREMENT THE SAMPLE COUNT • TO CHECK FOR END OF BAUD • IF NOT THEN SKIP COUNT RESET • RESTART THE SAMPLE COUNTER AT 15 * SAVE NEW COUNT VALUE * GET ADDRESS OF TOP OF TABLE • ADD IN OFFSET * GET THE PROGRAM ADDRESS * FOR THE TASK CALL * EXECUTE THE APPROPRIATE TASK UPDATE CARRIER ANGLE AT SAMPLE RATE lAC ADD AND SACl RAlPHA RDElTA MASK I RALPHA • COMPUTE ADDRESS OF NEXT • POINT FOR TABLE. * KEEP MODI28, MASK=>1FFF. • SAVE NEXT ADDRESS * EXECUTE TRANSMIT TASK SEQUENCE EQU $ * DECREMENT THE SAMPLE COUNT lAC SAMXMT • TO CHECK FOR END OF BAUD SU8 ONE BGEZ OVRSMI * IF NOT THEN SKIP COUNT RESET • RESTART THE SAMPLE COUNTER AT 15 LACK 15 OVRSMI SACl SAMXMT • SAVE NEW COUNT VALUE • GET ADDRESS OF TOP OF TABLE lACK TSKXMT ADD SAMXMT * ADD IN OFFSET • GET THE PROGRAM ADDRESS TBLR TEMP LAC TEMP • FOR THE TASK CALL • EXECUTE THE APPROPRIATE TASK CALA WAIT • WAIT FOR NEXT SAMPLE TIMEOUT 8 PAGE •• * •••••••••••••••• * ••••• ** •••••••••••••••••••••••••••••••••••• This is the soFtware automatic gain control Factor update . • The routine keeps a running average plus three baud max's t.o generate each new AGC update. Once the value is gained' the routine uses a table lookup devide to Force the Fi Iter· data max's into a tight range . MASXMT •••• * •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• AGCUPT ZALH ADD SACH lAC SUB SACL SACH BZ RET OVROUT lACK SACL LAC SACL lAC SACH LAC SUB BLZ LAC SACH lAC ADD TBLR LAC SACH RET ASHFI ADD BlZ AGCRA BSMAX, 14 AGCRA AGCNT ONE AGCNT BSMAX OVROUT 3 AGCNT AGCRA AGCLEV AGCRA,I4 AGCRA AGCLEV ONE. 14 ASHFI AGClEV,1 TEMP TEMP AGCOFF AGC AGC,IS AGC ONE,I3 ASHF2 ADD THE NEW BSMAX VALUE TO THE RUNNING AVERAGE AND SAVE IT DECREMENT RUNNING AVERAGE COUNT SAVE IT AND CHECK FOR ZERO ZERO OUT RUNNING SIGNAL MAX IF ZERO THEN UPDATE AGC ELSE RETURN TO CALLING SEQUENCE RESET RUNNING AVERAGE COUNT TO THREE MOVE AGCRA TO THE CALCULATION LEVEL DIVIDE RUNNING AVERAGE SUM BY 4 TO GET NEW RUNNING AVERAGE GET AVERAGE MAX SIGNAL lEVEL COMPARE TO 16384 IF lESS THAN SHIFT TABLE LOOKUP GET lOOKUP VALUE MOVE LOOKUP VALUE TO THE LOW HALF OF THE ACC ADD IN TABLE OFFSET AND GET AGC VALUE DIVIDE THE AGC VALUE BY 2 TO FORCE TO QI4 MODE RETURN TO CALLING SEQUENCE COMPARE TO 8192 IF lESS THAN SHIFT TABLE LOOKUP Theory and Implementation of a Splitband Modem Using the TMS32010 305 ASHF2 ASHF3 ASHF4 ASHF5 ASHF6 NOEDT LAC SACH LAC ADD TBLR RET ADD BLZ LAC SACH LAC ADD TBLR LAC SACL RET ADD BLZ LAC SACH LAC ADD TBLR LAC SACL RET ADD BLZ LAC SACH LAC ADD TBLR LAC 5ACL RET ADD BLZ LAC SACH LAC ADD TBLR LAC SACL RET ADD BLZ LAC SACH LAC ADD TBLR LAC SACL RET LACK AND SACL RET AGCLEV.B TEMP TEMP AGCOFF AGC ONE. i2 ASHF3 AGCLEV.9 TEMP TEMP AGCOFF AGC AGC.I AGC ONE. II ASHF4 AGCLEV.IO TEMP TEMP AGCOFF AGC AGC.2 AGC ONE.IO ASHF5 AGCLEV. II TEMP TEMP AGCOFF AGC AGC.3 AGC ONE.9 ASHFS AGCLEV.12 TEMP TEMP AGCOFF AGC AGC.4 AGC ONE.S NOEDT AGCLEV.13 TEMP TEMP AGCOFF AGC AGC.5 AGC >DF RECST RECST GET LOOKUP VALUE MOVE LOOKUP VALUE TO THE LOW HALF OF THE ACC ADD IN TABLE OFFSET AND GET AGC VALUE RETURN TO CALL I NG SEQUENCE· COMPARE TO 4096 IF LESS THAN SHIFT TABLE LOOKUP GET LOOKUP VALUE MOVE LOOKUP VALUE TO THE LOW HALF OF THE ACC ADD IN TABLE OFFSET AND GET AGC VALUE AGC VALUE • 2 TO ADJUST FOR LOWER SIGNAL STRENGTH RETURN TO CALLING SEQUENCE COMPARE TO 204B IF LESS THAN SHIFT TABLE LOOKUP GET LOOKUP VALUE MOVE LOOKUP VALUE TO THE LOW HALF OF THE ACC ADD IN TABLE OFFSET AND GET AGC VALUE AGC VALUE • 4 TO ADJUST FOR LOWER SIGNAL STRENGTH RETURN TO CALLING SEQUENCE COMPARE TO 1024 IF LESS THAN SHIFT TABLE LOOKUP GET LOOKUP VALUE MOVE LOOKUP VALUE TO THE LOW HALF OF THE ACC ADD IN TABLE OFFSET AND GET AGC VALUE AGC VALUE • B TO ADJUST FOR LOWER SIGNAL STRENGTH RETURN TO CALLING SEQUENCE COMPARE TO 512 IF LESS THAN SHIFT TABLE LOOKUP GET LOOKUP VALUE MOVE LOOKUP VALUE TO THE LOW HALF OF THE ACC ADD IN TABLE OFFSET AND GET AGC VALUE AGC VALUE • 16 TO AD.JUST FOR LOWER SIGNAL STRENGTH RETURN TO CALLING SEQUENCE COMPARE TO 32 LOST MINIMUM ENERGY LEVEL GET LOOKUP VALUE MOVE LOOKUP VALUE TO THE LOW HALF OF THE ACC ADD IN TABLE OFFSET AND GET AGC VALUE AGC VALUE • 32 TO AD.JUST FOR LOWER SIGNAL STRENGTH RETURN TO CALLING SEQUENCE PASSBAND SIGNAL TOOL LOW DISABLE SIGNAL ENERGY DETECT AND 'CARRIER DETECT SIGNAL RETURN TO CALLING SEQUENCE PAGE HANGUP B WAIT DUMXMT EQU $ RET SMARK EQU $ RET 306 Theory and Implementation of a Splitband Modem Using the TMS32010 ....•.•....•..•.........••...••...•..•..••.•.•.•.•...... GETDBT EQU $ IN LACK AND BZ DUMMY XMTD,PA6 • GET NEW DIBIT >30 XMTD COMO • CHECK COMMAND BITS • IF ZERO SQT MODEM, IDLE LACK SACL DMOV DMOV DMOV DMOV COEF XPTR XIBUFI XIBUFO XQBUFI XQBUFO • RECYCLE IF FINISHED LACK AND ADD TBLR LAC ADD AND SACL ADD TBLR ADD TBLR RET XMTD OFSETI XNEWPH XOLDPH XNEWPH MASK3 XOLDPH INDXPH XIBUFO ONE XQBUFO SHIFT UP THE FILTER TO MAKE ROOM FOR FOR THE NEW DATA VALUE JUST INPUT 3 CALL DEMOD RET DEMODB EQU LACK AND SACL • • • • $ >FE RECST RECST • NEW DIBIT FROM 7000 • LOOKUP NEWPHASE • • • • • GET OLDPHASE. ADD NEW PHASE. MASK WITH >0006. STORE BACK 'NEW' OLDPHASE. LOOKUP I & Q INPUTS. ATTEMPT DEMODULATION RETURN TO TASK MASTER MIDDLE OF THE BAUD RESET THE CURRENT BAUD CLOCK CORRECTION FLAG IN THE STATUS REGISTER AND SAVE IT THE PASSBAND SIGNAL . ........ DEMODUATE _----------------------------------------_ .... _... RCVR. CARRIER SINE(COSINE) WAVE GENERATOR •..................•..............•....................... DEMOD CONTI EQU $ LAC SACH LAC ADD TBLR LACK ADD AND ADD TBLR LT MPY PAC LT MPY APAC SACH LT MPY PAC LT MPY RALPHA,8 TEMP TEMP OFSETO SINA >20 TEMP MASK2 OFSETO COSA ISUM COSA • DELTA IS THE INCREMENT. ISOLATE INTEGER PORTION. · • ADD INDEX TO SINE TABLE. (Q15) . • SINE VALUE, • ADD I NDEX TO COS-I NE TABLE. • COSINE VALUE, (Q15) . ·· QSUM SINA RECI,I ISUM SINA QSUM COS A . . . o . DEMOD. I CHANNEL A=(Y\ cosA)/2 .. cosA)/2 + (Yq sin A)/2 • A=(Yf cosA) + (Yq RECI= (Yi sinAl · · · DEMOD. A = (Yi CHANNEL sinA)/2 Theory and Implementation of a Splitband Modem Using the TMS3201 Q 307 SPAC SACH • A =[ (Yi " • " RECO = (Yi RECO.I "---MUST DETERMINE ENERGY FOR BAUD CLOC LT MPY PAC LT MPY APAC SACH RECI RECI " FIND 1··2 RECO RECO " FIND O'"Z ENRGY • ENERGY (I •• '---MUST DETERMINE SIGN OF I AND 0 FOR DMI DMZ DM3 DM4 LAC BGZ LAC B LAC SACL RECI DMI MINUSI DMZ PLUSI SIGNI • DETERM I NE LAC BGZ LAC B LAC SACL RET RECO DM3 MINUSI DM4 PLUSI SIGNQ " DETERMINE ~ * SAVE SIGN ( TO CA --- •......... _...•.•... _._.RETURN __ .... -.... * INOUT GET DIBIT FROM 7000 AND XMIT N " TO THE 7000 OUT EOU LAC OR SACL OUT $ RDIBlT ,10 MINUSI BITOUT BITOUT,PA6 • MASK D15-DI "AND SAVE THE 'XMIT TO 7000 " BACK TO CAL RET •• ** ••• *------------------------------ PHASE DECODING - BINARY TO GR * THIS ROUTINE CALCULATES PHASE SHIFT • CURRENT ABSOLUTE PHASE, GREY CODE RE ••••••• *------------------------------ DECODE LAC BGZ LAC BGZ LACK B ABSZ LACK B ABSI LAC BGZ LACK B ABS3 LACK RECI ABSI RECO ABSZ Z DIFFER 3 DIFFER RECQ ABS3 1 DIFFER DIFFER SACL SUB BGEZ ADD DFI ADD TBLR LAC SACL TEMP ROLDPH DFI FOUR RPHSE RDIBIT TEMP ROLDPH 0 · · DETERMINE ABS PHASE IS Z (0 " PHASE IS · · · · 3 (;; PHASE IS (I PHASE IS 0 (C * SUBTRACT PRE\ LUTE PHASE (E MAP PHASE CHI ***** •• *------------------------------ COMPUTE CARRIER ERROR SIGNAL. e(t) = RECI*SIGNO - RECO"SIGNI •••• ****------------------------------ 308 Theory and Implementation of a Splitband Modem Using the TMS32010 COMERR ZAC LT MPY LTA MPY SPAC SACH RECI SIGNO RECO SIGNI ERROR, I • ERROR IS IN 012 •••••••• _-----------------------------------------* ••••••• FILTER ........ LOOP _----------------------------------------_ ....... . ZAC LT MPY LTA MPY APAC SACH PLL2 ERROR PLLI ERRSIG ERRSIG,I • ERRSIG IS IN 012 .•............................•..•.....•.....•.............. • CORRECT PHASE ERROR ONLY AT MIDDLE OF BAUD .........•.......................•......•................... Adjust carrier phase +/one table entry iF - (2"trshld) > error> trshld - (2"trshld) < error » trshld two table entries iF RALPHA is current local carrier table index.(in MSB ) CKEROR SUBIA ERRI ADDIA ERR2 LAC BGZ ADD BGZ ADD BGZ LAC SUB B LAC SUB B SUB BLZ SUB 8LZ· LAC ADD B LAC ADD AND SACL RET LAC OR SACL RET ERRSIG ERRI TRSHDI ERRETN TRSHDI SUBIA RALPHA ONE,9 ERR2 RALPHA ONE,8 ERR2 TRSHDI ERRETN TRSHDI ADDIA RALPHA ONE,9 ERR2 RALPHA ONE,B MASKI RALPHA · IF error is -ve add threshold " Sti I I -ve? .. add again " st i I I -ve? .. · · ··· ·· · Error » trshld; add 2 to index Error > trshld; add I to index Error fa +ve; subtract threshold Error > trshld see IF error » trshld No •.• add one to index Yes .•. add 2 to Index SUB 2 same as ADD >7E in modulo 128 • Keep RALPHA modulo 12B save new index Return with corrected RALPHA ·· · ...............•..............••.......................••.. ERRETN RETA ONE,4 RECST RECST " IF :error\ less than threshold set Flag in status register BAUD CLOCK ALLIGNMENT .............•....•..•• -................... -•.............. BDCLKI CALL LAC SACL RET BDCLK2 CALL LAC AND BNZ LAC SUB SACL DEMOD ENRGY PENRGY " ENRGY = E(3) • STORE IT IN PENRGY DE MOD RECST ONE RETB ENRGY PENRGY BERROR • TEST IF CORRECTION OF THE • BAUD CLOCK IS MADE " IF SO THEN RETURN • ENRGY = E(II), PENRGY E(3) " FORM ERROR SIGNAL " BERROR = E(II)-E(3) •••••••• _------------------------------------------** •••••••• LOOP FILTER Theory and Implementation of a Splitband Modem Using the TMS32010 309 •••••••• _-----------------------------------------_ ••••• *.* •• ZAC LT MPY LTA MPY APAC SACH "---APPLY LAC BGEZ ADD BGEZ ADD BGEZ LAC SUB SACL SUBIa a LAC SUB SACL B POS SUB BLZ SUB BLZ LAC ADD SACL B ADDIB BPLL2 BERROR BPLLl BEROUT BEROUT.l " BE ROUT [N Q[4 CORRECT[ON BE ROUT POS TRSHD2 RETB TRSHD2 SUB[B SAMPLE ONE.1 SAMPLE RETB SAMPLE ONE SAMPLE RETB TRSHD2 RETB TRSHD2 ADD1B SAMPLE ONE. [ SAMPLE RETB SAMPLE ONE SAMPLE RECST ONE RECST " TEST BERROUT S[GN. " " " * " * * " * * " * " * " " * * [F :BERROUT: 2*TRSHD MAKE TWO SAMPLE ADJUSTMENT OF THE SAMPLE (BAUD CLOCK) COUNT. [F TRSHD<:BERROUT:<2"TRSHD MAKE ONE SAMPLE ADJUSTMENT OF THE SAMPLE (BAUD CLOCK) COUNT. BERROUR [S POS[TIVE. THEREFORE ADJUST CLOCK BY ADVANC[NG SAMPLE COUNT. [F :BERROUT:>2*TRSHD MAKE TWO SAMPLE ADJUSTMENT OF THE SAMPLE (BAUD CLOCK) COUNT. LAC " [F TRSHD<:SERROUT:<2"TRSHD * MAKE ONE SAMPLE ADJUSTMENT ADO SACL " OF THE SAMPLE (BAUD CLOCK) COUNT. " SET FLAG TO [ND[CATE THAT THE BAUD RETB LAC OR " CLOCK ADJUSTMENT [5 MADE. SACL RET ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• * •••••• END 310 Theory and.lmpiementation of a Splitband Modem Using the TMS32010 ! Appendix E TMS7742 Source Code Theory and Implementation of a Splitband Modem Using the TMS32010 311 TITL OPTION TMS 7742 MODEM INTERFACE PROGRAM' XREF,TUNLST 7042 PORT ASSIGNMENTS • APORT A7 A6 AS A4 A3 A2 OHR_ N.C. RCVO ATE_ A_IO SQT (0) (X) (I) (0) (0) (0) Al OTR (I) AO OCO B7 NB8 (0) (1) • BPORT • CPORT B6 NB4 (0) B5 NB2 (0) B4 NBI B3 TXO B2 OP BI OSR 80 CTS (0) (0) (0) (0) (0) C7 C6 C5 C4 C3 C2 CI CO ACKW ACKR CM02 CMOI TOB3 TOB2 TOBI TOBO (0) (0) (0) (0) (0) (0) (0) (0) * OPORT 07 06 05 NEWO NEWI COT 04 ENB 03 02 0I DO ROB3 ROB2 ROBI ROBO (1) (1) (I) (I) (I) (I) (I) (1) ----------------------------------------------------- • SWSTAT +-------------------------------+ 17:6:5:4:312: lID: +-------------------------------+ * BIT7: modem type 0= BI03 mode 1= B212 mode • BIT6: timer flag 0= carrier wait timer enabled 1= 1200 Hz timer enabled • BITS: 1st dibit flag 0= flag reset I = flag set * lOT 'OSPMOOM' OPTION XREF AORG >F006 · 7041 Peripheral Memory Symbols 10CNTO TIOATA TICNTL APORT AD DR BPORT CPORT CDOR OPORT DOOR IOCNTl SMOOE SCTLO SSTAT T20ATA T2CNTL T30ATA SCTLI RXBUF TXBUF MPRTC MPRTD EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU PO P2 P3 P4 P5 P6 P8 P9 PIO PII PI6 PI7 PI7 PI7 Pl8 PI9 P20 P21 P22 P23 >108 >lOA • Bit Masks. 312 Theory and Implementation of a Splitband Modem Using the TMS32010 BITO BITI BIT2 BIT3 BIT4 BITS BIT6 BIT7 EQU EQU EQU EQU EQU EQU EQU EQU >01 >02 >04 >OB >10 >20 >40 >80 NOTa NOT! NOT2 NOT3 NOT4 NOTS NOT6 NOT7 EQU EQU EQU EQU EQU EQU EQU EQU >FE >FD >FB >F7 >EF >DF >BF >7F • Asc Ii constants TAB BLANK COMMA LF CR BS POUND STAR EQU EQU EQU EQU EQU EQU EQU EQU ISA ISZ EQU >41 EQU >SA >09 >20 >2C 10 J3 8 >23 >2A tab character space character BACKSPACE CHARACTER '#' 'A' 'Z' • 7041 RAM map RDIBIT DIBIT2 DIBITI TEMPI TEMP2 RBIT14 RBIT17 DESREG FLAG COUNTE BITCNT CHRCNT TRNMIT STPFLG MCOUNT XDBIT2 XDBITJ XBIT!7 XBITJ4 SCMREG XDIBIT CONTER RBTCNT XMTCHR ADDRES PNTR SWSTAT LOCHI LOCLO ADDRI INDEXI INDEX2 COUNT! COUNT EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU R2 RDIBIT+I DIBIT2+1 DIBITI+I TEMPI+I TEMP2+1 RB1T14+1 RB1T17+1 DESREG+I FLAG+ 1 COUNTE+I BITCNT+I CHRCNT+I TRNMIT+I STPFLG+I MCOUNT+I XDBIT2+1 XDBIT!+I XBIT!7+J XBIT!4+1 SCMREG+I XDIBIT+I CONTER+J RBTCNT+I XMTCHR+2 ADDRES+I PNTR+I SWSTAT+I LOCHI+I LOCLO ADDRI+I INDEXI+l INDEX2+1 COUNT! + I receiver input sequence From the 32010 temporary register (receiver) temporary register (xmltter) character to be transmitted stop bit deleted Flag mark counter xmitter input dibit counter register character bit counter (xmt) input character buFFer command buFFer address pointer counter register soFtware status Flag general purpose register general purpose register general use double register counter Theory and Implementation of a Splitband Modem Using the TMS32010 313 COMBUF 50 51 52 53 54 55 INT5TM VALUE "'5GM M5GL CWTI CWT2 MSTIME DELYRI STACK EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU COUNT+I COMBUF+40 50+1 51+1 52+1 53+1 54+1 55+1 INT5TM+I VALUE+I MSGM+I M5GL+I CWTI+I CWT2+2 MSTIME+I RIOO ALL ZERO ONE TWO THREE EIGHT NINE TEN CNTVAL ADDTOP ADDBOT EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU >FF >00 >01 >02 >03 >08 >09 >OA >DC 50-1 COMBUF beginning of the command buFFer carriage return register line Feed register backspace register # of rings to answer on # of rings detected escape code character Interrupt 5 timer register contains numerical value of parameters masseage address register carrier wait abort timer mil llsec timing register ••••••• _---------------------------------------* •••••• Initialization ....... _--------------------------------------_ ...... . INIT MOVP s.c. mode. enable IntZ and ?;>OF.IOCNTO MOVP MOVP MOVP MOVP MOVP MOVP MOVP MOVP MOVP HOVP ORP ANDP HOV LD5P HOV HOV HOV HOV MOV MOV MOV MOV MOV MOV MOV MOV CLR MOV MOV ~>OO.IOCNtl Inti disable Int4 and intS ~>OC.APORT ?;>9C.ADDR set direction of APORT ~>FB.8PORT ?;>CF.CPORT ?;>FF.CDDR ?;>CF.DPORT ?;>OO.DDDR '1.155.T2DATA ?;>81. T2CNTL ?;B 1T2. BPORT set direction of CPORT set direction of DPORT reset the 99531 dialer ~NOT2.BPORT ?;5TACK.B load stack pointer ~ALL.DIBITI ~ALL.DIBJT2 ?;ONE.RBJTI7 ?;ONE • RB I TI 4 ~ALL • XDB JT 1 ~ALL. XDS ITZ ?;ONE. XB IT 17 ?;ONE.XBJTI4 ,,>CO.SWSTAT carriage return character line feed character backspace character # of rings to answer on # of· r f ngs detected escape code character soFtware Flag default conditions "NOTO.BPORT set CTS_ ?;CR •. SO ~LF.51 ~B5.S2 '1.0NE.S3 54 '7.'+'.,55 • main routine AI\IDP EINT 314 Theory and Implementation of a Splitband Modem Using the TMS320W TOP CALL MOVO CALL @AUTOBO '7oHELLO,MSGL @PRINT Autobaud to terminal speed Send hello message * look Tor input commands. LOOK CALL MOVO CLR LK4COM BTJZP MOVP MOVP WAIT4 BTJZP CMP JEQ CMP JEQ CMP JEQ CMP JEQ CMP JEQ CMP JEQ CMP JNE DEC CLR STA INC JMP @CLEAR c I ear the corrvnand bUTTer '7oADDTOP,ADDRES point to top oT the bUTfer PNTR c I ear buffer command po inter '7oBITl,SSTAT,LK4COM ; command received? RXBUF,A A, TXBUF echo '7oBlT2,SSTAT,WAlT4 '7oCR,A last character? EXEC yes, go execute command '70' C' ,A LK4COM '70')' ,A LK4COM '70'-' ,A LK4COM '70' ,A LK4COM '70'/' ,A LK4COM '7oBS,A NXTSTG PNTR A *ADDRES ADORES LK4COM Ignore Ignore ignore ignore ignore backspace? yes, go get new command decrement pointer CLEAR OUT THE BUFFER AT THE CURRENT lOCATION point to the previous location NXTSTG INC STA DECO CMP JEQ JMP PNTR *ADDRES ADORES '7040,PNTR ERR LK4COM command bUTTer pointer location Tor command location Tor next command al low 40 chars maximum more than 40 .. clear bUTTer keep goIng till ERR @ClEAR '7oERROR,MSGL @PRlNT '7oSTACK,B clear command bUTTer send error message EXEC CALL MOVD CALL MOV lDSP BR MOVD LOA CMP Jl CMP JHS CLR DECO SUB MOV RL LOA MOV INC LOA MOV BR reset the stack pointer @lOOK '7oADDTOP,ADDRES *ADDRES '7o'A',A ERR '7o'Z'+l,A ERR initial ize address point get command B Parameter 'bufTer pointer Check for A thru Z ADORES '7o'A',A A,B B B*2 @COMLlSCB) A,lOCHl MSB address B @COMLlSCB) A.LOClO *ADDRI lSB address execute command PAGE Theory and Implementation of a Splitband Modem Using the TMS32010 315 ·...... _--------------------------------------_ ...... . Local Digital Loopback Test ••••••• _---------------------------------------* •••••• LDLB EQU MOVD CALL MOV BR $ RESPOND TO COMMAND TO DTE BY PRINTING TEST COOE SET COMMAND TO LDLB MODE AND RUN THE 320 "LDLBM,MSGL @PRINT ">IO,R23 @G0320 ....... PAGE _--------------------------------------_ ...... . Dial Blind ....... _--------------------------------------_ ...... . DB OR MOVP ORP ORP CALL MOV CLR ORP CHKDCD BTJOP AND BTJZ ORP ORP BR ....... "BIT6,SWSTAT ">2A,IOCNTO "B ITO, BPORT ">SC,APORT disable RI interrupt turn orr CTS originate mode, squelch 532, and go orr hook dial initialize carrier abort timer. @DIAL "IS,CWTl CWT2 "B 1T2, IOCNTO enable carrier abort interrupt walt ror DCD - ~BITO,APORT,CHKDCD ~NOT6.SWSTAT ~BIT7,SWSTAT,BI03 check ror modem type 32010 In B212 originate mode ~BIT3.CPORT ~BIT2.CPORT @B212 ----------------------------------------.~ ..... ....... _--------------------------------------_ ...... . BI03 Bel I 103 Call BTJOP Initiation • "BITO,APORT,BI03 ; Wait ror DCD - * 'Send originate tone. ORP ANDP ~B IT 4, APORT MOVP ~>4A,IOCNTO ~NOT2,APORT ATE = I unsquelch 532. got DCD-' disable abort interrupt * Wait SOOms MOVD CALL ANDP MOVD CALL BR ~SOO,MSTIME @MSDLY ~NOTO,BPORT ~CONN3.MSGL @PRINT @DATI03 activate CTS_ send connect 300 message ; enter data mode •• * ••• *------------------------~--------------- ••••••• DIAL - Dial number stored In ADORES • • * ••••• ----------------------------------------•• ~* ••• DIAL ANDP ~NOT4,APORT ; ATE_ = 0, enable EXI mode * Execute dialing. MOVD CALL NXTDIG LOA CMP JNE ~4000,MSTIME @MSDLY *ADDRES ~ZERO,A Initial dial tone wait or 2 second Load subcommand Is it the last command? NOTEND • End or dtallng. RETS 316 Theory and Implementation of a Splitband Modem Using the TMS32010 • Case statement to'determine subcommand. ADORES 1.' 0' .A NOTNUM 1.'9'+I.A NOTSPC @ISANUM NOTEND DECO CMP JL CMP JHS BR NOTNUM CMP JEQ CMP JEQ CMP JEQ NOTSPC BR "',',A DPAUSE 1.STAR,A ISSTAR 1.POUND.A APOUND @NXTDIG update address check less than '0' check greater than '9' , - dial tone wait - tone dial . '#' - tone dial # • Wait for a dial tone. DPAUSE MOV CALL BR · 1.TWO.VALUE @SECDLY @NXTDIG Bl ind delay Dial a digit. ISSTAR MOV 1.TEN,A JMP OUTDIG APOUND MOV 1.11.A JMP OUTDIG ISANUM SUB 1.'0' ,A OUTDIG ANDP 1.>OF.BPORT RL A RL ·A RL A RL A ORP A.BPORT PNDWTO BTJZP 1.BITI.APORT.PNDWTO ORP 1.BIT2.BPORT PNDWTI BTJOP 1.BITI.APORT.PNDWTI ANDP 1.NOT2,BPORT PNDWT2 BTJZP 1.BITI.APORT.PNDWT2 BR @NXTDIG dial . if tone dial dial # if tone dial dial a number clear old digit get the correct value send new wait for set DP wait for clear DP wait for digit acceptance PND low PND high ....... PAGE _--------------------------------------_ ...... . BELL 1200 BPS MODEM ALGORITHM ....... _--------------------------------------_ ...... . B2I2 G0320 EQU MOV CLR CLR CLR CLR CLR CLR CLR ANDP CLR STA ORP $ '1.>20.R23 R2 RII RI2 RIB RI9 RI3 R20 1.NOTO,BPORT A @MPRTC 1.>CO,CPORT SET COMMAND TO MODEM RUN CLEAR COM STATUS REG I NIT I All ZE 'SCRAMBLER HISTORY AS ALL ZEROS INITIALIZE.DESCRAMBLER HISTORY AS ALL ZEROS INITIALIZE DESCRAMBLER HISTORY AS ALL ZEROS ACTIVATE CTS TO DTE CYCLE THE CLEAR LINES OF THE I/O CONTROL RESET 320 ACK LINES START UP MODEM OR DLB TEST STOPB2 MOV CALL MOV OR '1.3.RIO @SCRAM RIO.A R23.A SET DIBIT TO MARKS AND SCRAMBLE IT HOLD IT FOR TRANSMIT OR IN COMMAND BITS Theory and Implementation of a Splitband Modem Using the TMS32010 317 ANDP ~>CO,CPORT ORP A,CPORT TRANSMIT UNSCRAMBLED MARKS AND MRCI BTJZP %BIT7,DPORT,MRC2 CHKTCH BT JOP 1,B I T6, DPORT , RECDTE BR @MRC3 RECDTE BTJOP ~BITI,SSTAT,DTEGET XMTDTE BTJOP ~BITO,SSTAT,DTEPUT JMP MRCI CLEAR OFF CURRENT BITS SEND OUT SCRAM MARKS RECEIVE WAIT FOR WRITE FROM 320 WAIT FOR READ FROM 320 PROCESS READ FROM 320 IS DTE REC BUF FULL IS DTE TRANS BUF EMPTY LOOK AGAIN CODE INTERFACE TO DrE DTEGET EQU MOVP CMP JMP CLR STA BR OVRSQT INC BTJO BTJO OR MOV MOV OR JMP DTEGI MOV OR JMP $ RXBUF,A %>IB,A OVRSQT A @MPRTC @TOP R24 ~BIT5,R2,DTEGER 1.BIT3,R2.DTEG! ~BIT7.R2 A.R7 1.>A,R2! ~B!T3.R2 XMTDTE A,R28 1.BIT5.R2 XMTDTE DTEGER CLR STA MOVD CALL BR @MPRTC 1.BUFERR .MSGL @PRINT @TOP DTEPUT EQU BTJZ MOV MOVP AND JMP 1.BIT4.R2.MRCI R29.A A,TX8UF 1.NOT4.R2 MRCI A YES. GET THE CHARACTER? I F A <> ESCAPE THEN CONTINUE ELSE SQUELCH THE THE 320 MODEM AND AND RETURN TO MONITOR INCREMENT BYTE COUNT CHECK FOR BUFZ FULL CHECK IF 1ST CHAR FLAG FOR START BIT IF SO THEN RESTART RESET XMT COUNT SET TRANS ACTIVE CHECK OUTPUT SAVE IT IN THE BUF2 SET BUF2 FULL FLAG CHECK OUTPUT SQUELCH THE 320 MODEM SEND ERROR MESSAGE TO USER TERMINAL EXIT ROUTINE $ CHECK FOR CHARACTER READY GET BUFFERED CHARACTER SEND IT TO THE DTE RESET BUFFER FULL FLAG RETURN TO FLAG LOOP PAGE RECEIVE DIBITS FROM THE 320 MRC2 RNB ANDP ORP MOVP MOV BTJZ AND CALL BTJO RRC JC RRC RRC MOV JMP RRC JC MOV RCHARO OR BR 318 '1.> 7F , CPORT 1,>BO.CPORT DPORT.A A.RIO '1.B I T5. A. CHKTCH 1.3 .R! 0 @DSCRAM 7.BIT2.R2.RCHARI RIO RNB RIO R5 1.7.R22 RCHARO RESET WRITE ACKNOWLEDGE BY TOGGLING LINES GET THE RETURNED DATA AND HOLD IT IN RIO IF NO CARRIER THEN DONE AND OFF STATUS DE SCRAMBLE IT CHECK FOR REC CHAR ACTIVE CHECK DIBITO IF HIGH THEN CHECK NEXT SAVE LSB OF RECEIVE CHAR IN CHAR HOLD REG SET REC BIT COUNT REG SKIP OVER NEXT CHECK RIO CHKTCH '/.8.R22 %BIT2.R2 @RECOTE CHECK DIBITI IF HIGH THEN CHECK XMTCHAR SET REC BIT COUNT REG SET REC CHAR ACTIVE CHECK DTE Theory and Implementation of a Splitband Modem Using the TMS32010 RCHARI SUB JP JZ RRC RRC MOV OR CLR AND JMP ~2.R22 RCHAR3 RCHAR2 RIO R5 R5.R29 ~BlT4.R2 R5 ?;NOT2.R2 RNB CHECK BIT P051TION IF > 0 GET 2 BITS IF = 0 GET I BIT PUT BIT7 INTO REC CHAR HOLD REG PUT CHAR IN OUT BUFFER SET BUFFER FULL FLAG CLEAR BUFFER FOR NEXT CHAR RE5ET REC CHAR ACTIVE CHECK DIBITI FOR START BIT RCHAR2 RRC RRC RRC RRC MOV OR CLR AND BR R5 1.NOT2.R2 @RECDTE SAVE MSB OF RECEIVE CHAR INTO REC CHAR HOLD REG PUT BIT7 INTO REC CHAR HOLD REG PUT CHAR IN OUT BUFFER SET BUFFER FULL FLAG CLEAR BUFFER FOR NEXT CHAR RESET REC CHAR ACTIVE CHECK DTE RCHAR3 RRC RRC RRC RRC BR RIO R5 RIO R5 @RECDTE MOVE DIBlTO TO REC CHAR HOLD REG MOVE 0 I B I Tl TO REC CHAR HOLD REG CHECK DTE RIO R5 RIO R5 R5.R29 ~BlT4.R2 PAGE SEND DIBITS TO THE 320 MRC3 TCHARO TCHOO TCHARI TCHAR2 TCHAR3 TCHAR4 ANDP ORP BTJO BR CLR SUB JP JNZ RRC JNC OR BTJO AND OR JMP CMP JL CLR AND MOV MOV AND JMP OR MOV OR MOV AND JMP BTJO AND BR CMP JL CLR ~>BF.CPORT 1.>40.CPORT ~BIT3.R2.TCHARO @STOPB2 RIO 1.2.R21 TCHAR6 TCHAR3 R7 TCHOO 1.SlTO.RIO ?;SIT5. R2. TCHAR I ~N0T3.R2 ~BlTl .Rl 0 TCHSND 1.9.R24 TCHAR2 R24 ?;NOTl.RlO R2S.R7 ~9.R2l ?;NOT5.R2 TCHSND '7.B IT I. RIO R2S.R7 'I.BIT7.R2 ?;>A.R21 ?;NOT5.R2 TCHSND ?;BIT5.R2.TCHAR4 ~NOT3.R2 @STOPB2 ~9.R24 TCHAR5 R24 RESET ACKNOWLEDGE BY TOGGLING LINES CHECK FOR TRANS CHAR ACTIVE IF NOT SEND STOPBITS CLEAR OUT DIBIT REG CHECK POS IT ION > 2 MEANS TRANSMIT BITS IF PATTERN ONE THEN ODD GET BIT 7 FROM CHAR IF NO CARRY DIBITO=O ELSE DIBITO=I IF BUF2 EMPTY RESET TRAN ACTIVE SIT SET DIBITI TO STOP AND SEND DIBlT CHECK CHAR COUNT IF < DON'T DELETE STOPBIT CLEAR BYTE COUNT SEND DIBITI TO START LOAD IN NEW CHAR SET SIT COUNT RESET BUF2 FULL FLAG SEND THE DIBlT SEND DIBITI TO STOP LOAD IN NEW CHAR FLAG IN START BIT SET BIT COUNT RESET BUF2 FULL FLAG SEND THE DIBlT IF BUF2 EMPTY RESET TRAN ACTIVE BIT AND SEND MARKS CHECK CHAR COUNT IF < DON'T DELETE STOPBIT CLEAR BYTE COUNT Theory and Implementation of a Splitband Modem Using the TMS32010 319 · MOV OR MOV AND JMP TCHARS MOV MOV MOV AND JMP TCHAR6 BTJZ AND JMP TCHAR7 RRC JNC OR TCHOI RRC JNC OR TCHSND EQU CALL MOV ANDP ORP BR R28.R7 "BIT7.R2 "8.R21 "NOTS.R2 TCHAR6 ';I.RIO R28.R7 "9.R21 "NOT5.R2 TCHSND "BIT7.R2.TCHAR7 ';NOT7 .R2 TCHOI R7 TCHOI ?I.RIO R7 Tq-iSlljO "'2.RIO $ @SCRAM Rio.A ,,>FO.CPORT A.CPORT @RECDTE LOAD IN NEW CHAR FLAG' IN START BIT SET BIT COUNT RESET BUF2 FULL FLAG SEND THE DIBIT SEND STOP THEN START LOAD IN NEW CHAR SET BIT COUNT RESET BUF2 FULL FLAG SEND THE .DIBIT START BIT NEEDED RESET START BIT FLAG SKIP OIBITI . GET NEXT BIT OF CHAR IF LOW SKIP BIT SET ELSE SET OIBITO TO ONE GET NEXT BIT OF CHAR IF LOW SKIP BIT SET ELSE SET DIBIT! TO ONE r AND SCRAMBLE IT HOLD IT FOR TRANSMIT CLEAR OUT DIBIT VALUE SEND TO PORT WAIT FOR RETURN LOOP PAGE .... *.*.*.*---------------------------------------_ •••.,. * ••• Receiver descrambler X(N) = Y(N-17) XOR Y(N-14) XOR YeN) ••••••• ----~----------------------------------••••• *. $ DSCRAM EQU ~ MOV CLR CLR MOV RL RLC RLC RLC RLC RLC RLC RLC RLC RLC XOR XOR CLRC RRC JNC OR OVRSWI EQU RLC RLC RLC CLRC RLC RLC RLC ijRC RRC RRC RRC RIO.B RI6 RI7 RII.A A A RI7 A RI7 A A RIG A RIG RIG.RIO RI7.RIO RIO OVRSWI ';2.RIO SAVE SCRAMBLED DIBIT CLEAR THE Y(N-I4) RlFERENCE CLEAR THE Y(N-I7) REFERENCE GET THE DESCRAMBLER HISTORY SHIFT OUT Y(N-IS) GET HISTORY Y(N-17) AND PUT INTO REFERENCE SHIFT OFF TWO MORE BITS SAVE Y(N-IGi REFERENCE TO GET TO THE Y(N-I4) AND GET HISTORY AND PUT INTO REFERENCE GET HISTORY Y(N-I3) AND PUT INTO REFERENCE RIO=X(N) XOR Y(N-14) RIO=X(N) XOR Y(N-14) XOR Y(N-17) CLEAR OUT THE CARRY BIT REVERSE THE DIBITS FOR ALLIGNMENT WITH SCRAMBLER IF CARRY THEN BIT HIGH $ RI3 RI2 Rll RI3 RI2 Rll B RI3 B RI.3 SHIFT UP THE LSB HISTORY AND CARRY TO CSB HISTORY AND CARRY TO MSB HISTORY CLEAR THE CARRY BIT SHIFT UP THE LSB HISTORY AND CARRY TO CSB HISTORY AND CARRY TO MSB HISTORY GET DIBITO AND AND SHIFT IT INTO RI3 GET DIBITO AND AND SHIFT IT INTO RI3 BITS BITS BITS BITS BITS BITS RETS 3iO Theory and Implementation of a Splitband Modem Using the TM$32010 ....... PAGE _--------------------------------------_ ...... . Transmitter Scrambler ..... YeN) = Y(N-17) XOR Y(N-14) XOR X(N) ....... _--------------------------------------_ ...... . SCRAM EQU CLRC RRC JNC OR OVRSW2 EQU CLR CLR MOV RL RLC RLC RLC RLC RLC RLC RLC RLC RLC XOR XOR MOV RLC RLC RLC CLRC RLC RLC RLC RRC RRC RRC RRC $ CLEAR OUT THE CARRY BIT REVERSE THE DIBITS FOR ALLIGNMENT WITH SCRAMBLER IF CARRY THEN BIT HIGH RIO OVRSW2 ';2,RIO $ RI6 RI7 RI8,A A A RI7 A RI7 A A Ri6 A RIG RIG,RIO RI7,RIO CLEAR THE Y(N-14) REFERENCE CLEAR THE Y(N-17) REFERENCE GET THE SCRAMBLER HISTORY SHIFT OUT Y(N-18) GET HISTORY Y(N-17) AND PUT INTO REFERENCE SHIFT OFF TWO MORE BITS ; SAVE Y(N-16) REFERENCE TO GET TO THE Y(N-14) AND GET HISTORY AND PUT INTO REFERENCE GET HISTORY Y(N-13) AND PUT INTO REFERENCE RIO=X(N) XOR Y(N-14) RIO=X(N) XOR Y(N-14) XOR Y(N-17) RIO,B R20 RI9 RI8 R20 RI9 RI8 B R20 B R20 HOLD SCRAMBLED DIBIT FOR SHIFT UP THE LSB HISTORY AND CARRY TO CSB HISTORY AND CARRY TO MSB HISTORY CLEAR CARRY BIT SHIFT UP THE LSB HISTORY AND CARRY TO CSB HI STORY AND CARRY TO MSB HI STORY GET DIBITO AND AND SHIFT IT INTO R20 GET DIBITO AND AND SHIFT IT INTO R20 HISTORY BITS BITS BITS BITS BITS BITS RETS PAGE ....... _--------------------------------------_ ...... . ••••• MSDLY - Wait MSTIME number or milliseconds ••••• ....... _--------------------------------------_ ...... . MSDLY EQU $ HERE2 MOV DJNZ DECO JC RETS ';CNTVAL,DELYRI DELYRI,HERE2 MSTIME MSDLY load the inner counter (9) (9+2) (II) (7) ....... _--------------------------------------_ ...... . SECDLY - Wait VALUE number seconds ....... _--------------------------------------_ ...... . of SECDLY CMP JEQ NXTSEC MOVD CALL DJNZ NODLY RETS ';O,VALUE NODLY ';IOOI,MSTIME @MSDLY VALUE,NXTSEC ... ...----------------------------------------...... . ~ PRINT subroutine ....... _--------------------------------------_ ...... . • MSGM and MSGL contain the address • For messages to the screen of text to print Theory and Implementation of a Splitband Modem Using the TMS32010 321 PRINT CALL PRINT! LOA JZ HOVP WAITS BTJZP INC ADC JHP WAIT6 CALL RETS @CRLF "HSGL WAIT6 A,TXBUF print each character in text statement walt for txbuf ready ~BITO,SSTAT,WAITS HSGL ~O,HSGH PRINT! @CRLF " send carriage return/line r.eed CRLF HOV HOVP CRWAIT BTJZP HOV HOVP LFWAIT BTJZP RETS SO,A A, TXBUF ; send carriage return ~BITO,SSTAT,CRWAIT SI,A A,TXBUF send line feed ~BIT2,SSTAT,LFWAIT ....... PAGE _--------------------------------------_ ...... . PRINT subroutine ....... _--------------------------------------_ ...... . AUTOBD EQU HOV HOVP SET HOD HOVP HOVP " HOVP HOVP HOVP $ ~>20,A A,T3DATA 'IoO,PI7 'Io>60,SCTLO SET BAUD CLOCK FOR FOR OVERSPEED DTE Write to PI7 to guarantee we are talking to SCTLO. then reset serial port B,SHODE ~>15,SCTLO ~>40.SCTL1 HOVP HOVP HOVP HOVP RETS 'IoBIT6.SCTLO TEXT BYTE 'ERROR' 0 ~>6E.SHODE Parity error. parity is disabled in DTE. Disable parity of port 'Io>15.SCTLO ~>40.SCTL1 ....... _--------------------------------------_ ...... . ..... screen messages - text statements ....... _--------------------------------------_ ...... . ERROR BuhRR TEXT BYTE 'DTE BUFFER OVERFLOW ERROR' 0 " CONNI2 TEXT BYTE 'CONNECT 1200' 0 CONN3 TEXT BYTE 'CONNECT 300' 0 NOCAR TEXT BYTE 'NO CARRIER' 0 . RCALL TEXT BYTE 'RING' 0 RESET TEXT BYTE 0 TEXT BYTE 'EXECUTE LDLB, ENTER CHARACTERS' 0 LDLBH 322 'OK' Theory and Implementation of a Splitband Modem Using the TMS32010 IALBM TEXT BYTE o 10RGM TEXT BYTE o IENBM TEXT BYTE o ISQTM TEXT BYTE o ANSM TEXT BYTE o HONM TEXT BYTE o HOFFM TEXT BYTE o HELPM TEXT BYTE TEXT BYTE TEXT BYTE TEXT BYTE TEXT BYTE TEXT BYTE TEXT BYTE TEXT BYTE TEXT BYTE TEXT BYTE TEXT BYTE TEXT BYTE TEXT BYTE BYTE 'TABLE OF COMMANDS' >OD.>OA 'A ==> PUT MODEM IN ANSWER MODE' >OD.>OA '0 ==> BLIND DIAL FOLLOWING DIGITS' >OD.>OA 'E ==> ENABLE 320 RECEIVER' >OD.>OA 'H ==> DISPLAY HELP LIST' >OD.>OA 'J ==> PUT LINE ON HOOK' >OD.>OA 'K ==> TAKE LINE OFF HOOK' >OD.>OA 'L ==> RUN DIGITAL LOOP BACK TEST' >OD.>OA 'M ==> RUN ANALOG LOOP BACK TEST' >OD.>OA '0 ==> PUT MODEM IN ANSWER MODE' >OD.>OA 'R ==> RUN THE 320 MODEM' >OD.>OA 'S ==> SQUELCH THE 320 RECEIVER' >OD.>OA 'Z ==> RESTART THE 7000' >OD.>OA o TEXT BYTE o HELLO 'INITIALIZE 320 FOR ALB TEST' 'INITIALIZE 320 FOR ORIGINATE MODE' 'INITIALIZE 320 TO REENABLE RECEIVER' 'INITIALIZE 320 TO SQUELCH RECEIVER' 'INITIALIZE 320 TO ANSWER MODE' 'PUT LINE ON HOOK' 'TAKE LINE OFF HOOK' 'DSP MODEM. VERSION 1.0' ** ••• **---------------------------------------_ •• * •• command address table *. * *. * •• *-¥---------------------------------------* •••••• COMLIS DATA ANSMDM INITIALIZE TO ANSWER DATA ERR DATA ERR DATA DB dial command REENABLE RECEIVER ON 320 DATA ENBREC DATA ERR DATA ERR DATA HELP HELP LIST DATA ERR DATA HOOKON TAKE LINE ON HOOK DATA HOOKOF TAKE LINE OFF HOOK DATA LDLB LOCAL DIGITAL LOOP BACK DATA IALB INITIALIZE TO ALB MODE Theory and Implementation of a Splitband Modem Using the TMS32010. 323 DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA ERR 10RIG ERR ERR B212 SQTREC ERR ERR ERR ERR ERR ERR -INIT INITIALIZE TO ORIGINATE RUN MODEM ROUTINE SQUELCH THE RECEIVER ; reset command ••••••• _--------------------------------------_ ••• **** INITIALIZE TO ALB MODE ....... _--------------------------------------_ ...... . IALB EQU $ IALBI CLR STA ORP ORP BTJOP MOVD CALL CLR STA BR A @MPRTC CYCLE THE CLEAR LINES OF THE I/O CONTROL SET ALB INIT COMMAND PUT 320 IN INIT COMMAND MODE ~BIT6.DPORT.IALBI CHECK 320 RESPONSE ~IALBM.MSGL GET CONFIRMATION MESG @PRI NT AND SEND IT A CLEAR OUT THE COMMAND @MPRTC FROM I/O LINES @TOP EX I T ROUT I NE ~BITO.CPORT ~>FO.CPORT •••••• *---------------------------------------_ ••••••• INITIALIZE TO ORIGINATE MODE .** •••• _--------------------------------------_ ••••••• 10RIG EQU $ CLR A CYCLE THE CLEAR LINES STA @MPRTC OF THE I/O CONTROL ORP ~BITI.CPORT SET ORIG INIT COMMAND ORP ~>FO.CPORT ; PUT 320 IN INIT COMMAND MODE 'IORG I BT JOP ~BIT6. DPORT. 10RGI ; CHECK 320 RESPONSE MOVD ~IORGM.MSGL GET CONFIRMATION MESG CALL @PRI NT AND SEND IT CLR A CLEAR OUT THE COMMAND STA @MPRTC FROM I/O LINES BR @TOP ; EXIT ROUTINE ••••••• _---------------------------------------* •••••• INITIALIZE TO RECEIVER SQUELCHED ....... _--------------------------------------_ ...... . $ SOTREC EQU CLR STA ORP ORP ISQTI BTJOP MOVD CALL CLR STA BR A @MPRTC CYCLE THE CLEAR LINES OF THE I/O CONTROL ' SET SOT INIT COMMAND ~>FO.CPORT ; PUT 320 IN INIT COMMAND MODE ~BIT6.DPORT.ISQTI ; CHECK 320 RESPONSE ~ISQTM.MSGL GET CONFIRMATION MESG @PRI NT AND SEND IT A CLEAR OUT THE COMMAND @MPRTC FROM I/O LI NES @TOP • EXIT ROUTINE ~3.CPORT ....... _--------------------------------------_ ...... . ..... INITIALIZE TO REENABLE RECEIVER ....... _--------------------------------------_ ...... . ENBREC EQU CLR STA ORP ORP IENBI BTJOP MOVD CALL CLR 324 $ A @MPRTC CYCLE THE CLEAR LINES OF THE I/O CONTROL ~4.CPORT SET ENB INIT COMMAND ~>FO.CPORT PUT 320 IN INIT COMMAND MODE ~BIT6.DPORT.IENBI CHECK 320 RESPONSE ~IENBM.MSGL GET CONFIRMATION MESG @PRI NT AND SEND IT A CLEAR OUT THE COMMAND Theory and Implementation of a Splitband Modem Using the TMS32010 STA BR @MPRTC @TOP ; FROM I/O LINES ; EXIT ROUTINE ....... _--------------------------------------_ ...... . INITIALIZE TO ANSWER MODE ....... _--------------------------------------_ ...... . ANSMDM EQU $ IANSI CLR A CYCLE THE CLEAR LINES STA @MPRTC OF THE I/O CONTROL ORP ~S.CPORT SET ANS INIT COMMAND ORP ~>FO.CPORT PUT 320 IN INIT COMMAND MODE BTJOP ~BIT6.DPORT.IANSI CHECK 320 RESPONSE MOVD ~ANSM.MSGL GET CONFIRMATION MESG CALL @PRINT AND SEND IT CLR A CLEAR OUT THE COMMAND STA @MPRTC FROM 1/0 LI NES BR @TOP • EX I TROUT! NE _--------------------------------------_ PUT LINE ON HOOK ....... ...... . ....... _--------------------------------------_ ...... . HooKON EQU ANDP MOVD CALL BR $ ~NOT7.APORT ~HONM.MSGL @PRINT PUT MODEM BACK ON HOOK GET CONFIRMATION MESG AND SEND IT EX I TROUT! NE @TOP ....... _--------------------------------------_ ...... . TAKE LINE OFF HOOK ....... _--------------------------------------_ ...... . HOOKOF EQU $ ORP MOVD CALL BR ~B 1T7 • APORT ~HOFFM.MSGL @PRINT TAKE OFF HOOK GET CONFIRMATION MESG AND SEND IT EX I TROUT! NE @TOP ......._--------------------------------------_ ...... . DISPLAY HELP LIST ••••••• _---------------------------------------* •••••• HELP EQU $ GET CONFIRMATION MESG MOVD ~HELPM.MSGL CALL @PRINT AND SEND IT BR @TOP EXIT ROUTINE •••••• *---------------------------------------_ ••••••• .•... Clear command buffer ....... CLR _--------------------------------------_ ...... . CLEAR MORE A CLR STA INC CMP JNE RETS B @ADDBOT(B) zero command register B ~40.B are we done yet? MORE ....... _--------------------------------------_ ...... . Auto-answer routine ....... _--------------------------------------_ ...... . INTI BTJZP DTR_ must be active. ~BITl.APORT.ANSMOD; else return RETI ANSHOD CLR ORP MOVP EINT RIHIGH ORP BTJOP ORP MOVD STALOW MOVD CALL BTJOP DJNZ S4 ~BITO.BPORT ~>2A.IOCNTO Turn off CTS activate timer Interrupt ~BIT!.IOCNTO ~BITl.IOCNTO.RIHIGH ~BIT!.IOCNTO ~50.COUNTl Wait RI to fall "O.MSTIME @MSDLY ~BITl.IOCNTO.RlHIGH separate rings COUNT! • STALOW Theory and Implementation of a Splitband Modem Using the TMS32010 325 MOVO CALL ORP LABELO INC CMP JZ NXTRNG MOVO RILOW MOVD CALL BTJOP DJNZ '&RCALL.M5GL @PRINT '&BITI.IOCNTO send ring message 54Increment ring counter 53.54 PICKUP '&IOO.COUNTI '&100.M5TlME @M50LY ,&BITI.IOCNTO.RIHIGH check RI every 100 msecs COUNT I .RILOW * no rings. abort answer ANOP RET I ,&NOTO.BPORT * Pickup the phone and go through answer procedures. PICKUP ORP ORP '&BIT7.APORT '&B I Tl • BPORT Go off hook D5R Is active wait at least 2 seconds for bil ling delay MOV BOELAY CALL MOV CLR ORP '7.2. VALUE @5ECDLY '&1 B.CWTI CWT2 '&BIT2. IOCNTO must wait at least 2 secds Wait 2 seconds Initialize carrier abort timer. Enable carrier abort interrupt * determine if B212A or BI03J mode ANDP ORP ANDP '&B IT 4. CPORT '&BIT4.APORT '&NOT2.APORT answer mode (to 32010) ATE=1 Unsquelch 532. send 2225hz tone MOVD '&600.INT5TM load timer '&BIT5.DPORT.BE212 '7.BITO.APORT.BEI03 ORGWTO '7.>OC.IOCNTl GOTEDT '&>OC. IOCNTI check for EDT check for DCDekeep looping til I carrier timer aborts enable INT5 BELL 212 selected enable INT5 ORGWTO BTJZP BTJZP JMP BE212 MOVP JMP BEI03 MOVP * Bel I 103J selected MOV DCDWTO BTJOP MOVD CALL DJNZ MOVP MOVP '&>OO.IOCNTO '&>OO.IOCNTl MOVD CALL '&CONN3.M5GL @PRINT MOVD CALL BR '& 765. MST'I ME @MSDLY @DATI03 GOTEDT MOV EDTWT2 BTJOP 326 ,&150.COUNT '&BITO.APORT.ORGWTO '&1.M5T1ME @M5DLY COUNT. DCDWTO '&ISO.COUNT '&BIT5.DPORT.ORGWTO check for DCD_ Got DCD_. disable abort interrupt EDT_ active 'for at least ISO ms Theory and Implementation of a Splitoand Modem Using the TMS32010 110VD CALL DJNZ '1.I1STII1E @I1SDLY COUNT.EDTWT2 110VP 110VP ORP ANDP 110VD CALL ANDP '>OO.IOCNTO '1.>OO.IOCNTI '1.B IT2. APORT 'NOT4.APORT 'CONNI2.I1SGL @PRINT ,NOTO.BPORT Got EDT_. disable abort interrupt MOVD CALL BR '76S.MSTIME @I1SDLY @B212 Walt 76S ms Squelch 532 ATE=O (EXI 110DE) CONNECT 1200 CPORT is active (CTS_=O) 212A mode. act as 32010 to DTE Interface Call Initiation Routines. • We are now in data mode. DATl03 ANDP Walt for a disconnect. 'NOTO.BPORT ; Activate CTS_ • look for escape character LPI03A 110V LPI03B EQU BTJOP BTJOP LPI03E BTJZP MOVP CMP JNE DJNZ '1.3.TEI1PI $ '1.BITI.APORT.NODTRO ; no DTR_ '1.BITO.APORT.DISI03 no DCD '1.BITI.SCTLO.LPI03E received char? RXBUF.A escape character? S5.A LPI03A TEI1P I • LP I 03B • we now have three escape characters. start escape code timer 110V LPI03C 110VD LP103D 110VD CALL BTJOP BTJOP BTJOP DJNZ DJNZ 'SO.COUNTI '20.COUNT '1.1.I1STlME @I1SDLY '1.BIT1.APORT.NODTRO 'BITO.APORT.DIS103 'BIT1.SCTLO.LP103A COUNT.LP103D COUNTl.LP103C • everything checked out O.K. JMP CMI03 NODTRO MOV NODTRI MOVD CALL BTJZP DJNZ 'S.COUNT '1.I1STlME @MSDLY '1.BITI.APORT.LP103B COUNT. NODTRI • Disconnect from 103 data mode DISI03 ORP ANDP MOVP MOVD CALL TCODE2 BTJZP EINT BR '1.BIT2.APORT 'NOT7.APORT '>03.IOCNTO 'NOCAR.MSGL @PRINT 'BITO.SSTAT.TCODE2 S m/s check of DTR_ Squelch 532 Go on hook Enable interrupt Send disconnect message @INIT Theory and Implementation of a Splitband Modem Using the TMS3201.0 327 * 103 COMMAND MOD.E CMID3 ANDP MOVD CALL BR ~NOTD,BPORT '1.RESET,MSGL @PRINT @LooK Ac't f vate CTS_ ; look for new command ••••• * •• ~ ••••••• * •••• ~* ••• * •• **.*.**.***.* ••• *.* ••• * •• •••••• TIMOUT INTERRUPT OF CARRIER DETECT ••• * •• * ••••• * ••••• * •••••• ~ ••••••••••• * ••••••• * •••••••• •••••• INT2 EQU $ DECO CWT2 OECREMENT SECO~DARY COUNTER ,JNC CABORT IF COUNTED OUT THEN APORT RETI ,. TIMOUT NOT COMPLETE CONTINUE CABORT ANDP '1.NOT7,APORT GO ON HOOK ORR '1.B IT 2, APORT SQUELCH 532 ANDP '1.NOTO , BPORT ACTIVATE CTS ORP '1.B 1T3. 10CNTO 01 SBLE TI MER EINT MOVD ~NbcAR.MSGL SEND NO CARRIER CALL @PRINT MESSAGE TO DTE BR @LOOK LOOK FOR NEXT COMMAND .-.- .• *. INT3 INT4 INT5 VECT5 VECT4 VECT3 VECT2 VECTl VECTO 328 RET 1 RETI RET 1 AORG DATA DATA DATA DATA DATA DATA >FFF4 INT5 INT4 INT3 INT2' INTI INIT Theory and Implementation of a Splitband Modem Using the TMS320LO Theory and Implementation of a Splitband Modem Using the TMS32010. 329 330 Theory and Implementation of a Splitband Modem Using the TMS32010 Implementation of an FSKModem Using the TMS320C17 Phil Evans Regional Technology Center - Ottawa, Canada Texas Instruments AI Lovrich Digital Signal Processor Products - Semiconductor Group Texas Instruments 331 332 Implementation of an FSK Modem Using the TMS320C17 Introduction This application report presents an implementation of a 300-bit-per-second (BPS) modem conforming to the V.21 and Bell 103 standards, using a TMS320C 17 Digital Signal Processor (DSP). The purpose of this application report is, with references [1], [2], [3], to provide a complete hardware design for a splitband modem and the software to implement a V.211Bell103 300-bps modem. The designer can then concentrate on developing valueadded functions, such as V.22bis or V.22 standard modems, encryption algorithms, etc. These value-added functions are implemented in software and can be easily incorporated into the TMS320C17 software provided in Appendix B. The structure of this report is as follows: • The first section reviews basic modem concepts and definitions and introduces the reader to frequency shift keying (FSK) data modulation. • The second section describes the major functional blocks of the FSK modem system presented in this report: - Host interface, Modem controller, Digital signal processor, and Analog front end. • References to documents describing the actual hardware implementation are provided. • The third section discusses the DSP software implementation of the V.211Bell 103 modulator/demodulator using the TMS320C17 DSP. • The fourth section reviews some of the issues involved with incorporating additional code into DSP software provided in Appendix B. • The fifth section concludes this report. • Appendix A is a derivation of the filter coefficient value required for the sample fraction time delay. • Appendix B is the source code listing for the TMS320C 17 modulator and demodulator implementation. Implementation of an FSK Modem Using the TMS320C17 333 Background Over the past decade there has been a proliferation in the number and the use of computer systems. Accompanying this growth, there has been an increased demand for data communications between the various computer systems and terminals. One of the most convenient and frequently used methods of data communications between geographically separated computer equipment is via the Public Switched Telephone Network (PTSN). The essential element for this method of data communication is the modem. The modem converts the digital data it receives from the computer system or terminal into a modulated analog,signal that is transmitted via the telephone network to the destination computer system or terminal. At the destination, the receive modem demodulates the received signal and transfers the digital data to the receiving terminal or computer system. Table 1 shows a number of popular modem standards as specified by either the International Telegraph and Telephone Consultive Committee (CCITT) or the Bell System. Table 1. Bell and CCITT Modem Standards Modem Bell CCITT Standard Type* Modulation 103 202 212A 201 SIB SIB SIB SIB FSK V.21 V.22 V.22bis V.32 SIB SIB SIB E/C FSK FSK DPSK DPSK DPSK QAM QAM Data Rate (BPS) 300 1200 1200 2400 300 1200 2400 9600 Duplex Full Half Full Half Full Full Full Full * SIB = Split band E/C = Echo Cancelling Modems can be either half-duplex or full-duplex. In a half-duplex system, the transmission can be in either direction; however, only one direction is possible at a time. A half-duplex modem cannot simultaneously transmit and receive information. At the end of its transmission sequence, the modem must advise the receiving modem that the sequence is complete. The receiving modem may then begin transmitting data. 334 Implementation of an fSK Modem Using the TMS320C17 In a full-duplex system, the data transmission is bidirectional. Both modems may simultaneously transmit and receive data. Bidirectional (simultaneous data transmission) is achieved by either splitband or echo cancellation techniques. Figure 1 shows the spectral response of a typical telephone channel. A splitband modem uses a fIltering scheme to separate the telephone channel into two distinct frequency bands. One band is dedicated to the transmissions of the originate modem, the other band is dedicated to transmissions of the answer modem. To separate the received signal from the received and transmitted signal that is detected on the two-wire telephone line, the modem removes the transmitted signal frequency band using a splitband fIlter [1], [4], or by other means (such as software implemented on the DSP). Dividing the telephone channel into two separate non-overlapping frequency bands limits the maximum baud rate. GAIN (db) o -10 ORIGINATE BAUD ANSWER BAUD ooC=1080 000=1180 00,=980 ooC=1080 000=1180 00,=980 -20 -30 o 600 1200 1800 2400 3000 FREQUENCY (Hz) Figure 1. Spectral Response of a Typical Telephone and a V.21 Splitband Modem The actual bit rate of the channel is determined by the baud rate and the data modulation scheme that is employed. Splitband type modems are typically used in low- to moderatespeed applications. As shown in Table 1, each modem standard uses a particular modulation scheme. For example, CCITT V.21, V.22, and V.22bis standards specify the frequency shift keyed (FSK), phase shift keyed (PSK) and quadrature amplitude modulation (QAM) schemes respectively. Implementation of an FSK Modem Using the TMS320C17 335 Echo cancellation type mOdems, such as V.32, transmit both the originate and answer signals on the same channel. This allows both the originate and answer modems to utilize the complete bandwidth of the channel and to maximize the data baud rate. It is still necessary to separate the receive signal from the receive and transmit signal detected on the two-wire telephone line. However, the originate and answer signals are superimposed on the same channel band, and separating techniques that are more sophisticated than those found in splitband-type modems are required. The fact that transmit signal is typically 20 dB stronger than the receive signal, as measured on the transmit Tip and Ring, further complicates the extraction of the receive signal. Echo cancellation type modems use algorithms that subtract an estimate of the transmit signal from the signal sampled from the two-wire telephone line, to determine the receive signal. Refer to [5] and [6] for further information on Echo cancellation type modems. Table 2 shows the transmission frequencies for answet and originate modes for both the binary FSK modulated 300-bps V.21 and Bell 103 standards. It also shows details of the V.23 and Bell 202 1200-bps half-duplex standards. Table 2. BinaryFSK Transmission Frequencies Modem Standard Carrier 1Hz) 1lMark) IHzi OISpace) 1Hz) 1080 1750 980 1650 1180 1850 1170 2125 1270 2225 1070 2025 V.23 1700 1300 2100 BELL 202 1700 1200 2200 V.21 Originate Answer BELL 103 Originate Answer Since this report is primarily concerned with the 300-bps V.21 and Bell 103 standard modems, it is worthwhile to review FSK data communication. These are the primary advantages of an FSK system: 336 1. There is no requirement for carrier phase recovery; this reducing system complexity. 2. Increased immunity to amplitude nonlinearities. FSK is a constant envelope signal, with the information transmitted in the zero crossings. It is less affected by amplitude nonlinearities than amplitude modulated schemes, and 3. The modulator and demodulator architectures are easily implemented in software. Implementation of an FSK Modem Using the TMS320C17 The primary disadvantage of FSK modulation is its low spectral efficiency. Because the telephone network is bandlimited to 4KHz, only moderate data transmission rates over the telephone network are supported by an FSK modulation scheme. As a consequence, FSK is often the favored modulation scheme for very low cost, low-to-moderate speed data communication systems. Subsequent sections of this report discuss FSK modulation and demodulation in some detail. It is important that you understand the mathematical representations of FSK signals. FSK modulation is represented in the following manner: S(t) = cos«we±ow)*t where S(t) We ow t cp = = = = = + cp) (1) Transmitted signal Carrier frequency Frequency shift Time Phase shift For a given baud period T, S(t) is at a frequency fl =(fe + ot) or fo=(fe- ot), corresponding to the transmission of a 1 or 0, respectively, for the duration of the baud period. In some cases, it is convenient to represent Wo = We - OW WI = we - Ow (2) Thus the following identities are true: We = (WI + wo)12 ow = (WI - wo)/2 (3) Some binary FSK modulation schemes, such as V.21, have wo greater than WI; so by (3), ow would be negative. Figure 2 shows an FSK signal transmission. Note that the telephone channel provides limited spectral bandwidth. To achieve progressively higher data rates, more spectrally efficient modulation schemes, such as PSK and QAM, must be used. As spectral efficiency increases, typically, the complexity of the signal modulation and demodulation schemes increase. Additional information on modulation schemes can be found in references [4], [5], [6] and [7]. Implementation of an FSK Modem Using the TMS320C17 337 ~-------ro--------~~----- ----~~~------ ro------~~ Figure 2. FSK Signal Transmission System Description As discussed in .the introduction, this application report presents the implementation of a V.211Belll03 300-bps FSK modem using a TMS320C17 Digital Signal Processor. The system hardware is identical to that of the Texas Instruments DSP2400 modem [1]. There are significant functional differences between the modem design provided here and the DSP2400 modem. These result from the differences between the TMS320 code provided in Appendix B and the DSP2400 code. The software found in Appendix B implements a V.211Be1l103 FSK modem. The DSP2400 also implements V.22, Bell 212A, and V.22bis standard modems that implement PSK and QAM modulation/demodulation and the associated carrier recovery, clock recovery, and adaptive equalization functions. The software in Appendix B provides all the necessary hooks so that the designer can easily incorporate his own custom value-added features (such as V.22 and V.22bis standard modems). Nevertheless, the reader should be aware of the difference between the DSP2400 software implementation and the software in Appendix B, particularly when referring to any DSP2400 related literature [1], [2], [3]. 338 Implementation of an FSK Modem Using the TMS320C17 Figure 3 is a block diagram showing the components of the modem system. The modem consists of the following subsystems: 1. 2. 3. 4. Host interface Modem controller Digital signal processor Analog front end r-----' I ANALOG HOST IIF 8250 UART ··<:····::::~::"·:·····m'~1~6"!!:!u~~·-iI.rF-:;::RO::(::;::E~:ND~ SERIAL + PC BUS 1.0 SIGNAL SN74AlS245 AND SN74Al.S30 PROCESSOR I I :} mftp;"f~NMH-L';:'~~ I I ~32r- ______ I I -.J I (OPTIONAL) CONTROL I TELCO Figure 3. Block Diagram of Modem System Components The designer must provide an interface between the host data terminal equipment and the modem controller. The DSP2400 uses an 8250 UART (plus a 74LS245 buffer and a 74ALS30 NAND Gate) to interface between a standard PC-AT and the modem controller. A standard RS-232C interface is used between the UART and the modem controller. The circuit diagram and additional information on the host interface used for the DSP2400 Modem can be found in [1]. The modem controller (80C51, TMS70C42, etc.) handles the overall modem control [3], directs the handshaking sequences, etc. It specifically performs the following functions: 1. 2. 3. 4. 5. 6. AT command set interpretation Scrambling/descrambling Pulse dialing Synchronous/asynchronous conversion Modem configuration control Protocol initialization The modem controller sends a command to the DSP once per baud. Table 3 is a complete list of the commands, showing the structure and functions that are implemented. Implementation of an FSK Modem Using the TMS320C17 339 Table 3. Modem ControUer Commands for the DSP Command Protocol Select Description Code Fxh Select protocol Bits 1, 0 - Speed select 00 = 300 BPS o 1 = Reserved 10 = 1 1 = Reserved Reserved Bit 2 - CCITT /Bell o = CCITT 1 = Bell Bit 3 - Answer/originate 0 1 = Answer = Originate Reserved Exh Reserved command Operation Select Dxh Select operating mode (bits 3, 2 reserved) " o 0 = Line mode o 1 = Analog loopback 10 = Reserved 1 1 = Reserved Reserved Cxh Reserved command Reserved Bxh Reserved command Reserved Axh Reserved command Transmit DTMF Tones 9xh Dial DTMF and return to configuration mode xxxx = 03-00; numbers 0-9, A, B, C, 0, * , and # 340 Implementation of an FSK Modem Using the TMS320C17 Table 3. Modem Controller Commands for the DSP (Concluded) Command Transmit Mode Select Description Code 8xh Enable answer tone/data select Bits 1, 0 = Transmit select o 0 = Transmit idle o 1 = Transmit answer tone = Transmit data mode enable = Reserved Bits 3, 2 = Select answer tone frequency o 0 = 2100 Hz answer tone (V.21) o 1 = 2225 Hz answer mark (Bell 103) 1 0 = 2025 Hz answer space (Bell 10 1 1 103) 1 1 Receive Mode Select 7xh = Reserved Select receive configuration (bits 3,2 reserved) o 0 = Receive idle mode o 1 = Reserved 10 1 1 = Receive data mode = Reserved Reserved 6xh Reserved command FSK Mode 5xh Select 300 BPS mod (I (bits 3,2,1 reserved) o = 300 BPS mode deselect 1 = 300 BPS mode select Reserved 4xh Reserved command Reserved 3xh Reserved command Reserved 2xh Reserved command Reserved 1xh Reserved command Reserved Oxh Reserved command Implementation of an FSK Modem Using the TMS320C17 341 As an example, the DSP2400 uses a masked ROM version of the TMS70C42 microcontroller (denoted as a TMS70C2400A) as the modem controller. The TMS70C2400A source code is available from Texas Instruments and includes provisions for the V.22bis and V.22 standard modems. One noteworthy advantage of the TMS70C42/TMS320C17 interface is that it requires no external glue logic [7]. For complete information on the TMS70C2400 Modem Controller, including the call originate and answer sequences, refer to [2]. The TMS320Digital Signal Processor performs the computationally intensive tasks such as modulation, demodulation, and tone generation and detection. It does not perform any control functions. Specifically, the TMS320 DSP performs the following functiQns: 1. 2. 3. 4. S. 6. Modulation/demodulation (V.211Bell 103) Data encoding/decoding Filtering Automatic gain control' Tone dialing Call progress monitoring The DSP is discussed in further detail in the next section of this application report. The DSP source code in Appendix B was originally part of the code developed for the TMS320A2400 Modem Digital Signal Processor (a ROM coded TMS320C 17 DSP). The TMS320A2400 source code also includes V.22bis, V.22, and Bell 212A standard modems, with the software implementing the QAM and PSK modulation and demodulation schemes, carrier recovery, clock recovery, automatic gain control, and adaptive equalization functions. The TMS320A2400 and the source code is available from Texas Instruments. Despite the differences between the code provided in Appendix B and the TMS320A2400 code, [1] and [3] are useful references, providing technical information about TMS320C17 modem applications. The analog front end is composed of a TCM29C19 combo codec [9], a SCllOOS bandpass filter [10] and a data access arrangement (DAA) telephone line interface composed of discrete components. The codec converts an 8-bit wlaw companded bit stream to an analog waveform and vice versa, at a 9.6-KHz sampling frequency. The SCllOOS is a splitband filter that separates the transmit and receive carriers and performs the required signal shaping to the analog waveform. The DAA section is composed of a number of discrete components and is required to interface the modem to the public telephone network as dictated by FCC Rules Part 68. The analog front end circuit diagram is found in [1]. Further technical details are found in [2]. 342 Implementation of an FSK Modem Using the TMS320C17 The DSP Software Implementation The code provided in Appendix B is written specifically for a Texas Instruments TMS320C 17 Digital Signal Processor. The key architectural features of the TMS320C 17 are these: 1. 2. 3. 4. 5. 6. 7. 4 Kwords (8 Kbytes) of on-chip maskable ROM 256 words of on-chip data RAM Two full-duplex serial ports On-chip companding hardware (p.- or A-Law) On-chip sign magnitude/two's complement conversion hardware A coprocessor port 6.25-MIPS maximum execution speed TMS320E17, with 4 Kwords of on-chip EPROM substituted for the 4 Kwords of maskable ROM, is also available for development and prototyping purposes. Refer to [8] and [11] for additional information on the TMS32OCl7 and TMS320E17. The TMS320C 17 source code listing fIle is found in Appendix B. The code requires approximately 50 words of data RAM and occupies 1100 words of program ROM. Of the 1100 words of program memory, 390 are coefficients, and the remaining 710 words are the program instructions. The software consists of a main program that references various subroutines. These are the main subroutines found in the program: I. 2. 3. 4. 5. Command control interpreter (CCI) FSK transmitter (FSKTX) Dual-tone multifrequency transmitter (Part of FSKTX) Automatic gain control (AGC) FSK receiver (RSTSK) The next section of text describes the main program. The subroutines are discussed in subsequent sections. Figure 4 is a block diagram of the main program (code starting at beginning of main program label and ending at start of subroutines label) in Appendix B. Once the initialization of the data RAM and control registers (code beginning at start of additional tables label and ending at start of main program sequencer label) is complete, the main program loop is executed. The device remains in the WAIT loop (first four lines of code of main program sequencer routine) until the FR flag in the control register is raised. Control register bits 27-24 and 23-16 are set so the main program and data samples are transmitted/received to/from the TCM2919 codec at a rate of 9.6 KHz. Implementation of an FSK Modem Using the TMS320C17 343 NO TRANSMIT/RECEIVE MODULATED DATA RSCNTRIS ,-_-1--:;;."--_ _., RECEIVE SAMPLE ' - - - - r - - - - - ' COUNTER NO CALLCCI CALL ENCODE XOUT=O CALLFSKTX XSCNTRIS '--_...,.-_-.-_ _~ TRANSMIT SAMPLE . COUNTER Figure 4. Flowchart of Main Program (Appendix B) 344 Implementation of an FSK Modem Using the TMS320C17 As the V.211Bell103 standard modems transmit data at 300 bps, a 9.6-KHz sampling rate results in 32 samples/baud. The 9.6-KHz sampling rate is very practical for several reasons: • It is higher than the Nyquist sampling frequency of approximately 8 KHz for a telephone channel, and • It is a convenient multiple of the popular modem transmission frequencies (300, 1200, and 2400 bps). The TMS320C17 is clocked by a 18.432-MHz oscillator. To satisfy the 9.6-KHz sampling frequency, the number of instructions executed per sample must be less than 480. To implement the various functions required by the FSK modulator/demodulator, it is necessary to distribute the tasks among the various samples within the baud. The command control interpreter (CCI) is executed during the first sample of the baud, and the AGC routine is implemented during the final sample baud. When the raised FR flag is detected, the processor exits the WAIT loop and executes the main program. Refer to [8], Sections 3.8 and 3.9 for additional details on the FR flag, interrupts, and serial port. Table 4 describes the variables that are referenced in the main program. Table 4. Variables Referenced in Main Program Variable Variable Description Name XSCNTR The transmit counter; equals the number of samples that have been transmitted in the current baud. SCNT Number of samples in a baud, i.e., 9.6 KHZ/300 HZ = 32 samples/baud. XOUT Output sample sent via the TX serial port to the combo codec. RIN Input sample sent via RX serial port from the combo codec. STATUS An a-bit number used internally by the DSP. Indicates present operating mode of the modem. STWRD a-bit status word sent to the modem controller by the DSP. See Table 5. OAFLAG Indicates OAFLAG Indicates DTFLAG DTFLAG if modem is in originate or answer mode. = 0 - originate mode. if the modem is transmitting DTMF tones. = 1 - transmitting DTMF data. Implementation of an FSK Modem Using the TMS320C17 345 Table 5 shows the organization of STWRD (the DSP status word that is written to the microcontroller). Table 5 STWRD - DSP Status Word Written to the Modem Controller Bit No. Description Enable/disable automatic gain control. 7 o= Enable 1 = Disable EDT (in band energy) 6 o= Not detected 1 = Detected 5 Reserved 4 Reserved 3 2 1 Received data bit (0,1) Reserved, set to 1 0 Reserved, set to 1 Reserved, set to 1 When the program exits the wait loop, it disables all interrupts and reads a data sample RIN from the receive buffer or writes a data sample XOUT to the transmit buffer of serial port #1. At the first sample of a baud, when XSCNTR = SCNT (=31), the program implements the command control interpreter (CCI) subroutine as shown in the following code. Note that SCNT = 31, and XSCNTR is initially set at 31 and decremented by 1 every sample. When XSCNTR equals 0, it is reset to 31, for a total of 32 samples. lAC SUB 8lZ CAll SEQU: LACK XSCNTR SCNT SEQU CCI 030h ; ACCUM = XSCNTR-SCNT ; BRANCH TO SEQU IF ACCUM < 0 The CCI subroutine reads the next 8-bit command from the modem controller (TMS70C42400A or equivalent), performs the required program control functions, and returns to the main program. If the DSP is in transmit idle mode, the data sample XOUT is set to 0 and sent to serial port #1 transmit buffer. 346 Implementation of an FSK Modem Using the TMS320C17 If the DSP is not in transmit idle, the FSK transmit subroutine FSKTX is called. Depending on the present value of STATUS as determined by the modem controller and the CCI subroutine, the FSKTX subroutine will transmit FSK encoded data, DTMF tones, or an answer tone. Upon completing the FSKTX subroutine, the program decrements the transmit sample counter XSCNTR by 1 and checks to see if it is less than O. If so, XSCNTR is reset to 31. Otherwise, the program proceeds without any further modifications to XSCNTR. At this point, the main program checks to see if the receiver is in idle mode. If the receiver is in idle mode, the receive sample counter RSCNTR is decremented. If RSCNTR is not less than 0, the program returns to the WAIT loop. If RSCNTR is now less than 0, it is reset to 31, and the program then returns to the WAIT loop. If the receiver is not in idle mode, the receiver decode/demodulation subroutine RSTSK (receiver per sample task) is called. This subroutine demodulates the receiver signal and estimates the value of the received data. When the subroutine is complete, the main program decrements RSCNTR and resets it to 31, if required. After the RSTSK subroutine is complete, the program decrements RSCNTR. If RSCNTR is greater or equal to 0, the program returns to the wait loop. For the sample, when RSCNTR is less than 0, the automatic gain control subroutine (AGC) is called once per baud. The AGC subroutine monitors and compensates for any significant variation of the received signal level caused by telephone line fluctuations and other dynamic effects. RSCNTR is then RESET to 31, and the program returns to the WAIT loop. The main program calls the following subroutines: • • • • CCI-Command control interpreter • OPER-Set operating mode • • PROTO-Protocol select RESET -Reset and equalizer enable • RMODE-Receiver mode select • • RSTSK-FSK demodulation DTMF-DTMF setup FSKSET-Set up FSK transmit frequency FSKTX-Transmitter mode select XMODE-Transmitter mode select Implementation of an FSK Modem Using the TMS320C17 347 Figure 5 shows a block diagram of the eel subroutine. The eel reads the setup command from the modem controller (through the co-processor port PA5) and stores it in data RAM location XDATA (The structure ofXDATA is shown in Table 3). The eel then calls the appropriate subroutine to modify the system control bits (OAFLAG and DTFLAG) and status register (STATUS). The eel, depending whether the modem configuring the DSP is in answer, originate, or transmit DTMF, loads the required nominal frequency values into TXFRQ and RXFRQ. Table 6 shows the organization of the STATUS register. ADDRESS SUBROUTINE DESCRIPTION CMDTBL + Oh RESERVED 1h RESERVED 2h RESERVED 3h RESET 4h RESERVED XDATA • FOh - TMP2 MASK OFF LOWER 4 BITS OF XDATA 5h FSKSET FSKMODE STORE IN TMP2 6h RESERVED 7h RMODE RECEIVED t MODE SELECT TMP2 =90h? CHECK FOR DTMF TRANSMIT 8h XMODE MODE SELECT NO • YES 9h DTMF DTMFTONES SET DTFLAG = 1 Ah RESERVED _t Bh RESERVED RESERVED ISO LATE UPPER Ch SHIFT TMP2 RIGHT 4 BITS HEX DIGIT Dh OPER OPERATION SELECT IRE CEIVER IN XDATA BITS 7,6 '= 1, 1? Eh RESERVED DAt'A MODE Fh PROTO PROTOCOL NO • YES SELECT READ COMMAND FROM MODEM CONTROLLER VIA CO-PROCESSOR PORT PA5, AND STORE AS XDATA • I I I I I I • I TMP2 > 2? NO ACCUMULATOR I I , YES RETURN =CMDTBL + TMP2 • CALL SUBROUTINE @ ADDRESS @ ACCUMULATOR I t RETURN I Figure·5. Flowchart of the CCI Subroutine 348 Implementation of an FSK Modem Using the TMS320C17 Table 6. The Status Register Organization Bits 7,6 Description Indicate Receiver Mode: 00 01 10 11 5,4 01 10 11 = = = = 1 = Data Mode Reserved Transmitter in Idle Mode Transmit Answer Tone Data Mode Reserved Originate Mode Answer mode CCITT /Bell Mode: o= 1 1,0 Call Progress Monitoring Mode Answer/Originate Mode: o= 2 Receiver in Idle Mode Indicate Transmitter Mode: 00 3 = = = = = CCITT (V.21) Bell (103) Speed status: 00 01 10 11 = = = = 300 BPS Reserved Reserved Reserved The setup commands from the modem controller and subroutines called by the CCl subroutine are shown in Table 3. The RESET subroutine loads 81h into the STWRD word that is sent to the modem controller via the co-processor port PA5. This advises the modem controller that the DSP has been reset. The DSP program then branches to STA~T, and the DSP is reinitialized. The FSKSET subroutine reads the XDAT A word to determine if the next bit to be is 0 or 1 and then loads the appropriate 0 or 1 frequency FOADD or FIADD into the TXFRQ register. trans~itted Implementation of an FSK Modem Using the TMS320C17 349 When setup in answer mode, XDATA bits 3 and 2 are loaded into the STATUS register bits 7 and 6, respectively, by the RMODE subroutine. These 1?its determine what tasks the FSK receiver subroutine RSTSK will perform, as shown in Table 3 and Figure 5. The XMODE subroutine reads XDATA bits 0 and 1. These bits determine what tasks the FSK transmitter subroutine FSKTX will perform as shown in Figure 4. If the transmit answer tone function is selected, bits 2 and 3 of XDATA indicate what the answer tone frequency will be: XDATA Bits 3,2 = 0,0 0,1 1,0 1, 1 2100 Hz 2225 Hz Reserved Reserved The program loads the appropriate answer tone value into register TXFRQ. XMODE then loads XDATA bits 1 and 0 into STATUS bits 5 and 4, respectively. STATUS bits 5 and 4 determine what tasks the transmitter subroutine FSKTX will perform. The DTMF subroutine determines what number or symbol needs to be transmitted by reading XDATA bits 3 through O. DTMF then loads the appropriate high-frequency phase step, low-frequency phase step, high-frequency gain, and low-frequency gain into the RXFRQ, TXFRQ, DTMFH, and DTMFL registers, respectively, from the Table TONTBL. The OPER subroutine checks bits 1 and 0 of XDATA. If bits 1 and 0 equal 0 and 1 bit 3 of STATUS is set to 1, indicating that the modem is in analog loopback mode. If bits 1 and 0 are not equal to 0 and 1, 0 PER returns without performing any operations. The PROTO subroutine selects the mode and protocol of the DSP based on XDAT A bits 3 through O. PROTO first sets bits 1 and 0 of STATUS (indicating the modem data rate), based on the value of bits 1 and 0 of XDATA (see Figure 7). While the software provided in Appendix B supports only a 300-bps data rate, it does provide the necessary hooks so that different standard modems (ie V.22, V.22bis) can easily be incorporated into the code. Next, PROTO checks XDATA bits 3 and 2 to determine if the modem should be in originate/answer mode and Bell/CCITT mode. Bit 3: Bit 2: 0 1 0 1 = = = = Originate Answer Bell CCITT As shown in Table 2, the transmission frequencies of the Bell 103 and V.21 originate and answer modes are unique. PROTO loads registers used by the FSK transmitter 350 Implementation of an FSK Modem Using theTMS320C17 subroutine (FSKTX) and the FSK receiver subroutine (RSTSK) with values stored in table TONTBL in data ROM and corresponding to transmit and receive frequencies. PROTO then uses the XDA T A bits 3 and 2 to determine which constants are transfered from table FSKTBL into addresses FIADD (transmit 1 phase step), FOADD (transmit 0 phase step), BIFSK (FSK delay filter coefficient), and GAIN (FSK mode gain). PROTO also loads addresses SeNT (baud counter = 32), TRANS (FSK data transmition N = 15), AIFSK (AI demodulator filter coefficient), A2FSK (A2 demodulator filter coefficient), and DZONE (dead zone of window comparator) with the appropriate values. If bit 3 of the STATUS word equals 1, the modem is set to analog loopback mode, and the modem should receive the information that it transmits. PROTO checks to see if bit 3 of STATUS equals 1; if so, the receiver parameters are modified to be the same band as the transmitter. The FSK modulator is implemented in the FSKTX subroutine. Figure 6 is a block diagram of the FSKTX subroutine. The primary function of the FSK modulator is the following: Given a stream of binary data ao, alo a2, ... , ak-1, ak for each data element ak = [O,IJ, generate a corresponding signal of frequency fo or f1 for the duration of ak's baud period. Implementation of an FSK Modem Using the TMS320C17 351 LOAD TX PHASE INTO ACCUMULATOR CALL SING EN STORE RESULT IN TXTONE TXPHS = TXPHS + TXFRQ DTMFMODE? XOUT=TXTON USE RXPHS FOR HIGH FREQ TONE Figure 6. Flowchart of Subroutine FSKTX Figure 7 shows a functional model of the FSK modulator. The TMS320 software implementation of the FSK modulator generates tones by stepping through a cosine table. The size of the phase step determines the output signal frequency. You should pay particular attention how phase angles, phase steps, cosines, and sines are represented as 16and 32-bit integer numbers. 352 Implementation of an FSK Modem Using the TMS320C17 Wo 8--+' ___-, s(t) = sin (( roc:l: ~ro) t + 0) Figure 7. Functional Model of an FSK Modulator Table 7 describes the significant variables used in the FSKTX subroutine. Table 7. Variables Referenced in the FSK Transmitter Subroutine FSKTX Variable Description Name TXPHS Present value of the transmit signal phase. Also used as present phase of the low frequency DTMF tones. TXFRQ RXPHS Phase step between consecutive TXPHS samples. Normally used in the FSK demodulator subroutine RXTSK. Used as present phase for the high frequency DTMF tone. RXFRQ Normally used in RXTSK subroutine. Also used as phase step for high-frequency tone when transmitting DTMF tones. DTMFL Scaling factor for low-frequency DTMF tones. DTMFH Scaling factor for high-frequency DTMF tones. SING EN A subroutine called by FSKTX. Given a 16-bit number representing an angle from 0 to Pi, the SINGEN routine determines the sine of the angle and stores the result at address TMP3. The software FSK Modulation routine receives data at a rate of 300 bps and generates 12-bit, two's complement data samples at a rate of 9.6 KHz. The TMS320Cl7's on-chip hardware compander reduces the sample to 8 bits before it is sent to the Codec via the serial port. Implementation of an FSK Modem Using the TMS320C17 353 The most recent phase of the output signal is stored in data memory location TXPHS, and the amplitude is read from the COSOFF table by the SINGEN subroutine. The frequency of the transmitted signal is determined by the size of the phase step TXFRQ between successive output samples: TXPHS[(N + l)T] = TXPHS[NT] + TXFRQ[NT] The value of TXFRQ is determined by the FSKSET subroutine referenced by the CCI subroutine. Recall that, depending on the instruction received from the modem controller at the beginning of the baud, the CCI subroutine loaded data memory location TXPHS with either FOADD or F1ADD. Table 8 shows the FSK frequencies and phase steps (TXFRQ) for the V.21 and Bell 103 modem standards. Table 8. Frequencies and Phase steps for V.21 and Bell 103 Modems Modem Standard V.21 Bell 103 Frequency Phase Step Phase Step (Hz) @}9.6 KHz TXFRQ. Q 15 hex 1A22h Originate 1 980 0.2042*Pi Originate 0 1180 0.2458*Pi 1F77h Answer 1 1650 0.3428*Pi 2COOh Answer 0 1850 0.3854*Pi 3155h Originate 1 1270 0.2646*Pi 21DDh Originate 0 1070 0.2229*Pi 1C89h Answer 1 2225 0.4635*Pi 3B55h Answer 0 2025 0.4219*Pi 3600h The magnitude of the .phase step is determined by [(Desired Frequency)/(Sampling Frequency)] * 2'11" In the case of the originate 1 of the V.21 modem, the phase step equals (1270/9600) * 2'11" = .2646 'II" Radians Both TXPHS and TXFRQ data memory locations are 16-bit binary numbers in Q15 two's complement notation equal to (Output Signal Phase)/'II". 354 Implementation of an FSK Modem Using the TMS320C17 Thus TXPHS hex values 2000h 4000h 6000h 8000h AOOOh = 71"/4 71"/2 = = 371"/4 = - 71" = -371"/4 An advantage of this approach is that the phase of the output signal is continuous. This provides a higher spectral efficiency than that of a discontinuous phase FSK implementation. The sine generation subroutine SINGEN subtracts 71"/2 (4000h) from TXPHS and uses this phase to read the amplitude from the COSOFF table. The symmetry of the cosine function has been used to reduce the table size from 513 to 257 elements, with data memory addresses COSOFF, COSOFF + 128, and COSOFF + 256 corresponding to 0, 71"/2, and 71" radians, repectively. To determine the cosine of an angle outside the 0-to-7I" range, the program utilizes the two's complement format of the data and the absolute value function ABS. As an example, assume that the present phase TXPHS is TXPHS(N) = (- 170/256) * 71" = -.6640625 * 71" = A600h If we are transmitting a 1 in V.21 Originate mode, the phase step is TXFRQ = .26448 * 71" = 21DDh The next value of: TXPHS(N + 1) = TXPHS(N) + TXFRQ = - .6640625 71" + .26448 71" = - .3995825 71" + 2IDDh = C7DDh = A600h The subroutine then subtracts 71"/2 (4000h) from TXPHS, so the sine of angle TXPHS can be determined from the Cosine table: ANGLE = TXPHS(N + 1) - 71"/2 = - .3995825 71" -.5 71" = -.8995825 71" = C7DDh - 4000h = 87DDh Note that TXRFQ is added to TXPHS(N), and 71"12 is subtracted from TXPHS(N + 1) with the sign extension suppressed, so TXPHS(N + 1) = 87DDh. This represents 1.06143 71" as an unsigned number or - .93857 71" as a signed number. If we now consider TXPHS(N + 1) a signed and take the absolute value: ABS[TXPHS] = ABS[87DDh] = 7823h representing .93857 71" Implementation of an FSK Modem Using the TMS320C17 355 Note that: Cos(1.06143·1I-) = Cos(.938571r) = -.98144 The cosine table address. is generated: + FOh The value at Data Memory address COSOFF + FOh is Cos«240/256)1l") = - .980786 = 8276h, Q15 2's complement notation COSSOFF + (7823h/80h) = COSOFF Within the limits of the cosine table precision, the calculated output value equals the value read from the table. The structure of the FSK Demodulator is shown in Figure 8. cos(( ooc • AooC) t + 0) ( LPF AGC SLICER ~ it DECISION • sin (Aon) Figure 8. FSK Demodulator The received FSK signal is sent to the DSP from the Codec via the serial port. The on-chip companding hardware expands the signal from an 8- to 13-bit value. The automatic gain control routine compensates for transient signal level variations and sends the amplitude adjusted received signal R(t) to the software demodulator. R(t) = cos[(wc±ow)* t + (4) <1>] As this is a binary FSK system, the frequency of this signal is either We - ow or depending on whether a 0 or 1 was sent. (Recall from the V.21 signal that ow is less than 0.) We + ow, The received signal R(t) is multiplied by a delayed version of itself: R(t - r) 356 = cos[(we±ow) * (t -r) + <1>] (5) Implementatlon of an FSK Modem Using the TMS320C17 Where 7 is the signal delay. The product of the received signal (4) and delayed received signal (5) is * cos[(we±ow) * t + = cos[2(we±ow) * t - 2 * cos[(we±ow) * (t - 7)] (we±ow) * 7 + 2 * cJ>] + cos[(we±ow) * 7] cJ>] (6) (7) If We 7 is set to equal 'K12, and (7) is lowpass filtered to remove the double frequency component, the resulting signal is cos('K12±ow * 7) = sin(±ow7) = ± sin(ow) (8) If ow is greater than 0, then the sign of the lowpass filter output will be positive or negative, depending on whether We + ow or We - ow is originally transmitted. If ow is less than 0, obviously the opposite relationship is true. The sign of the lowpass filter output indicates the value of the received data. The TMS320 software implementation of the 300-bps FSK Demodulator is found in Subroutine RSTSK, Subroutine CCITT, and Subroutine FDEM20 in Appendix B. The AGC subroutine provides the RSTSK subroutine with a Qll two's complement format received signal sample at a rate of 9.6 K samples per second. As previously discussed, the data is extracted from the received signal by multiplying the received signal by a 'K12 delayed version of itself, cos[(wc±ow) * t + cJ> - 'K12±ow * 7]. The product is then passed through a lowpass filter to remove the high frequency components. If the desired phase delay is We *7 = 'K12, (9) then (10) The sample rate is 9.6 KHz, or a period T = 104.167 p,s. Table 9 shows the carrier frequencies, for both the V.21 and Bell 103 standards, the time delays corresponding to a 'K12 phase delay and the equivalent number of 9.6-Khz samples. Note that none of the delays are exact multiples of the 9.6-KHz sampling period; each delay has an integer and fractional part. Implementation of an FSK Modem Using the TMS320C17 357 Table 9. Carrier Frequency and Time Delays Frequency Modem Standard V.21 Bell 103 # of 9.S-KHz 1'1"s) 1Hz) Samples Originate 1080 231.481 2.2222 Answer 1750 Originate 1170 142.857 213.675 2.0513 Answer 2125 117.647 1.1294 1.3714 To minimize the probability of error, it is necessary that the phase delay be as close to 7r/2 as possible. An accurate estimate of the fractional part of the delay must be total phase delay. This is achieved by using a single zero FIR filter. R«n - a)T) where = GAIN * [R(nT) + BIFSK * R«n -l)T)]) (11) R(nT) is the nth sample of the received signal R(t) R«n - a)T) is the estimate of the fractionally delayed signal n is an integer a is the desired fractional delay, 0< a < 1 The filter coefficient BIFSK and GAIN for the fractional delay filter of each V.21 and Bell 103 carrier are shown in Table 10. The derivation of the gain and filter coefficients are shown in Appendix A. Table 10. Time Delay and FIR Filter Coefficients Modem Standard V.21 Bell 103 Frequency Fractional Delay 9.S-KHz SampleL) Gain B1FSK Originate 1080 .2222 .69753 .32796 Answer 1750 .3714 1.00000 .68889 Originate 1170 .0518 .57731 .07175 Answer 2125 .1294 1.00000 .31678 Bl and GAIN are stored in data memory locations BIFSK and GAIN, resepectively. The actual implementation is PDELl = AGCOUT + BIFSK * PDELO where AGCOUT is the received signal after the signal level has been compensated by the automatic gain control routine. 358 Implementation of an FSK Modem Using the TMS320C17 AGCOUT PDELO PDELl PDEL2 = cos[(wc±ow) = cos[(wc±ow) = cos[(wc±ow) = cos[(wc±ow) * nT + c/> ] * (n-l)T + cp ] * (n-l-a)T + cp], * (n-2-a)T + cp ] 0< a <1 Since AGCOUT, PDELO, PDELl, and PDEL2 are consecutive data memory locations, the integer multiples of the 9.6-KHz sample delays are easily achieved by using the data move (DMOV) instruction. PDELl is calculated after the demodulator product operation and is not used until the next sample period, a delay of one sample period. For the low-frequency carriers of the V.21 and Bell 103 standards, a second delay is required and is implemented as DMOV PDELl, moving the contents of PDELI into data memory PDEL2. When the sample delayed signal (PDELl or PDEL2 for the high- or low-frequency carriers, respectively) is generated, it is multiplied by the most recent sample AGCOUT. The product of the multiply is stored in data memory location PROD. PROD is multiplied by GAIN and then filtered by a second-order direct-form, lowpass IIR filter, and the result is stored in location LPFOUT. Further information on digital filters can be found in [12], [13]. Given the lowpass filter output LPFOUT, the FSK demodulator must now estimate the value of the received signal. In the Data Estimation routine, the following memory location addresses are called: - The data estimation for the previous baud. BDATA FSKDAT - Data estimation of the current sample. BAUDCK - A record of the number of samples presently taken in the current baud. Recall that the sample rate is 9.6 KHz and the baud rate is 300 Hz; so there are 32 samples/baud. COUNTR - The data estimations of each sample in the current baud are compared to the decision of the previous baud. If these are different, then COUNTR is incremented. If COUNTR reaches 32 before BAUDCK reaches 32, it is assumed that a data transition has occurred, and BDATA is set to the opposite value: BDATA(N+I) = ABS[BDATA(N) - 1] Figure 9 is a flowchart of the data decision source code implementation. Implementation of an FSK Modem Using the TMS320C17 359 AGCOUT PDELO PDEL1 PDEL2 = - RECEIVED SAMPLE t nT - AGCOUT @ t = (n-1)T - AGCOUT + BI + PDELO - PDEL1 @f= (n-1)T HIGH-FREQUENCY CARRIER YES PROD = AGCOUT* PDEL1 NO 2nd-DRDER LOW PASS FILTER SETSTWRDTO INDICATE CURRENT BDATA BAUDCK = BAUDCK +1 OUTPUT STWRD TO MODEM CONTROLLER Figure 9. Data Decision Algorithm Flowchart The function of the automatic gain control subroutine AGC is to compensate for amplitude distortions introduced by the telephone system, etc. References [5], [14] provide additional information on AGC. 360 Implementation of an FSK Modem Using the TMS320C17 Incorporating Additional Functions into the DSP One of the important tasks the designer faces is incorporating value-added software functions into the DSP source code found in Appendix B. The software presented here uses only 1.1 Kwords of the 4 Kwords of maskable ROM available on the TMS320C 17. This provides you with a significant amount of code space to implement value-added functions. This software offers a number of hooks that facilitate the easy inclusion of additional software. Note in Table 3 (Modem Controller Commands for the DSP), that the following commands are presently reserved: E, C, B, A, 6,4,2, I, and O. Each of these commands have bits 0 through 3 undefined. All of these commands can be used by the designer to call additional functions. You must ensure that the correct modifications are made to the modem controller and modem DSP software. The DSP control command interpreter (CCI) must be modified to recognize and respond to the new commands. The additional functions should be implemented in either a new or the appropriate existing subroutine. The option indicating to the main program that the new subroutine should be called, needs to be provided. This can be done using the STATUS register, or you can define a new register. You must also ensure that the XD AT A word will indicate the present status of the DSP to the modem controller. There are presently a number of unused bits in the XDATA word, so incorporating the modifications in the DSP is straightforward. Finally, you must ensure that the additional software functions do not exceed the timing requirements imposed by the 9600-KHz sampling frequency. Conclusions This application report presented you with the information required to implement a 300-bps V.211Bell103 FSK modem based on a TMS320CI7 Digital Signal Processor. Both hardware and software issues were discussed. A summary of the FSK modulation and demodulation algorithms and a basic review of modems were also provided.A discussion about incorporation of additional functions and software into the code provided concluded this report. Appendix A is a derivation of the FSK demodulator fractional delay filter coefficients. Appendix B is the TMS320CI7 source code listing. Acknowledgements The author wishes to acknowledge the contribution of Dr. Amin Haoni of Technekron, Inc., and George Troullinos, and Raj Chirayil of Texas Instruments. This report is based on their work. Implementation of an FSK Modem Using the TMS320C17 361 Glossary of Symbols and Abbreviations bps - Bits per second FSK - Frequency shift keying We Carrier signal angular velocity ow - Modulation shift of angular velocity t - Time cP - Phase shift wo - Angular velocity transmitted to indicate a 0 WI - Angular velocity transmitted to indicate a 1 T - The amount of time the received signal is delayed in the FSK demodulator fo - Frequency transmitted to indicate a 0 fl - Fequency transmitted to indicate a 1 fe - Carrier frequency ex - Sample fractional delay created by the single FIR filter References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] 362 DSP2400 Modem User's Guide, Texas Instruments Inc. (1988). "TMS320A2400A Modem Digital Signal Processor Data Sheet", Texas Instruments Inc., (1988). "TMS70A2400A Modem Controller Data Sheet", Texas Instruments Inc., (1988). Lee, E.A., and Messerschmitt, D.G., "Digital Communications", Kluwer Academic Publishers (1988). Bingham, J.A.C., "The Theory and Practice of Modem Design", John Wiley and Sons, (1988). Proakis, J.G., "Digital Communications", McGraw-Hill (1983). Troullinos, G., et al., "Theory and Implementation of a Splitband Modem Using the TMS32010" (document number SPRA013), Texas Instruments Inc. (1986). "TCM29C18,'CI9 PCM Codec Data Sheet" (document number SCTS021), Texas Instruments Inc., (1987). "SCHOOS Splitband Filter Data Sheet", Sierra Semiconductors (1986). First-Generation TMS320 User's Guide (document number SPRA013A), Texas Instruments Inc., (1988). "First-Generation Digital Signal Processors Data Sheet" (document number SPRS009), Texas Instruments Inc., (1987). "Digital Signal Processing Applications with the TMS320 Family" (document number SPRA012A), pp 27-69, Texas Instruments Inc., (1986). Parks,T.W., and Burrus, C.S., "Digital Filter Design", John Wiley and Sons Inc. (1987). Lovrich, A., Troullinos, G., Chirayil, R. "An All Digital Automatic Gain Control", Texas Instruments Inc., ICASSP Conference Proceedings, (1988). Implementation of an FSK Modem Using the TMS320C17 Appendix A Calculation of Phase Delay Filter Coefficients A key element of the FSK demodulator implementation is the 7r/2 phase delay of the carrier signal. The effectiveness of the demodulator is highly dependent on the accuracy of the 7r/2 phase delay. In a digital system, it is highly unlikely that the time delay required for the 7r/2 phase delay is an exact multiple of the signal sampling period. It will be necessary to introduce phase delays that are a fraction of the sampling period. To accurately generate the fractional delay, the digital signal processor uses a single zero FIR filter. This appendix derives the coefficients for the single zero FIR. Given the one zero FIR filter shown in Figure A-I: Figure A-I. One .Zero FIR Filter. Y(n) = X(n) + t3X(n-l) (AI) = = X(z) X(z) + t3 * z-l X(z) * (1 + t3z- 1) (A2) therefore Y(z) The transform of the filter is F(z) F(z) = Y(z)/X(z) = (1 + t3z- 1) The purpose ofthis filter is to introduce a precise group delay envelope) to the received signal 7. is defined as 7 = -dO(w) ~ dw = group delay Implementation of an FSK Modem Using the TMS320C17 (A3) 7 (delay of the signal (A4) 363 Evaluate F(z) at z F'(w) F'(w) = = F(ei w) R(w) = ei w to obtain the frequency response. = 1 + (3 e-jw + jl(w) = A(w)ei (w) (AS) (A6) Where R(w), I(w), A(w), and cf> (w) are real functions of w. A(w) = IF'(w)1 = [R(w)2 + l(w)2] 112 (A7) and = cf> (w) (AS) arctan (I(w)/R(w» Given e-jw = cosw - jsinw (A9) Substituting (A9) into (A5) F'(w) = 1 + (3 cosw - j(3sinw (AlO) From (A6), (AS), and (A10) cf>(w) = -(3sinw (arctan 1 + ) (3 cosw (All) Substituting (All) into (A5) -d cf>(w) -d 7= d dw -(3sinw (arctan ( 1 + (3cosw (AI2) )) now d (arctan (u» dx 1 du = --- *1 + u2 dx (A 13) therefore * -1 7 = -1-+-(---(3-s-in-W--)-2- d -(3sinw d:- ( 1 + (3cosw ) (AI4) 1 +(3cosw =( -(1 +(3cosw)2 + 2(3cosw + (3 «(3 + cosw) 1 + (32 + 2 (3cosw 1 364 + (32 ) *( - (3cosw - (3 (1 + (3cosw)2 ) (AI5) Implementation of an FSK Modem Using the TMS320C17 Assuming T is expressed in terms of sample delays D + {3 ({3 + cosw) D = -------------(1 + (32 + 2 (3cosw) (AI?) Rearranging (AI?) and using the quadratic equation to solve for (1-2D)cosw (3 = - ± «(l-2D)2cos 2w 2(1-D) + 4D(l-D»1I2 Given the desired group delay D, and the frequency f (AI8) = w/27r, the filter coefficient {3 can be determined using equation (AI8). Implementation of an FSK Mod~m Using the TMS320C17 365 w ~ HfHffHfHHHtHHftHffHHfHH"**fffH*ffHHfHHHHfHff**ffff***ffl DATA MEl10RY (RAIl) ASSIGN'IENTS APPENDIX B fHfffUffHHflHfHH***tfftHfIHff*H********,****UHfHI**tfHf********" • V21/BELL 103 I1OlJEI1 ASSEIIBlY LANGUAGE SOFTWAAE FOR TMS32OC17 IMPLEMENTATION. ~L RIGHTS RESERVED BY TEXAS INSTRUMENTS (C) HHfffHfHffflHHHHHffHHf*H+HfffHffHfHtffH**Hf-f-II-HH***f**Hf-' 01/SEP/89 VERSION 1.0 HIf-HIHIHH*******fHtfH***fH****ffH**UHHHI***HH*******tfHH,****f .option x HHUHfffHt*****fH****************H*************HH****H,*************** CONSTANT DEFINITIONS ~ 'ti ~ HtHfl*H*,****f**f**,***********************fflHHi***fIfHH***************** Rll'lSK: ~ ANMSK: LMSK: LDMSK: g' NTXI1SK: NRCI1SK: E; .s?, ., ~ ~ NSP"SK: TXSH: RCSH: OCOh OSh OF3h 04h .set .set .set .set .set .set .set .set .set OCFh 03F. OFC. O4h 06. . set ,set .set ,set RXFRQ: RXPHS: TMP4: HIPS: .set .set • set .set .set .set .set .set .set 16 ONE+l STWRD+l XSCNTR+l RSCNTR+! SCNT+l lBITS+l XOUT+l RIN+! T1FRfl+l T1PHS+l RXFRQ+l RXPH5+1 TMP4+1 TMP2: TMPO: .set .set TMPS+! TMP2+! nlP3: Tl1Pl: ,set TMPO+! .Stot T~P3+1 TInIND: .set .set TMPl+! IRCNT+l ,set TI"IND+l TXFRQ: TXPHS: .set .set DTtIf FLAG CONSTANT 1 51 DETECTION COONTER : REC. BAUD COUNTER : NOMINAL BAUD COONTER : OUTPUT SAMPLE : INPUT SAMPLE , RECEIVE DEI1OOULATION ANG.E (KH) ~ , PARTIAL FILTERED SIGNAL wen) AGCREF: ffHHf*HHHHH4HHffHfHffH"tf**fffffHffHHHfffftHf*********f****f • ,et 05116. HIGH PASS FILTER CONSTANT So IN THE FSK i'IlDE, THE TX/RX PARAPlETERS SHARE THE SANE I1ElIORY AS THE EWALIZER DELAY LItE OD: AGCOUT: PDELO: PDELt: ~ PDEL2: TAU: .,tt 14 , <16 - 14 LPDELO: LPDELt: LPOEL2: GAIN: FSKDAT: BAUIJC)(: .set .set .set .set .set •set .set .set .set • set .set IRO PROD+l AGeOUT+l PDELO+l POELl+! PDEL2+1 LPDELO+l LPDEL1+1 LPDEL2+1 GAIH+l FSKIlAT+l nl Q. = .... == tHHHlttHff****fHHfHHflffHtffff*****ftffftff****"*fHffffffffftftftH ()Q "CI ~ AGe EQUATES ~ '-.l .set .set • set i-**fffU*****HHHffl****fH*,"*fHHfffftfHtU****HtHHHftHifHffHHH* 3 Q XIlATA: DTFLAG: ONE: SleNT: STWRD: XSCNTR: RSCNTR: SCNT: XBITS: XOUT: RIM: •IRQ: fHf****fH****H***HfHHHHfHtH***Hffffflftfff*****fftffffffHfHHHH ~ ~ ::5 •STATUS: •IReNT: ~ S· H**tHfH*********fHH*******tfHfHff**fHHH*H*11111111111 ~ IlfHffHHH HffHfltH**fHHft**************t**tH*****f**********ffftHnHf",**HH**f ~ ~ HfHfffHHIHHfflHHHlfHHHUHHtHffffHfHfllllllllllllllfHHfHfH ; OUTPUT IF PRODUCT DEIIOOULATlll , PROOOCT DEIIlOOLATOR DELAY LINE , FSK LOIIPASS DEMOD DELAY LIIE GAIN OF FSK DEMOD FILTER (0.5 OR 1.0) OUTPUT IF FSK SlICER (X111) BAUD CLOO< FOR FSK TIMIMl RECO'IERY ~ BlI/\TA' TRANS' 1f COUNTR' BIFSK' AIFSI<' A2FSK' FOADD' FlADD' FSI Q '-I fHHfHf4Hf*II,IIII.II.'.IHtHfffHff**flllllllllll •• 111****IIIIIIIIHI"*1 BDCNTR' • set HYST+I ffHlHfffff**fffHftHfHHHfltHfHfffHHHifHff"*fHffHf****fHHHHH PAGE 1 RAn ASSIIillllENTS ffHfHffHf*.*HHIfHHfHfHHHUHIIIIIIIIIIIIIIIHffHfffHHffHfHffffff •XI< X2' Sf: STlSB' p~: I'EGSn' • set .set .set .s.t .5et .s.t X1+1 X2+1 ST+l STlSB+1 POSSII+l .set .word ...ord •..ord ~ $ • 1liiOI'd 021ddh Olc89h 01852h 07fffh FSK, 103, 03bSSh 50 2100 HZ ANSIER TIlE 2225 HZ ANSIER TOlE DEAD ZIl'£ OF FSI< DEIIlD SlICER COEF Al OF FSK DEIIlD FILTER CIlEF A2 OF FSK DEIIlD FILTER .lIIor4 ."ord .word IN START ff********UfHHHfHHHHffUUffffH:lffft-fffHUffUfHfffHHHHUfHU1t ~ ~ IRCNT Tl"IND . text fHHHHIH",*ffHffHHHHH****HHffHtHtHffHfHfffflffHffHfffHflH AYESQR, GN: HYSn • Sft •s.t B HfffHUHHffffHffffHHHffftfftfttffHftHHHfHfl+IlHfHffHllfHlHH ~ ~ .set .set .set .set .set .set .set .set .set •set F2U ."ord F22' .1II0rd ZII£' FSKAU FSKA2' .lIIord .word • 1liiOI'd 03600h 06bbh 04_ OUdbh &i ,word .word COIIIIIiGJ IIlDE SUBROlITII£ Loo<-ll' TABLE .word IN CatIAND mlE, EACH COOtAND BYTE ctllRESPONDS TO AN ENTRY ffRE WHICH TI£ NAIIE (F TI£ _lATE SUBROOTII£ TO CALL ·TO EXECUTE TI£ ClJIII1ANII. THE riIIIIER (F lNlEfll£D SUIIROUTINES (AT ADDRESSES 00, 01, 02, 04, 06, 00, OB, OC, AND OEhl rEANS INCAEASED SV5m EXPANSION IS EASILY ACCOIIlIIATED. ~TAINS HffHflffffHffHfIIIIIIIIIIIIIIIlHHHHft+lfffH*fHfHffIHfHfHHffHfH •CIIIlTB1.I .set $ .wor-d NONE .word Nl£ ,lItOrd NlNE ,\dOrd RESET lIllO-I'd NlNE .wGI'd FSKSET NONE .1III0rd ~ 1 .. ;:s ~ ~. ~ ~ ,lIIOrd DTIF ,word NONE ,lIIord NONE NONE IJ'ER .lIIOl'd s .Q., Rtm;: •word .word ~ g' ,word .word ,lIIOrd XIIlDE NONE PROTO PERIOD. IH"ltHHIHHHHHtfff***HHHfffHfff*****"tfHfHHffff******ftHfHffH RSEQTB' •set $ .word ,lIIo.l'd .blOl'd sCI> .lIIOrd NONE ,Mrd .word .lIIord NONE RTSKIO NONE NONE B ""l .~I'd .word fl*fHHfHHHHfHfHHHHHltHftHHHH+HfH*****HHfI***HfHffHffH SERlII!. PORT CONTRa. REGISTER MTA HffHfffHHitHlfffHfHHH********HHHHffflHlHfHflflHfHflffHfHlff MI: 00: 1lA3: ,lIIord lilloI'd .~rd O39OFh 02CBEh 0380Fh ; MODIFIED TO USE H/W ClN'IPANDING IfHHlUHHHItHHHIHHHHfHffff*f'**HfHffHIHHHfH*ffffl**'****" I'olC MTA THE FOlLOWING VALUES ARE TI£ Cll!.CULATED VALUES WITH NO WINDOW IIREI1EHTATION ARIXJNIl TI£ THmUICII!. ENERGY BAND OF QAII SIGNALS. IllWEVER, /ltE' TO 151 EFFECTS, WINDOWS ARE REQUIRED. FOR PROPER (fERATION, THESE VALUES I1UST BE ADJUSTED FOR APPROXltlATELY 3 DB DIFFERENCE IN SIONAL ENERGY LEVELS TO ClJIIPENSATE FOR TI£ WINDOWS. TRANSII/T DTtF CHARACTER NOT DEFII£D NOT DEFII£D NOT DEFII£D seT IJ'ERATING MODE NOT DEFII£D PROTOCOL SELECT USED TO S£LECT DISTRIBUTED RECEIVER TASKS. THIS IS IIIPORTANT IN HIGI£R FtN;TIONII!.ITY SYSTEI'IS THAT CANNOT IIRENEIIT TASKS IN A SItG.E SANPLE .1II001'd ,lIIo.ra .lIIord ,lIIo.rd ~ MlT DEFII£D NOT DEFII£D NOT DEFINED RESET TI£ DSI' NOT DEFINED FSK MTA MODE MlT DEFINED RECVR. MODE seTlJ> TRANS. IIlDE seTUP RECEIVER SUBROUTINE TABLE ~. ~ OOh lXh 2Xh 3Xh 4X' 5Xh bXh 7Xh SIlX 9X. AXh BX. CX. DXh EX. FXh HffHHI******flHf**IHHHHHiHtfHHlffHtfIHlfHllHfftfffHH*HI***I" • NONE NONE NOI£ NONE NONE NONE NOr£ NONE ~ ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Nl£ NONE Nl£ ***fHfffH**************HfHHf****"****HHHfffffHHHHffHHffffHfHf •THRESI .word THRES2 .lIIord TI-fiES3 .lIIord .lIIord T~ THRES5 THRESo .~ord I1AXALP: PSIII NSIII THRESH .lIIord • THRES2' THRES3: OOES4: THRES5: TII1ES6' HYSINC • .lIIOl'd lIllOI'd .1I0rd .1II0rd • lieI'd .1II001'd ,lIIord .blord .1II00rd •1II00rd -48.0 DB/( REC. LEV. (1\=35.731 -43.5 DBn REC. LEV. (A=21.281 -24 DB/( REC. LEV. (AFE=ON,A=2.251 -24 DB/( REC. LEV. (AFE~F,A-S.981 -31 DB/( REC. LEV. (AFE=OFF,A=20.091 -31 DB/( REC. LEV. (AFE=ON,A=5.051 23BB' 15481> 240h aFRh 1417h OODh 038Alh 01EA6h 0113. 0194C. 0fF5. 0199. 06B0. OEOO. 0490h OFOFh ; ; ; ; ; ; -52.0 DBM RECEIVE LEVEL BAUD ENERGY ERROR LEVEL 10628 BAUD ENERGY ERROR LEVEL 1 -48.0 DB/( REC. LEV. (1\=25.301 -43.5 DB/( REC. LEV. (A=15.9bl -24 DBII REC. LEV. (AFE=ON,A=I.6 ("') ...... '-J IIfLTA = (F .lIIord .-.ord • word DTMF TIlE TABLE: IF) • N S .4IIord •word ,lfOrd .lIIIord WITH N =256 TABLE SIZE F =9600 HZ S F =FREIlUENCY (J' INTEREST • lIIord .lIIord ,tlord .lIU)rd *H*H**H*********fH*********HHttftH**"*****"fHffHHfff**********HH OATA FORMAT IS S7.8 TO BE AS STEP SIZE. THE TABLE ENTRIES ARE HOI£\IfR. TREATED AS 16 BIT tJIISIGIEll INTEGERS. A IlULTlPLICATlON OF DELTA BY 256 roES THE NECESSAAY CONVERSION IN FORMATS. .lIIord .word ,lIIord .lIIord • lIIord HfffHffffflft*******fnt*fHiiHHfUlfHHfHHf"*fUHHtffHtffffHHfUt •TONTBL: .word .word .IIIord .lIIord ,lIIord .1II0rd 0191Bh 023Allh ; 0 LOW FRElI 02AOh ; LOW FREQ GAIN ; HI FREQ GAIN 03AOh .lIIord •illord • lillOI'd .lIIord .lIIord .lIIord .1II0rd .1II01'd 016i8h 027620 0290h 0300h ; 9 01296• 02B8Ch Q493h 049311 ; A OI4BSt• 02118Ch Q493h ; LOW FREQ GAIN ; HI FRElI GAIN ; LOW FREQ GAIN ; HI FREQ GAIN ; LOW FRElI GAIN ; HI FREQ GAIN ; B ; LOW FREQ GAIN , HI FRElI GAIN 0493h 016B8h .lIIord 02B8Ch .word 0493h 0493h ; LOW FRElI GAIN , HI FRElI GAIN Ol91Bh 02B8Ch 0493h O493h ; D 0191Bh 0203Eh OJOOh OJOOh ; E (t) 01918h 02762h OJOOh 0300h ; F (I) .illord .lIIord .lIIord , LOW FRElI GAIN ; HI FREQ GAIN .\IIort! .lIIOrd ,lIIord .lIIord Ol296h 02762h OBAOh Q493h ; 3 .illord ; LOW FREQ GAIN ,HI FRElI GAIN .lIIord ,lIIord ,lIIord 01488h 0203Eh OZEOh 03AOh ; 4 ,\dOtd , LOW FRElI GAIN , HI FRElI GAIN ,lIIord ,Il101'0 ...ord I..:> ; 8 .word .lIIord $ 016118• 023AOh 02A1lh 03DOh ; LOW FREQ GAIN ; HI FREQ GAIN ,1II0rd , 2 ; 5 .1II0rd 014B8h 023AOh 0340h 0420h .lI&rd 014B8h , 6 .lIIord ; 7 ; LOW FREQ GAIN ; HI FRElI GAIN 023ilOh OBOOh 0493h .ltIOrd 016118h O203Eh 02AOh 0370h ; 1 01296h .lford ; LOll FRElI GAIN ; HI FRElI GAIN 020JEh OBOOh Q493h .ldord .word .word .word 03A0h OI296h .lIIord .lIIord 02762h ()3.4Oh ; LOW FRElI CAIN , HI FRElI GAIN .word .lIIord .lIIOrd , C ; LOW FRElI GAIN ; HI FREQ GAIN ; LOW FRElI GAIN ! HI FREQ GAIN ; LOW FRElI CAIN ; HI FRElI GAIN W HHHttHftHHIfl"********HHIlIIIIIIII ••• IIIIIIIHIHfHHffHHHIHHfH -...J 0 .W!". IHltHH4H+HHHHHHHHHHHHtHf •• 11 II II III I IIHHflHHfffHHfHH* .copy "COSTBL.M)()' ; .COSIIIE F\l!CTlON TABLE fHIHfHHHHHHfH*****"*I***********ffHfHHfffffHfflffffIHfHH***** COSIIE LOOKUP TABLE' 257 ENTRIES OYER THE RAMlE [O,Pll. THE RESOLUT!OO OF THE TABLE IS THEREFlIRE • U80 I 256 ) = 0.703125 DEGREES HHHf*,****,f"*HtfHff***HIHHHffHffHftH*"****",**ftHfHHHfHH COSOFF: .set $ • ~rd 07FFFh 07FFEh 07FF6h 07FEAh 07FD9h 07FC2h 07FA7h 07F87h 07F62h 07F38h Q7FOAh 07EDbh 07E9Dh 07E60h 07EIEh 07dDDh 07llSAh 07D3Ah 07CE4h 07C89h 07C2Ah 07BCbh 07850h 07AEFh 07A7Dh 07A06h 0798Ah 0790Ah 07885h OnFBh 0776Ch 076D9h 07642h 075A6h .tlord ~ ,lOOl'd ;1! .lII6rd .lIIord "t:j ~ (t> ;:! S g' ~ I::> ;:! ~ ~ ~ 1} ;1! s: S· Oq S(t> ~ tJ N ~ a 'l . .,ord ,blord .lIIl'Ird .~rd .\IIord .word .lIIord .lIIord .1II0rd .word .lIIord .~rd .\IIord .\fOrd .Ulord .word .\IIord .word .1II0rC .word .word .w.ord .1II0ra .word .1II0ra .lIWrd .1II0rd .lIIOrd .tlOcrd .lIIOl'd .lIIord ADDITIIlIiIL TABlES ; COSINE TABLE LENGTH • 512 ; AIIGLE • 0.0000 COSIIE = 1.000000 ;AIIGLE. 0.7031 COSUE: 0.999925 ;AIG.E. 1.4063 COSIIE' 0.999699 ; MIlLE· 2.1094 COSINE. 0.999322 ; ANGLE' 2.8125 COSINE' 0.998795 ; MIlLE = 3.5151> COSIIIE: 0.998118 ; ANGLE' 4.2188 COSIIE. 0.997291 ; ANGLE' 4.9219 COSINE: 0.996313 ;AIG.E' 5.6250 COSUE: 0.995185 ,ANGLE' 6.3281 COSINE. 0.993907 ;MIlLE' 7.0313 COSINE: 0.992480 ; ANGlE· 7.7344 COSINE' 0.990903 ; MIlLE: 8.4375 COSHE. 0.989177 ;AIG.E' 9.1406 COSINE: 0.987301 ; ANGLE: 9.8438 COSINE' 0.985278 , AIIIlLE. 10.5469 COSINE' 0.983106 , ANGLE' 11.2500 COSIIE' 0.980785 ; MIlLE' 11.9531 COSINE: 0.978317 ; ANGLE' 12.6563 COSllE· 0.975702 ; ANGLE' 13.3594 COSINE. 0.972940 ; MIlLE' 14.0625 COSINE· 0.970031 ; ANGLE = 14.7651> COSINE· 0.966976 ; ANGI.E: 15.4688 COSINE· 0.963776 ; AIIGLE. 16.1719 COSINE: 0.960431 ; ANGLE. 16.8750 COSINE: 0.956940 ; ANGLE' 17.5781 COSINE. 0.953306 ; AIG.E: 18.1Il13 COSIIE' 0.9495l!l ; MIlLE. 18.9844 COSINE: 0.9451>07 ; AIG.E = 19.6875 COSIIE' 0.941544 ; ANGLE' 20.3906 COSINE: 0.937339 ; AIG.E' 21.0938 COSIIE' 0.932993 ; AIG.E' 21.7969 COSINE' 0.928506 ; AIIIlLE' 22.5000 COSINE' 0.923880 ; AIIGLE' 23.2031 COSINE' 0.919114 .word .word .word .word ,lIIord .word .IIIord .lItord _IIIord .word .1II0rd .word .1II0rd .word .word .ldord ••ord .lIIOl'd _tlord ,lIIOrd ,lIIord •word ,lIIord ,Irord .IIIord .lIIord .lIIore •word .lIIord .lIIord .1II0rd .lItOrd ,lIIord ,!IIord .IIIOcrd .blord .lIIord .~rd .1II0N! .~rd .1II0rd .word .1II0ra .lIMIrd .1II0rd .lIIord .lIIOrd .lIIord ••ra .!IIord .lIOrd 07505h 074601> 07386h 07308h 07255h 0719Eh 070E3h 07023h 06f5Fh 06E97h 06DCAh 06CF9I1 il6C24h 06B4Bh O6II6Eh 0698Ch 068A7h 0678Dt1 O66OOh 065DEh 064E9h 063EFh 062F2h 061Flh 060ECh 05FE4h 05ED7h 05DC8h 05CB4h 0589Dh 05A82h 05964h 05843h 057IEh 055F6h 054CAh 0539Bh 0526911 05134h O4FFBh 04ECOh O4OOlh O4C4Oh 04AFBh O49B4h 0486Ah 0471Dh 045ClJl 0447Bh 04326h 04ICEh 04074h WI7h 03088h ;. ; ; ; ; ; ; , ; ; ; ; ; ANGLE = ANGLE = ANGLE = ANGLE' AIIIlLE = ANGLE = AIIIlLE = ANGLE = AIIGLE = AIIGLE = AIG.E' AIG.E = AIG.E' ; AIiGLE = ; ANGLE' ; AIG.E = ; AIG.E' ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; MIlLE. AIG.E: AIIGLE' AIG.E: ANGLE· AIG.E: MIlLE' MIlLE' ANGLE' ANGlE' ANGLE: ANGlE = AIG.E = ANGlE' MIlLE' AIIGLE· ANGLE: At«iI..E: ANGLE = ANGlE: ANGLE = ANGLE: ANGLE = ANGI.E' ANGLE' ANGlE: ANGLE' ; AIG.E' ; ; ; ; ; MIlLE· AIIGLE: ANGLE' ANGI.E' ANGLE· ; AIG.E' ; MIlLE· ; AIG.E' ; ANGLE' 23.9063 24.6094 25.3125 26.0151> 26.7188 27.4219 1Il.1250 28.8281 29.5313 30.2344 30.9375 31.6406 32.3438 33.0469 33,7500 34.4531 35.1563 35.8594 36.5625 37.2656 37.9688 38.6719 39.3750 40.0781 40.7813 41.4844 42.1875 42.8906 43.5938 44.2969 45.0000 45.7031 46.4063 47.1094 47.8125 48.5151> 49.2188 49.9219 50.6250 51.3281 52.0313 52.7344 53.4375 54.1406 54,8438 55.5469 51>,2500 51>.9531 57.6563 58.3594 59.0625 59.7651> 60.4688 61.1719 COSUE' 0.914210 COSIIlE·. 0.909168 COSIIE = 0.903989 COSIIIE = 0.898675 COSIIE = 0.893224 COSIIE = 0.887640 COSIIE. 0.881921 COSIIE. 0.876070 COSIIE = 0.870087 COSINE. 0.863973 COSIIE' 0.f1m29 COSINE. 0.851355 cOSIIE =0.844854 COSINE. 0.838225 COSIIE' 0.831470 COSINE. 0.824589 COSIIE: 0.817585 COSIIE: 0.810457 COSHE = 0.803208 COSINE: 0.795837 COSINE' 0.788347 COSINE: 0.780737 COSINE'· O.mOl1 COSIIE: 0.765168 COSINE' 0.757209 COSINE: 0.749137 COSIIE' 0.740951 COSINE' 0.732655 COSIIE' 0.724247 COSIIIE: 0.715731 COSIIE' 0.707107 COSINE: 0.6983n COSIIE: 0.689541 COSINE' 0.680601 COSINE: 0.671559 COSINE. 0.662416 COSINE' 0.653173 COSINE' Q.643832 COSINE. 0.634394 COSINE' 0.624860 COSINE. 0.015232 COSINE. 0.605512 COSIIE: 0.595700 COSINE: 0.585799 COSIIE: 0.575809 COSIIIE' 0.51>5733 COSIIE: 0.555571 COSIIIE. 0.545326 COSIIE: 0.534998 COSINE' 0.524590 COSIIE: 0.514103 COSIIIE: 0.503539 COSINE: 0.492899 COSINE. 0.482184 3' ~ ,lIIOl'd 'ti .word .lIIord .IIIOl'd ~ ;:s .1II01'd is' ,lIIord ,lIIord .sa, .lIIord \:l ,lIIord §. ,IIl0l'd .1II01'd ;:s .word ,blord ~ ~ .!IIol'd .lIIord ,lIIord t} .word ~ .lIIord .IIO'rd OElCh ,!IIord .lIIord s:S· .word .word .lIIord .lIIerd Oq So ./llord ~ .1II0rd ~ .lIIord .4IIord .tlord ~ tv <;:;, .word .IiIQl'd <"'.! ..... 'I .lIord OCBC, OAFBh On.B' 0709, ,lIIord 0648h ,word .lIIord ,lIIOrd 0486, 032411 0192, ,set $ ,lIIord ,lIIord ,lIIord ,lIIord OOh OIE6£h OiCDCh OIB4A, OF9B8h OF827b OF695O OF50Sh OF374h OFIE4h OF055h OEECbh OED38h .lIord .IIIO'rd SINEO: ,1liiOI'd ,llIOrd ,lIIord .lIIord ,1liiOI'd .lIIQrd .lIIord W -...j ..... 028270 026A8h 02528h OnA7h 02224, 0209Fh 01FIA, 01D93h 01eoC, 01AS3h 018F9, 0176£h 015£2h 014550 OI2C8h 011JAh OFABh ,iliaI'd ~ 03CS7h 03AF3h OmDh 03825h 036BAh 0354E, 033I1Fh 0326£h O3OFe, 02F87h 02Ellb 02C99h 0281Fh 029A4h .1IIord ,lIord = 61.87SO = 62.5781 = 63.2813 ANGLE = 63.9844 ANlI..E = 64.6875 ANGLE = 65.3906 AI«3LE = 66.0938 ANGLE = 66.7969 ANlI..E = 67.5000 ANGLE = 68.2031 ANll.E = 68.9063 ANGLE = 69.6094 AtG.E = 70.3125 ANGLE = 71.0156 AtG.E = 71.7188 ANGLE = 72.4219 ANGLE = 73.1250 ANGLE = 73.8281 ANGLE = 74.5313 ANGLE = 75.2344 ANGLE = 75.9375 ANGlE = 76.6406 ANGLE = n.343B ANGLE = 78.0469 ANGLE = 78.7500 ANGlE = 79.4531 AtG.E = 80.1563 ANGLE = 80.8594 At«lLE = 81.5625 , , , , , , , , , , , ; , ; , , , , , , , , ; , , , , , , , , ANGLE = ANGLE = ANGlE = ANGLE = ANGLE' AtG.E = ANGLE = ANGLE = ANGLE = ANGlE = ANGLE = 82.2656 82.9688 83.6719 84.37SO 85.0781 85.7813 86.4844 87.1875 87.8906 88.5938 89.2969 COSllE =0.411397 COOlNE =0.460539 coonE =0.449612 COSINE =0.438617 COOlNE =0.427556 COSINE =0.416430 COSINE =0.405242 COSINE =0.393992 COSINE =0.382684 COSilE =0.371318 COSINE =0.359S95 COSINE =0.348419 COSINE =0.336890 COSINE =0.325310 COSINE =0.313682 COSINE =0.302006 COSINE =0.290285 COSINE =0.278520 COSINE =0.266713 COSINE' 0.254866 COSINE =0.242980 COSINE. 0.231058 COSINE =0.219101 COSINE =0.207111 COSINE =0.195090 COSINE =0.1B3040 COSINE' 0.170962 COSINE' 0.1S8B5B COSINE =0.146730 COSINE =0.134580 COSINE =o.muo COSINE =0.110222 COSll'E =0.098017 COSINE =0.085797 COSINE =0.073504 COSINE' 0.061320 COSINE =0.049067 COSINE' 0.036807 COSINE' 0.024541 COSINE' 0.012271 , , ; ; , , , , , , , , , ANGLE = ANGLE = ANGLE = ANOLE' ANGlE = ANll.E = ANGLE = AOOLE = ANGlE' AN3l.E = ANGlE = AN3l.E. ANGLE. 90.0000 90.7031 91.4063 92.1094 92.8125 93.5156 94.2188 94.9219 95.62S0 96.3281 97.0313 97.7344 98.4375 COSINE COSll'E COSINE COSINE COSINE COSIIE COSINE COSIlE COSINE COSINE COSINE eoSlJE COSINE , ANGLE ; ANGLE ; AI«3LE ; ; , , , , =-.000001 =-.012272 =-.024542 = -.036808 =-.049069 =-.061322 =-.073566 =-.085798 =-.098018 =-.110223 =-.122412 = -.134582 =-.146732 offord ,lIIord .lIIord ,lIIord .lforlj ,word ,IIIGi'd ,1IIC1rd .1II01'd ,lIIord ,lIIord ,lIIord .lIIord ,lIIord ,lIIOrd . .,ord ,lIIord ,lIIOl'd .lIIord ,!IIord .filord .!lilord .lIIord .1II0rd .blord ,lIJor·d ,blord ,/llord .II/O'rd .liIord .liIord ,lIIard .II/Grd .!IIord .lIIord ,word .1II0rd ,lIIord ,lIIO'rd .wO'rd ,ldord ,word .IIIO'rd .!IIord .lIOrd .IIIGrd .ord ,lIIord .word .IIIO'l"d .lIIord ."ord .word .IIIord OEBAAh OEAIEh OEB92h 0E707O 0E57Dh 0E3F4h OE26!)h OEOE6h OIIF61h ODDDCh 0DC59, ODAOSh 00958, OD7D9h 0065Ch OD4Elh 003670 ODIEFh OD079, OCF04h OCD92, OCC21h OCA82h OC946h OC7D8, OC673l> OCSOOh OC3A9h OC248, OC0E9h OBFBCh OBE32h OBCOA, OB885h OBA33h OBBE3h OB796, 0864Ch OB505h OB3COh OB27F, OBl40h OB005h MECC, OAD97h 0AC65h OAB36h OAAOAh OABE2h OA78Dh OA69Ch OA57Dh OA463h 0A34Ch ; ; , ; ; , ; , , , , , , , , , , , , , , , , , , , , , ; , , , , , , , , , , , , , , , ; , , ; , , , , , , AI«lLE = 99.1406 AI«lLE = 99.8438 AI«lLE = 100.5469 ANGLE = 101.2500 ANllE = 101.9531 ANGLE = 102.6563 AI«3LE = 103.3594 ANGLE =104.0625 ANll.E = 104.7656 ANGLE =105.4688 ANll.E =106.1719 ANGLE = 106.87SO ANll.E = 107.5781 ANGLE = 108.2813 AtG.E =100.9844 ANGLE =109.6875 ANGLE = 110.3906 ANGLE. 111.0938 ANll.E = 111.7969 ANGLE' 112.S000 ANGLE = 113.2031 ANGLE = 113.9063 ANGLE = 114.6094 ANGLE = 115.3125 AtG.E =116.0156 ANGLE = 116.718\1 ANGLE = 117.4219 ANGLE = 118.1250 At«lLE • 118.8281 ANGLE = 119.5313 AtG.E = 120.2344 ANGLE = 120.9375 ANOLE = 121.6406 ANGLE = 122.3438 ANll.E = 123.0469 ANGLE = 123.7500 ANGLE = 124.4531 ANGLE =125.1563 AtG.E = 125.8594 ANGLE • 126.5625 ANGLE = 127.2656 ANGLE = 127.9688 ANGLE = 128.6719 ANGLE =129.3750 ANGLE = 130.0781 ANGLE • 130.7813 ANOLE = 131.4844 ANGLE = 132.1875 ANGLE =132.8906 ANGLE = 133.5938 ANllE = 134.29.9 ANGLE = 135.0000 ANOLE • 135.7031 ANGLE = 136.4063 COSllE = -.150059 COOlNE =-.170963 COSINE =-.1B3041 COSINE =-.195092 COSINE =-.207113 eoSINE =-.219103 COSINE =-.231060 eoSINE =-.242982 COSllE =-.254867 COSINE =-.266714 COSIl'E =-.278521 COSINE =-.290286 COSINE =-.302008 COSINE =-.313683 COSllE =-.325312 COSINE =-.336892 COSINE =-.348420 COSINE =-.359897 COSllE =-.371319 COSINE' -.382685 COSINE' -.393994 COSINE =-.405243 COSll'E' -.410431 COSINE =-.427557 COSINE =-.438618 COSINE =-.449613 COSINE =-.460541 COSINE =-.471399 COSINE =-.482186 COSll'E =-.492900 COSllE =-.S0354O COSINE =-.514105 COSINE = -.524592 COSINE' -.535000 COSINE = -.545327 COSll'E =-.555572 COSINE =-.565734 COSINE. -.575810 COSINE =-.585800 COSINE' -.595701 COSINE =-.605513 COSINE. -.615234 COSllE =-.624862 COSINE =-.634395 COSINE =-.643834 COOlNE =-.653175 COSINE = -.662418 COSINE =-.671561 COSII'E =-.680603 COOlNE =-.689543 COSINE =-.698378 COSllE =-.707109 COOlNE =-.715733 COSINE =-.724249 .... -I N ,lIIOl'd .lIIord ,lIIord ,lIIord ,lIIOrd ,lIIord ,word ,liard ,lIIord .lIIord .lIIord .lIIord ,llI&rd .~ord .~rd .lIIord .lIIord .1II0rd .lIIard .klord .~ord ~ 'ti :: ~ ;:". '" ;;! s:S· OIl S- '" ~ ~ N C:> ~ ..... '-I .\IIord .lIIora .yord .!JIord ,11101'0' .1II0rd .lIIord .lIIord .word •lIIord •.,ord .word .lIIord .1II0rd .word .lIIord .\IIord ,lIIOrd ,lIIord .irIOrd .wrd .word ."ord .1II0rd .1II0rd .lIIord .word •!fOrd .•ord •.,ord .lIIord .lIIord .word CA238b CA1281t M01Cb O9FI4b 09EOfb O9DOEb O9Cllb O9B17b 09A22b 09930b 09843b 09759h 09674b 09592b 09485b 093DCh 09307b 09236h 09169h O9OAlb OafDDb 08F1Dh 08E62b oaDABb 08CF8b 08C4Ab oaBAOb oaAFBh 08A5Ab 089BEh 08927• 08S94h 08S05b 08n8lt 086F6b 08676h 085FAh 08583b 08511h 084A3h 0843Ab 083D6h 08377b 0831Cb 082C6b 08276h 0822Ah 081E2h 081AOh 08163h 0812Ab oaoFbh 08DC8b 0809Eh , , , ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; , ; ; ; ; ; ; ; ; ; ; , , ; ; ; ; , , ; ; ; ; , ; INll II'lGI..E INll ANGLE ANGlE ANGLE ANGlE ANGLE INll ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE II'lGI..E ANGlE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE ANGLE INll ANGLE = 137.1094 =137.8125 =138.5156 =139.2188 =139.9219 =140.6250 =141.3281 =142.0313 = 142.7344 =143.4375 = 144.1406 =144.8438 =145.5469 =146.2500 =146.9531 = 147.0563 = 148.3594 =149.0625 =149.7656 = 150.4688 = 151.1719 = 151.8750 = 152.5781 =153.2813 = 153.9844 = 154.6875 = 155.3906 = 156.0938 = 156.7969 =157.5000 =158.2031 =158.9063 = 159.6094 = 160.3125 =161.0156 =161.7188 = 162.4219 =163.1250 =163.8281 = 164.5313 =165.2344 = 165.9375 = 166.6406 = 167.3438 = 168.0469 = 168.7500 = 169.4531 = 170.1563 = 170.8594 =171.5625 =172.2b56 =172.9688 = 173.6719 =174.3750 COSlt£ =-.mb56 COSIIE =-.740953 COSIr£ =-.749138 COSINE =-.757211 COSIr£ =-.765169 COSINE =-.773012 COSIr£ =-.780739 COSINE =-.788348 COSIr£ =-.795839 COSIr£ =-.803210 COSINE =-.810459 COSIr£ =-.817587 COSINE =-.824591 COSINE =-.831472 COSINE =-.838227 COSINE =-.844B56 COSINE =-.851357 COSINE =-.857730 COSINE =-.863975 COSINE =-.870089 COSINE = -.876072 COSINE =-.881923 COSIr£ =-.887641 COSINE =-.893226 COSIr£ =-.898676 COSINE =-.903991 COSIr£ =-.909170 COSH£ =-.914211 COSIr£ =-.919115 COSllE =-.923881 COSINE =-.928508 COSINE =-.932994 COSIl£ =-.937341 COSINE =-.941546 COSINE =-.945609 COSINE =-.949530 COSINE = -.953307 COSINE =-.956942 COSINE = -.960432 COSIIE =-.9!J177 COSIIE =-.966978 COSINE =-.970032 COSINE = -.972941 COSIIE =-.975703 COSIr£ =-.978318 COSINE =-.980786 COSINE =-.983106 COSINE =-.985278 COSIr£ =-.987302 COSINE =-.989177 COSINE =-.990903 COSINE = COSIIE =-.993907 COSINE. -.995185 -.m480 .\IIord .1III0['d ,lIIord .word .!IIord .word ,lItord .lIIord 08079b 08059b O803Eb 08027b 08016b oaooAb 08002b O8OOOb , , , ; ; ; ; ; ANGLE ANGLE INll ANGLE ANGlE ANGLE INll ANGlE = 175.0781 = 175.7813 = 170.4844 = 177.1875 = 177.8906 = 178.5938 = 179.2969 = 180.0000 COSIt£ COSIIE COSINE COSINE COSINE COSIr£ COSINE COSINE =-.9%313 =-.99ml =-.998118 =-.998796 =-.999323 =-.999699 =-.999925 =-1.000000 HffffffHHHHffH*******ffHfHHfHHfHfHIHHfHf**HHffHttHffHHf* MIN_All ftffHHfH+HfHfHitfl***ft**,tHfHffHflHHHHf*****HHHfHfH+ffHHf INlTIALIZATlOO CQIE tH**fUfH+HfnfffHlfnff**fH"HfH-tHfn*****Hu*******HtHfffffHf***** •START DINT ffHfHf***Hff*tHHHHHfHf****H***HHH+Hffff**HUffHfHHfH*fHi'** CLEAR ALL RAIl fHffHft******************HHHfff.tHftffHHfHfH******f**f****f********** LDPK LARP LARK lAC CRAM . SACL lIIWl SACL 0 ARI ARl.143 CRAI1 0 ; CLEAR RAM 0 ***fHtffHHffHfHfHff**f*ffltfHHHff****f*"f**fHHftHf*************" START INITIALIZATION CODE - FIRST INITIALIZE PAGE 1 DATA "*ffHUHffHf***tHttHHIHHfHft*fllllll.I •• III.,I******ffffHttHfHfff Llf'I( LACK TBLR LACK TBLR 1 PSM POSS" ; WINDOW FOR SLEW KODE IN ; POSITIVE DlRECTIOO NSII lEGS" ; WINDOW FOR SLEW KODE IN ~ SACL I ***fflf~fU*********tf*HffHf***4HfH**IHHfHHHH*Hf+tIHH**ft****** INlTlALlZE PAGE 0 DATA INlTlAllZE HYSTERESIS COUNTER TO SOOOh ~ SYSTE" IS ORIGINALLY INlTlALIZEO AT A PSEUDO 1200 BPS, TX, RX IIlE LINE MOllE, 16 SAI1PLES/BAUD TO ACCCiMDATE THE START-tP CDNDlTlilli IF THE TMS70A2400 ~M COIITROLLER. ~ §' .Q, § ~ ~ ~ ~ ~ ~ ~. li" ~ ~ tv Q '-I SrllRD HfIflH-lH+HHf*****HHHlI**HHf***fH+fHHH-fHHHf+ffHHHHHfttHf .'H*HHHHHfHflHHHHHfHHHfHHHHffHfffHfHflf*fHfftHHt+H-H LAC SACL " *,IHH****ff,**HH****,***H*fHHHlfHH**Htf********UHHHfflHftfHH* LDf'I( lACK SACL lACK SACL LAC< SACL SACL SACL lACK SACL IHUHIH.fH*Ht.*H*********U*f*fHHHftlfIHffHHfHHfHIHffHtHH*H lReNT IlAIN PROGRAM SEQUENCER STATUS 15 SCNT XSCNTR RSCNTR 1 ilIIE THE IlAIN PROGRAM SEQUENCER PROVIDES THE TlMI~ FOR THE IlAIN PROORAIILIltl' AND CAllS THE VARIOOS SUIlROOTlt£S AT THE APl'RtJ'RIATE 111£5. THE MAIN LOOP IS Cll1PLETED ONCE EVERY BAUD INTERVAl OR EIlUIVALENTLY 300 TlI£S/SEC FOR FSK. THE PCM CODEC HAS A FIXEO SAMPLI~ RATE IF 9.6 !(HZ, WHICH MEANS THE FSK I'IODE THE OSP BAUD PERIOD rolRESPilIIDS TO 32 PCM SAltPLES. *H*fHffH**"**HfHfH**fH*"*HfHfHHHHHfHffHffHftHfHHHHHU INlTlALIZE SERIAl. POOT CONTROl REGISTERS LACK DAl TBlR TMPO OOT TIIPO,PAO DA2 TIIPO TBlR WAIT SEQU OUT TMPO, PAl lAC< DA3 TMPO TMPO,PAO TBlR OOT T~T IN ***HfHHH****HHHfHfHIHfHf*"****fftHftfffHHHfHfffHftfHffHfH ffHHHfHHltHfHHHfHHHftlHHUfH****fHttHtlHtfHUtttttt*UUHH lAC< 01£,15 HYST IN lACK AND 8Z TIIPO,PAO 8 OUT IOOT,PAI RIN.PAI DA3 TIIPO TMPO,PAO IN lACK TBlR OUT TMPO WAlT WAlT FOR FR INTERRUPT FlAG IF NOT LOOP HERE IF YES TRANSIIIT AND RECEIVE FRt11 PORT I AND RESET THE INTERRUPT FlAG HtHHHffff*****ff*****HfH+Hf*****4HfHftHnfffHHtHtttffHf****fffff EXECUTE TRANSIIlTTER TASK FOR TlME SlOT AND lI'DATE SAMPLE COONTER, fHfHf****fHHtfUHf.tHtHI'HfHHfHtffHft-tHfflHf+HHtfHI-Hl-tfH**Hf tHftHHflfHUfHfHHHtHlfflHffHflHtHfHffftfHH+HHfHffHI'fHfH* INITIALIZE AOC IlAI~ AND lOCI: INDICATOR. (MOD. 5/29) SUB XSCNTR SCNT BlZ SEQU2 , IF ZERO CALl CCI CALl CCI , CAll CM1AND INTERPRETER LAC **UHfffffffftfHfHffffffffffHU'fUfHfHffHffHffHffHffHffHfHHHff lACK TBlR MAXAlP AlP~ , SET ~ TO ITS MAX POSSIBlE VAUE HfHHfHHUH**HHtffHfHHfffHHHfffffftHfnUtHfDffHI-HflfHfffH INIT1AllZE STATUS WORD TO SET AFE GAIN STAGE ON ~ W fHlfHtHftt'****ffHt***Hf**flHHHffHfflfHHfHttHtftHtfHHfffltHH lACK OIlOh &QUOI fHftHHHtHffHtfHffHfHfHfHHffHfHfHHHUHffHfHftHfHffffffHf EXECUTE THE SAI'I'(£ TAS1(S fHHHfHtffHfl+ftttHtHt*******iHfHftHffffHffHHtfHtfHfHHfH"fHf' f.» ~ LACK I¥ID SfQU2 030. , CI£CI( HHHfIHHHHHfHffHflHHfH*lHf***fHfffHHitHH*ftHffHfHHHtHH FOR ANSWER TM • STATUS **ffHfffHfff*f********HlHf***HffHf***"HHHtHtfHIfHtHttHitHHHH CHECK IF IDLE' IF BITS 4 ~ 5 OF STATUS ARE 0 THEN TX IN IDLE MOOE TRANSIIIT lN1OlU.ATED =) EXECUTE RECEIYER TASK FOR TIrE SlOT I¥ID UPDATE RECEIVER SAll'LE C(WjER. IF RECEIVER IN III ~ RETURN TO WAIT STATE HHHfffH*flf****************"**"**,*****",HHHIIIIItIIIIIIIII14********* • LACK I¥ID BNI LAC SUB BGE1 LAC HffHUHHHIU******lfHf*HUHHIIIIIII'I.lllltHffHfffHlf****HHHHf B1 SEQU20 SUB 9Z SEIlU3 00f,4 , IF 0 =) ANSWER TM , ANSWER TONE =) CALL Ffl( em SEQU22 LACK AND B1 STATUS SEIlU3 , CHECK BITS 1 AND 0 LAC OTFLAG , CHECK FOR DTI1F DIAL I!JIlE DUAl. TOOf , TRANSI1ISSICN SACL B R/I'ISI( STATUS SEQU9 RSCNTR 00f SEQU22 SCNT STWRO,PAS RSCNTR WAIT fHofHfIHHHHHHfHf***HHfMH**fHfflf**fHHf*HHff"*IHllfHf*HfH ~ Ig is" §o .Q, § SElIU3 SfQU3 SEQU4 CALL FSK!X USE ROUTINE 'RSTSK' TO PERFMI! FSK ffMOWLATlON fHfHfH**fH*********HHfIHffH*****fHfHffHffff*******HHHt*****ff*** , FSK OR ANSWER TOOf III DTtIF SfQU9 SEQU4 IN IDLE tIlDE TRANSIIIT A 0 3 AND B1 STATLS DECRS , CI£CI( LACK ADD RSEQTB , , , , TBLR LAC CALA HfffHfHfiHHtHfHH********HHIHHHHHHHIHtf***fHf**ff********** ~ ;:.;: ~ SEQU4 s: SEQUS ZAC SACL XOUT LAC SUB BGEZ LAC XSCNTR SACL •lECRS LAC SUB BGEZ CALL ONE SElIU5 SCNT XSCNTR SElIU6b LAC SEQUb SACL ~ ~ N a 'I FSK Dl'ERATICN , IF SO, JUST DECREl1EHT RX SIII1PLE CWlTER RSCNTR T""I TN'I IN HANDSHAKING IIlDE CALL RTASK SUBROUTINE ONCE PER SAII'LE. ONLY 00f NGIHRIVIAL FUNCTION, RTSKIO, IS ACTUALLY CALLED. RSCNTR 00f SEQUO AGC SCNT RSCNTR , IF I«IT TI£ END IF BAUD, JUST CONTINUE , ELSE 00 AGC ONCE PER BAUD. , RESET BAUD COUNTER WAIT ~. So :: ~ 1} 2! ~ CCI ; 4512 FORIIAT XOUT,4 ~TIF .set LAC SACH W3,15 TIi'5 ; 2S3O FIlRI1AT - LOWER FREQI.ENc"'Y ; 2S14 FORIIAT - LOWER FRElllENCY lALS RXPHS CALL IALS ADDS SINGEN RXPHS RXFRQ RXPHS ; ; ; ; ; ; $ S· SACL :;. tv <::. LAC SACH LT MPV PAC LT I'I'Y (J ..... APAC '1 SACH XOUT,4 .set IALS ADDS SACL $ NONE RET •CONT ~ ~ NODTtIF: · .copy TIIP3 DTMFH ; INCREIIENT TX AIIlLE BY APPROPRIATE 0 OR 1 ; FREQUENCY AND STORE IN TXPHS W2,12 Tt1P2 DI~ FLAG : COI1KAND BITS TO ACeH LSBS OOW THE ACClt'IJLATOR VALUE CORRESPONDS TO TI£ FOLLOWING COIWINIIS AND CORRESPONDING SERVICE SUBROUTINES ACe CO_D SUBROUTINE Fn Dn PROTOCOL SELECT SET OPERATING /tODE PROTO OPER 9n 8n 7n DIAL DTtIF XMIT /tODE RECV IIJDE DTtIF X/tODE RHODE 5n 4h FSK DATA /lODE RESET FSKSET RESET CHECK FIRST IF RECEIVER IS IN DATA /lODE. IN \ltiCH CASE IGNORE ALL fHfHfHHfUfHf"'****ffHHfHffffHfffHttHfHflfHffffffffHHfHfflfun ; INCLUDES CODE FOR DTI'IF CONTROLLER COMMAND INTERPRETER (CCll THE FOLUllI~ CODE READS A COIIIAHD FROM THE TMS70A2400 ON PORT 5 AND INTERPRETS IT ACCORDING TO TI£ RUl£S SPECIFIED IN THE CONTROLLER-DSP INTEIifACE DOCUIENT. THE 320 READS 11£ C!III1AND EVERY lIAUD P£RIOD. THE BAUD RATE IS INlTlAU.Y SET TO bOO, AND THE BAUD CLOCK IS DERIVED FROII TI£ SERI~ PORT FR SIIlIW.. IN --.l ; IF ~T, ; CLEAR DTI'IF cat1ANllS EXCEPT 2Xh, m AND OOh. fHHfffHffHff**HHHfHHHfHfffHfHfHfffHHfHtfHHHHfffHflffHff VI LAC ; CHECK fOO DTI'IF HU*"****fHffHfltff**ffHHffHf*fHfHfffHlHflHfHUfffHfffH+Hfffff TXPHS ·CCIDTM.AOO" DTFUIG ; t!ASK OFF 4 LSBS OF CMIAND Hf**f'HffHHfHf*fffff*******H4fffHff***UHfffffHfH:tHfflffU*****f**f DTI'IFL TXFRG lAC SACL ; READ COItIAND **fHtfIfHff**HfHHH**"f""HHHHHfH*,**H******flfI****HUI******* IN DTI'IF /tODE, HIGH FREQ IS IWIDLED BY BY RXPHS GENERATE HIGH FREQUENCY TONE INCREllENT HIGH FREQUENCY PHASE AtG.£ BY SECOND TII£ FREIllIENCY STORE AWAY T1'I'3,15 TIIP3 WS TXPHS XDATA,PAS OFOn XDATA Tt1P2 O9On W2 DTCONT SACH Oq ~ IN LACK AND SACL LACK SUB Bl • LACK AND SUB SUB IINI fII1I1SI( ; REC, IIJDE t!ASK STATUS 11£,7 ; CHECK IF BITS 7 AND b ARE ONES lI£,b CCll ff*,tHffffffffftH'HHffHfffftHHHft*fHHlHftHfHHHfHftffHftHHH REC. IN OOTA /lODE =) IGNORE C!III!ANDS )2 tHltHffHlffHHtlfHftHlffHHfHfflfffHHfHffHllfHttHlHtHfftffHH fHffHfHfHHHfHHHffHffHHtfffHHfHfHfHHHffHfffffHtHHfHtfH LAC TI'I'2 w SUB BLEZ ~ 00E,2 CCI! fHlHffHfHH'HHfIHfHfHtHHHHHI"'*"*"'*tfHfHHHfHHHIHHfH ; IF ~ lARGER T1W/ >2 EXIT _ ; INTERPRETER. RET IETERIIINE FSK FRElIUENCIES AND SET IIAUD COUNTER. ALSO SET 011£R SlIM.. PROCESSING PARAl£TERS fSI( fHHHIIIIIIIIIIIIIIIH*fff:fHHHHHHHHffffHltHtHHHHf*****"**** • CALL TI£ APPROPRIATE SERVICE SUIlROOTINE (REFER TO ClWTBL TABLE!. PROT02 "**fHffHfflfHHtHHt*,-IHHHfHHHHHHHHffHfItfHlf*HHHHHHff •CCIl LACK ADD TBLR LAC CIII.A TABLE CI1DTBL BASE OF _ T11P2 ADD ~ IFCOIE READ ADDRESSS fROI( TABLE LOAD SUB. ADm. INTO Ace. CALL SERVICE SUIlROUTlNE 1l1P2 1l1P2 ; EXIT _ RET LACK SACL LAC AND INTERPRETER. 31 seNT ; !lAUD COUNTER IS 32 01£,2 IllATA SACL CCITT LAC SACL 0NE.3 FSKFLG IHtfHUfffHff*******HH****I+HHHfI*********************lfHIIf+ffHHH IHtHHIIIIIIIIIIII.lfffHffHfHHllfHfHHfHHHfHHffffUHtHHfHHH _ INTERPRETER SU1IROOTlt£S ~ PROTOCOL SELECT CO/I'IAND ~ S LOOlCAL AND I£NCE IDENTIFIES fHMHffH*********tH*****,*"fHffl*****HfiI**H"HH***Htff**IHHHHH 'ti [ ACCUIIJLATOR NOW COOTAINS THE _ ORIGINAL/ANSWER IIJDES =12 =12 LACK 0Ch ; Ace SACL TRANS ; TRANS OFCh ; ZERO BITS 0 AND 1 SET fSI( RECEIVE FILTER COEFFICIENTS AND SliCER lEAD ZDIE ~ '6 lACK TBI.R ADD TBlR lACK TBLR ~ ~ g' FSKAI AIFSK ONE A2fSK ZONE DZONE ~ :::, ;" ~ >:: ~ ~ • ~ <::> ****fHHHfHfIHU*****HHIHHUfHHH**HHHIHfHHfHHfHfHfH***H A2FSK WlTAINS A2 C(£FFICIENT ACe = ADDRESS (f DEAD ZONE lElJ) ZONE (f WINOOW COMPARATOR FOR FSK DECISIOO SET CffRATlNG MODE HfffHHHUH*fH.HtH*n,*ffH*******IHHHHHHflfHtH... t-.HHHflt***H •OPER NOW CHECK FOR ANAlOG LOOPBACK. IF IT IS IN ANAlOG LOOPBACK ~DE, THEN WE N£ED TO MODIFY THE RECEIVER PARAMETERS TO CONFIGURE RECEIVER IN THE SA/1E BAND AS THE TRANSMInER. '1 , ZERO ANAlOG LOOPBACK ; LOC. DIG. LOOPBACK BITS CHECK OPERATING MODE HffIHIHf**fHHHfHHHffHlfHHH-fHHHafHHH*+HHHH-HHH*HHH lACK AND BZ IW'ISK STATUS PROT05 LACK AND BZ SUB BZ ; STATUS BIT IS 1 FOR ANALOG ; AND ZERO OTHERWISE HHfHHfHHHHH*HHHfHIi-f-flHHfHH************HHfHffHIHfHIHfit CHECK IF ANSWER OR ORIGINATE. IF IN ORIGINATE MOlI£ Tf£ THE RECEIVER MUST ALSO BE COOFlGURED FOR LOW BAND. IN WHICH CASE THE PARAMETERS REQUIRED ME AT ADDRESS TMPl+B IF IN ANSWER ~DE, THE RECEIVER MUST BE PUT IN HIGH BAND AND THE PARAMETERS ME AT ADDRESS TMPl-S.IPLEASE REFER TD THE FSKTBL) (fERI RET ANlB LACK OR SACL RET *******HfHHHfffffHH********H**fflfHf******ffff-HH-fHHHHHHHHH BZ CSt XDATA PROTOb LACK 0 SACL lAC OAFlAG TlfPl ONE,3 PROT07 AND •PROTOb SUB B LACK SACL PROT07 ::j lMMSK STATUS ffffHffHHHHfiHtHHHHfH**fHfHHIIHHHHHfHHf4fH**HHIHIfI"HH LACK .... LACK IHHHfHHfHHf**HHIHUH4HH*"fHHH***fHHfHHHttHHHHHHJ.HH (") ..... RET AND ~. ~. GUARD , LOAD ADDRESS Of Al COUFICIENT fHUHtHfffHIHfffH*HHI'HHHHtflHfffHHHfHHHUHIH**HHHHfiHt s;: s. '" ~ SELECT Gli\RD TONE HHfHtfHfUHH*HH*HHHHfHffH4HfHH+H+HffHflf+HHffHfffl*HH . ~ ~ PROT05 lAC ADD TBLR ADD TBLR OAFlAG TI(f>l 0NE,3 BIFSK ONE GAIN ; CHECK ORIG/It : LACK TBLR B 01h XBlTS F21 TXFRO DCh lDATA llllDE2 F22 TXFRO XIllDE2 , ADDRESS Of 2100 ANS. TONE , IF 0 =) ~ <::> Q '-l : ADD A 1 TO LSI! FOR 1200 BPS OPERATION LACK AND ROD SACL RET NTIMSK STATUS TMP!, TXSH STATUS NEGATION OF TRANSMISSION BITS MASK ZERO THE TX STATUS BITS ADD IX STATUS BITS IN RIGHT POS. *******fHHH****HHH*************Hf***,***I***************-IHifH********** RECEIVER IIlDE SELECT SET THE RECEWER STRTUS BlTS mTS 6 AND ]) OF STATUS REGISTER TO: H*****fHU*Hfl********H********Hfff***H******fHH*********HH********!I- ~ lMODE2 2100 IS RIGHT , OTHERWISE LOAD TlFREQ REG WITH 2225 , ANSWER TONE PHASE INC. s· '" lBITS ONE H****fH*****************H*******Hf**U***************:I!'HHIHfH**f*H**** ; DETERMINE ANS. TONE FREQ. ,,*f"*f*********************fH*******************************HHHH*****H* :i- LAC ADD MASK FOR SPEED BITS SPEED BITS CHECK FOR 10 IF NON-ZERO, JUST CONTINUE +HHHf******lfff-H**UHHfit*****-H*******HH**H**H***************HfH*** ~ ~ STATUS ONE,l llllDE2 SET THE TRANSMITTER MODE BITS IN STATUS REGISTER. ~ O"Q Of"Ch AND SUB BNZ *******************HH'***********HHH******,*******UHHH*************** E' ~ LACK 00 IF RECEIVER IS IDLE 01 FOR CALL PROORESS MONlTORING 10 FOR DATR MODE CHECK FOR REIIlTE DIGlTAI. LooPBACK !lIODEl SUB BNZ ONE,I XMODE2 , SUBTRACT 2 IIlRE FROM TMPI , IF ZERO =) REM. DIG. LOOPBACK fHffHffH******fHH*****HHHHHH***HHf***********ff******H********** •RI10DE *HH******H*******H**************H*********UHfHfl*******HHHH******* ~OLE RDL: (ASSUME THAT THE RECEIVER IS ENABLEDI PLACE RECEIVED OOADBlTS IN XBITS. CHECK FOR 1200 BPS OPERATION. IF SO FORCE A ! INTO LSB OF XBlTS. SET BITS 5 & 4 IN STATUS = 10. PLACE RECEIVED OOAOBITS IN XB1rs RI10DEl LACK AND SACl LACK AND ADD SACl RET 03h XDATA TMPI NRCMSK STATUS TIW! ,RCSIt STRTUS , MASK OFF BITS 2 AND 3 NEG. OF REC. BITS MASK ZERO REC. STATUS BITS ADD REG STATUS IN RIGHT PO$, ..... ~ ~ g s §" ...•• HH.uf .....fHfHfHHffHHHHHt*HHfHfHH-HfH4HHHfHlffH*"*I*1 SfT lI' FSK TRANSIIIT FREQ IICCllIDING TO THE TX DATA ffH-Hff*****f***********"ffHf.****UH+fHIHHfHUfHfHfflffUH..,****H. FSKSfT ~ ~ ~ DATM ~ ~ ~ , CHECK THE TRANSIIlTTED 8IT XDATA DATAO FIADD TXFRQ , IF ZERO, DATA tlJST BE 0 , POINT ACe TO I FREQ , SET TX FREQ TO APPRa'RIATE I FREQ LAC •NOFSK TBLR FOADD TXFRQ , POINT ACe TO 0 FREQ , SfT TX FREQ TO API'ROPRIATE 0 fREQ SUBROOTINE : SINGEN PURPOSE : SINE 006ATlON TASK: GIVEN ~ COSIM: TAllI.E WITH 257 VALUES ANn STAAT ADDRESS COSOFF, AND GIVEN AN ANGLE INDEX IN THE ACCUlUAHIl, DETERltIM: THE 81M: OF THE ANGLE. ENTRY CONDITION: THE ANGLE INDEX /lJST DE IN THE LOWER ACCUI1ULATOO. EIIT CONDITION: THE SINE OF THE ANGLE IS RETlJRIIED IN TEllPOOARY LOCATION T1f'3. DESCRIPTION: THE COSIM: LOOKll' TABLE CONTAINS 257 VALUES WITH, RET RESET AND EQUALIZER ENABLE ROUTINES H************************f****fffffHfftftf**ffHHfffffffff*********"**HH • RESET LACK SACL OUT ·SING£N.AOO" HffHfftHf**f************UHt***,"**********ffffffftIHHH***H****lff**** COSCO] = 1.0 AND COS/256] = -1.0 HftlflflHfHIU*****",Hf***********H"****HHH**fHffHfHHtfHHHlfH ~. :iII> 8 AND RET ~ ~ LAC!( BZ LAC TBLR § ~ • copy FSI( DATA !lODE HENCE ANGLE INDEX 0 ~PS TO ANGLE 0 ANG ANGLE INDEX 256 ~S TO PI. THE SINE VALUE IS G£NERATED BY SUBTRACTING FRett THE ANGLE INDEX THE INDEX COORESPONDING TO PI/2, TAKING THE ABSOLUTE VALUE, ANG HENCE FORIUNG AN ADDRESS INTO THE LOOKlI' TABLE. OSlh STWRO NO OF CYCLES: 17 STWRO,PAS NO OF STACK LEVELS USED: I STAAT THE MIlLE INDEX IS THE LOWER ACCUMULATOR '-I fffUlfffH***HI**"*********U*******fH****H-tHIHtHHf**fHffHfffUffff END CONTROLLER CO!1IIANII INTERPRETER SUBROOTINES ANGLE INDEX HAS S15.0 FORMT. MUST SUBTRACT PII2 VALUE WHICH LAYS AT THE MIDDLE OF THE TABLE AND HAS 8S14.0 FORMT AS VIENED IN 515.0 F(Ill'oAT H****HttlHtHHt**H***ttt****HHfH*H... HtH4f*UHfHHUHltfllffHtH't *H**IfHt-**HitfIHHHfHnHUffffHHHHI"**HHHHffHU**UHiH+Hff" SINGEN SUB ONE,14 SACL lALH TI\'3 TI\'3 SUBTRIlCT INDEX (F PII2 PUT AllAY TEItPORARILY PREPARE FOR ABSruITE VALUE TIIP3 PUT AWAY BEFOOE RIGHT SHIFT TAKE ABSOLUTE VALUE ASS SACH tH**lHIHH*HHHHfHffHHfHittH*HHfHffHtfHt-HHfHUUftftffftHH THE VALUE STORED IN TI'I'3 HAS S15.0 FORI1AT -- ALBEIT A POSITIVE IUl8ER A LEFT SHIFT OF 9 BITS COORESPONDS TO 8524.0 FllRItAT AND SAVING THE HIGH ACCUIUATOO HAS A 8S8.0 FllRItAT tff*Hf*ffffHUHHllfHfftfflftHf**fHflff**HU**ff4HffHfH4HlffUH**t w ~ LAC SACH TIV'3,9 TIV'3 , ISOLATE 8 IISB'S IN HIGH ACe , P\.IT AWAY THE 8 IISB'S T8IPOIlAAILY w ~ RSTSK: THE I£XT THREE INSTRUCTIONS ELI"INATE IWf SIGH EXTENSION BITS THAT "IGHT HAlE PROPAGATEO fIHfH*tHlfHHfHffffH*Hf***HHllflHffffHHHHHHfHHHffHtftH"* lAC ASS TllP3 SIn. TllP3 THE FINIi.. LO(Jj(-\.i' ~ f lAC ~ s g" .Q, § ~ ~ ~ ~ S! ~. ~ ~ ~ ~ IV C a 'I C1lSOFF TIf3 mP3 • HIGH PASS FILTER Tl£ INPUT HUffHHHfHfffH.IJIIIf'IIMIIIJ:llfffHHHIIIIIIIIIIII •• JIII'***HHfHfHf •1UlI': •set LlPK STLSB SI SUB 51, TAU SUB XI, TAU-I X2 X2, TAlI-I SUBH ADD ffHHffHHfHfffHHfHHf***""****HfflfffIfHHffHH+fffHl+HfHffH.f" SACL SACH FSK lEI1OOOl.ATION FILES !KJV LlPK fffHHfHfHIHHfHHHftffH+HtHitHf*fffHHHfHffHHHilHfHf+HHHH SACH ·RSTSKF.AOO" LT INCLUIJES FSK RECEII'ERITiMING RECOIERV ENTRY CONDITION' THE RECEIVED SIM SAllPLE IS IN RM LOCATION RIN. fHfHfHHffitffHHHHHfHHftHHffHHII •• IIIIIIIIIIIIIIIIIIIIHHHHfH 0 TllPI ~ GAIN ALPHA. Tl£ OUTPUT fHfHHHf***HHfHffHIHHHHHf"HHfHtfHHfHfHHffffHHtfHtf-HH IfV TllPI •. ALPHA , ILIlTlPLV BY ~ IQlD PAC PtIRfOSE. RECEIVER PER SMPLE TASK (%00 Hz). STLSB 5T 'XI ILHP LEAVES TIE SAI1PI.£ IN Tlfl. ItULTIPLV IT BY FORMT IS 54.11 REQUIRING sorE 1'IAIIlPULATIONS I1ATE: 5-29-86 TASK: THIS SUBRWTI!£ CONBII£S ~ IIlDUlES TO PERF~ THE SIGIW. PROCESSING FLrlCTIONS THAT ARE REQUIRED ON A PER SMPLE BASIS XI fHfHf*HffHfHHHffHHHHffHfHfHHHfIHHHHfHHfffHHHflfHffH fHHfffHHfff-fHHHfff*fffHf.HfofHfHfHffof'*HHfHHtHfffft-l'ffHHfH SliBR!I'JTII£: RSTSK I XI SACL ZALS ADlJH - , ~ FINAL LOOK-lf ADDRESS , READ SINE I'ALlE INTO TllP3 RET .copy , ARL TII'I,O HfffHfffffHHffHtfff**fHHHHfHHHfHHffHfHHfHfHHf**ffHHHHf ADDRESS Hf*HffHfHHfffHfHfHHHfHH-lHHffHffffHfHfHHHfHfflflfffHfHH TBLR , INPUT 14-BIT sm SAllPLE , ARt. INTO TllPI • USE HIGH PASS FILTER. I!AI00 ...... LACK AND 3 STATUS LAC SAC!. CALL RET Tll'I,O AIlCOUT RXFSK ,copy CCITT.AOO ; PLACE RECEIVE SIGNAl IN AGCOUT ; CALL FSK RECEIVERlTIlllt«l RECOVERY ; tlULTIPLY BY 3.0 SIlCH TtIPO LAC ONE,I3 SUB ONE lIND SAC!. LAC ADD SAC!. CALL RET TtlPO TI1PO TtlPI,I3 TI1PO rocour RXFSK 'FDEII20.AOO' ffHHffHffff*UfffHfHHHHffHUfffffHfH****nff'HHfHfU**tffHffHf DEIIOIIll..ATOR SECTIIlM THIS DESIGN III'LEIEIITS A DELAY OF 51PII/2 AGe FSI( HtfIHHHUHHHflHfU****HHtHHHHfHfHf"*ffftHHfUtHHffHHfH ; ASSUI'E V.21 ; IILUIPLY BY 2,5 TllPO TIII'I TtlPO,I3 ... copy ****lHfHffHHHHftf***HHfUfHH*ftHHHftHHfffHfHHtffHffIfHHH TtlPI,I Til'l TIII'2 V210RG 018. LAC AVESIIR IS ZERDED BY THE AGe ROUTINE ONCE PER BAUD. LAC SACL SAC!. CCITT INZ tlPYK PAC SIlCH HfffHHHfHHHfHHHfHfHf*HtHHfHf***Hff**ffffHfHffHfHfffHfHf AVESQR AVESIIR LAC SAC!. C ~ V210RG =AVESIIR + TIII'I·2 TtlPI,I5 TI1PO TrlPO TIIPI 3 STATUS TtlPl 013h tIPYI( IN BOTH Tll'1 AND TIIP2 UPDATE THE SIGIW. POWER ESTIIlATE A'IESQR LAC SACH LT IIPV PAC AODH SACH IJ'ERATION LACK AND LT fHfHHfH4HHHHfHffUU**HHffHHHHHflHtHHfHlfffffHHfHfffHf AVESIlR FSI( HtfHHHtfHifHtfHffHltHfHHfiffHfftHHHfHHHfHHtfHHHHflHH IEIIODlI.ATOR IEl10RY CONFIGtilATION' ICONSECUTIVE ADDRESSES I AIlCOUT PDELO PDELI PDEL2 LPDI:lO LPDELI lPDEL2 HtftHfHffffHff**tHftHfHH"*"*fHHfHHfHHHffHHtffHffHffHffff RXFSK 50VII ; SET OVERFLOW ItJIE fHftHfHffHfHtHHf-ttHoitHHIflfHHfffff+HfHfHHHfffHHHfHtHHt* HfftH.ff*********ltHHHHHHHffH,***HI*"HfHHfftIHHfHfHHHHH TAKE PROOOCT FlNl pROJlltT IIEI«lII SCHEIIE. ASSUIIE ANSWER ItJIE 12 SAllPLESI ~ ~ ff**IHHHff..IHH*HUf-HHHHHHfH*H******HIHUHfHfHtfffff*tfHHH AGCIJUT PDELl d MPY ; LOAD T WITH AGC STAGE DUTPliT ; TA!(E PRODUCT WITH DELAY LINE OUTPUT GENERATE THE EXACT [£lAY REQUIRED FOR RECEIVER. H***HIHfHf*,*******************HifHHHit*******************fHHi********* LAC Ll If'y APAC BY H******fHHHHI-********U******H**********HHfHIH**fHfHH*H****"***** ORIGINATE/ANSWER FLAG IN THE HIGH BAND =0 WHEN ]X ORIGINATES THE CALL HENCE RX RECEIVES H*****HHf*****H*************************i**********H**H*HHfHH***+HI r~Y ilAFLAG ANSWER PDElI PAC SACH PROD,] LAC BNZ ANSWER CHECK FOR HIGH BAND/LOW BAND L~ BAND, DONE. HIGH BAND, USE OOE LESS SAMPLE [RAY ACCUMULATE THE PRODliCT OUTPUT STORE IN PROD 11,15) H***HfH*************************HHH*H*HH*********H******HHH****** .... ,g [ g is' ~. .Q, ;::, ;:: ~ *********H"U**I***HIH**IHHI*******HH***,*******HH14***HHH******H ONE ZERO FILTER TO MCI'-l~ PHASE SHIFT OF FLAT DELAY LINE TO BE PII2 IN PRODUCT FSi! DEf1ODUlATDR: ~ ~ ~ ~ t2 ~ c a 'I GAIN 103' 0.57731 1.0 NCVRFL ,.21 : ~. So IB11 OVRFLW 1170 HZ 0.07175 2125 HZ 0.31678 GAIN V2n 1080 HZ 0.32796 1750 HZ 0.68B89 0.6'1753 1.0 lAC LT MPY ADD LTA MPY lTA MPY Al'AC SACH LPDELO,I LAC AGD ADD BY B lPDELO,14 LPDELl,15 LPDEl2,14 OVRFlW NOVRFL H****** ..******************H***4**H .....H***n****14H",,,H*******.. H* ....* DIIOV POEll , START SHIFTING DATA IN [RAY LINE *****HHltHH**HH*****H*HfHH********HHHH**HHHH******.H*HHU* ; STORE AT NEXT STAGE OF DELAY FILTER , SHIFT SAIIPLE IN FIlTER PROD GAIN LPDEl1,I5 lPDEl1 A1FSi! 2ND ORDER DIRECT FORM LP FILTER 500 HZ. 0.25 DB RIPf'lE COEFFICIENTS: At = 1.392 = 1.0 + 0.392 A2 = -.562 BO =1 81 = 2 B2 = I GAIN = 1 HIGH BAND GAIN =0.5 LOW BANn lPDEL2 A2FSK : Bl • LPDEl1 ; B2 it LPr£L2 , CHECK FOR OVERFL~ .SE't ZAC SACL SACl ,set SACH OUT IIf10V OMDV START UPDATING THE DELAY LINE PDElI,1 AGCDlIT ************Hfl****HH*******H***Hf****fUH*'****Hfi*"********14HH**HH, PRO[ocT = AwI"T , OUTPUT OF DELAY LINE PRODliCT IS LOWf'ASS FILTERED AND IT'S SIGN INDICATES 0 OR 1 DATA ••• BELL 103: RSFLAG PREPARE TO LOW PASS FIllER THE PRODUCT. AOCQuT---)l 1 ZERO FIR FILTER l--): Z.f*-1 l--): Z**-l l---) FOR LOW bind COEFFICIENTS FOR ZERO: • set SACH DI!OV PREPARE FOR FIR ACCUMULATION STATE OF ONE ZERO FIR FILTER MUll BY COEFFICIENT OUTPUT OF ONE ZERO FIR FILTER RESET OVERFL~ FLAG tf****H***f,*******Hff********HUHH*********Hfl***********************ff : --------------) FOR HWH BAND PROIJUCT DEMOD DELAY LINE ;;>::: ~ RSFLAG AI'=T,15 PDELD BIFSK , CLEAR DELAY 1I NE lPDEl1 LPDEL2 $ ll'FOUT,1 LPFOIJT,PA6 ll'DELl lPDELO ; STORE FILTERED ...... .§ ~ ~ fHt"HffliHHHfHHtIHfHltfHHt-IHHHHIIHHHHHtHlHHttHHHHf *HfftfftHfHHHH*,*,***HHHHHflHHHffHHfHHffHlflHtiIHHHfHfH ~ ~. .Q, § ~ >:: ~ ~ s·~ O () >-.. '-l HlfHHfH********fHH***HfHHU.... UHf*fH-H*fff+HffHHHHftIfHf-HfU LACK SACL LT MPYK PAC SACL 2 ll1PO CI£ 1320 TMPI AIlC! , WINDOW -) IMP! SUBTRACT REFERENCE FROM BAUD ENERGY TO GET ERROR. TIE BAUD ENERGY IS IN S!O.S FoortAT. TIE AGe MAINTAINS THAT LEVEL AT 2.86>16 = 46.7 IH'SBb IN S!0.51. TIE AIlCREF IS THEREFORE H'SBb , IT IS 2400 •AIlC! CONTI LAC BGEZ LAC SUB LT MPYK SPAC AVESlIR CONTI ONE,!S , FOR I£GATIVE ENEROY SET TO I'il! POSITIVE , ENERGY LEVEL - FORCED SLEW NODE {)(E ONE AIlCREF , AGCREF =H'SBb : AVESQR - AIlCREF -) ACe HHH+fHfHtH***fH*************ffHIH******fff************************fH COMPARE THE ERROR TO WINDOW ITMPli. , CHECK FOR AFE SWITCHING ;:, ?l>.; TMP! ftHHfHHfHH*************H************"********HHHfffH************" THIS AGe WAS REDESIGNED TO INCORPORATE THE FREEZE OF EIlIJALIZATI{)( 5/2'1187 W 950 t{)W AGC.ASM ~ , IT IS !200 , WEIGHTINl FACTm -) TI1PO fHfHHfHfHfHHf*********HHfHf**********fHfHHfffHHffH*HfHHff** UfUHfffffHfHffH*H+HfitHlIHfH*****HH+**UiHUfHHUH"HI******lff 'ti TI1PO CI£ IF ERROR ) WINDOW =) ERROR - WINDOW -) ERROR IF -WINDOW ( ERROR :: ~ ARI.O ARI. TII'3 SUB BLEZ IlfHHflHffffHHHHfIHIHHfHHHHHfIHIHHHHHfl-HHHfHHffHH4 ~ ~ ERROR ( WINDOW =) ClEeK IF ERROR ) -WINmI. IN IfliCH CASE, ZERO THE ERROR. FIRST, ZERO THE ERROR (I.E. ASSI.I£ ERROR ) -WINmI) ANDlIlDIFY IF WRONG 1\SSUIIPTIDN. IS Ll'1'ERBOlIIIDED TO 35.73 IN S7.S tfHHHfHlHffHffHfffHtIHH11111111l111111ftffHf111111111111111111111H AOC4 LACK TIIl.R ZAlH IT If'V ItAXAlP TItPO AlFHA , ERROR -) T TlV'3 rt.PHA , AlPHA $PAC SACH (l - O. 5 ItAX AlPHA LAC AND I.H ~ HHHHHHHfHHHHIII.IIIIIIllllllfHHHHfHftHHHfHHHHHfHHHf 8Z SUIH BLEl TlI'O AGC5 LAC TlI'O AlPHA SACI. LACK TBLR LAC HlHHHHHfHHHHHHHf**lfHfHfffHffHHfHHHfIHHHHffHlfHHH SUB ILl (1£,6 STIIRD EDTO! IF ZERO =) ENERGY IS MIT ocrECTED =) CIECK IF LE' ~ ~ Q '-l TlI'O TltPO SUB ALPWl BLZ EDT3 fIHIHHHHHfltHHfHHHHHHfffffHIHHHHHH4H********HHfHffHf IS AFE GAIN 00 ? ~ s §" ..Q., THRES3 TBLR LAC ElERGY OCIECT LOOP ~ LACK LACK TBLR HVSINC TItP5 HfftHHHtfHfHfHHffHl+HfHHHfHIllIllllIllIllllHHHfHHHfHffHf • fHIIHIIIIIIIIIIIIIIIIII.IHHHfHfHHffHHfHffHffHfHHfHfHfHfHHf • LACK AND B1 OBOh STWRD EDT3 , IF GAIN IS OFF, EXIT CHECK IF AFE GAIN IS 00 III OFF fHffHHHHfHfHHHHHtHHHlHHHffHHtHfHfffHflfHlHfHfffHHH •EDT BYPASS AFE GAIN LACK AND 8Z OBOh STIIRD EDT! HHHHHHHHHHfiHttHitHHHHHfHHffHffIHHHHffHfIII.IIIIIII.1111 • HHffHHHHffHflllllllllllllllUIHfHHfHllllllllllllIIHfHHHHffHHf AFE GAIN IS 00, CIECK IF ENERGY OCIECT IS 00 (STIIRIII61 =11 LACK AND LACK 07Fh STWRD STNRO 04h SACI. 00 SACI. RET ..... H**************fH*"U**ltfHHfff**H**fHHHIHlffHHfHH-fHHffttffHf .§ f~ s g' l:> •EDT2 BY ZALH SUBH SACH EDi21 ~ ~ IN CASE OF OV£RFLOW, DECUIRE LOSS OF ENERGY DETECT EnT02 EDT02 LACK OBFn STNRD STNRD ~ EDT04 LAC 0NE,6 SHIRD STWRD , IN CASE OF OV£RFLOW, SET ENERGY fHH*Hf**********HHHH*,fffHHf***HfHHfHH*HHHfflHf*iHfHtfHff IF ArE GAIN STAGE IS BYPASSED, CHECK LEVEL IlF ALPHA fHHHHffHH********HHHHiHIH**HfHHHfHHfHHHIHHHflHIHHff •EDT! LACK TBLR LAC THRESS TMPO TI1PO SOB ALPHA BGZ EDT3 *,*f******HHHHfHHHHf**H****HHHfHHH**HHHHHHffflHft4ffffH FOLLOWING LINES ME EXECUTED IF ArE GAIN IS HIGH, BUT t() ENERGY DETECT. < 21.28 (I.E., RECEIVE LEVEL )-43.5 DBMl AND INCREMENT HYSTERESIS COOIITER IF IT IS. OTHERWISE, EXIT, IF ALPHA) THRESS (20.09 IN S7.Sl TIEN TURN ArE GAIN STATUS I«IRD BIT ON. fHfHHHffotHffot****,****fHHffff*f***fHf******H******fHHff**HfH***ff ********. . . .ffHH.fHHU**HH*ff*nHfHf**+Hff**fffHfHHHfHff.Hf*"f •EDTOI LAf..K TBLR THRES2 TIIPO TI1PO , 21.28 IN S7.8 ALPHA EDT3 EDn f*ffHfHffHtnffH***f*HHHfHUHfffHffffHHf**ff**fHHHfHfHfHf**f ALPHA ( 21.28 =) INCREI'fNT HYSTERESIS ClJJNTER HHH*ffHfHflfff+fffUfHf*f**HHHfHffH4ffHfHHfH*****fffHffHffHf EDTOll ~ BY RET OR SACL RET Cl£CK IF ALPHA LAC SUB BlZ ~ EDT04 HHH***HftHHHftHHHHfftfUHtHfHHfffff*****HHtffIlHHHHHIUt ~ 'I BY REi SACL RET ~ B CLEAR OV£RFLOW BIT HYSTERESIS COltITER TI1P5 = 1927 =32708/15 Hf*****HHH4HUU****H4H....,**n*fUHHHH4H4HHHfHfHH*fHHHIHf ~. So ~ EDT21 HYST TI1PS HYST =1. HIHlHlfHflfffHIHftHHHH***HHflfftffUHHffftHfHfHHllffHfftfU H**********ft*****IHf*HfHHf+fH**HH4HitfHffHfffHHHfHHHltHfflH ~ >;; ~ DETECT BIT STNRD[bl IHffffl**IHU**H**H****fflfHfHfHHfffHHH4HffHHHHtHfHHHfHH .Q, ;:s HfftHfflffHff***f**H**************ffHHHI**Hlf****f.lHlftffH********** ilECREI1£NT HYSTERESIS CIJJNTER BY ZALH ADDH SACH EDTOII HYST TMP5 HYST , CLEAR OVERfLOW BIT , TI1I'5 CONTAINS INC. )fOF UICK OR SACL UICK SACL RET OOOh STNRD STNRD 014n GN HHf**ff*f+fHnlfff**********fffff****f**ffHfH+ffHffUffffHHHH**Hff* ROUTINE FOR SIIITCHINl THE AFE ilII/OFF f******H****H*tffHfftffff**ff*****fffffHfffHHfHf**fftffHH**fHfHfHf w 00 00 1111111.llllllllllllllfffffHlHHHHHHffflHffHHHfHHHlHHHHfHHf ZERO BAIJD ENERGY REGISTER HHfHHHflHfHfHHHHHHIHHfHfHHHHffHHfHfHHHHHH'IHHHf •SWITCH Zf(; SACL LACK AND BZ AVESQR , HASK OFF _ED BITS 010h ON AFEOFF HHHffHH-HffHHHHtHHHtHHHH***fflfH**tHHf*"*********iHfoHIH CHECK IF TI£ GAIN 5IO.JU) BE ON HHHfHHf**HfffHHfHHHfHfHHHffHHffHHHHHfffHfHfHHfHHff LACK AND SIll BZ :? 'ti W ~ s gO , HASK OFF TIE AFE ON BIT IlE , IECREI1EIIT TI£ COUNTER Sl/TCH1 SACL LACK ON 010h ~ GN GN SACL SWTCH1 § SACL LACK T1II..R GN 1'IflESlo ALPHA SUB ~ BZ GN IlE SliTCH2 SACL GN AFEOFF l} ~ ~ ~ ~ <:;:) Q '-I , RESTCIIE AFE ON BIT RESET TI£ GN VALUE TO ZERO LOAD TI£ NEW ALPHA VALLE RESET ALPHA TO 5.05 Lr(; , IECREII£NT TIE COONTER RET ~ ()Q , LOAD TIE AFE ON BIT RET ;:r;:: s:s· , SAVE GN VALLE RET .Q, ~ OFh ON SliTOO SACL LACK GN TIflES4 , LOAD NEW ALPHA VALLE TaR RET ALPHA , RESET ALPHA TO 8.98 IN 57.8 An All-Digital Automatic Gain Control AI Lovrich Raj Chirayil Digital Signal Processor Products - Semiconductor Group Texas Instruments 389 390 AnAl/-Digital Automatic Gain Control One of the basic structural blocks of a modem receiver is the Automatic Gain Control (AGC). The AGC is an adaptive system that operates over a wide dynamic range while maintaining the output signal at a constant level. This is necessary for the proper operation of the carrier recovery and clock recovery algorithms of the modem receiver. This application report describes an all-digital implementation of an AGC on a TMS320C17 Digital Signal Processor (DSP). The AGC is designed specifically for modem applications. The structure of this application report is as follows: • The first section provides an overview of modem receiver structure and implementation. • Section two discusses the AGC block diagram and the motivation for using an AGC in a modem receiver. • The last section covers the AGC hardware and software implementation aspects on a TMS320C17 DSP. Introduction A modem (MOdulator/DEModulator) is a device that modulates baseband signals at the transmitter and demodulates the received data at the receiver. To achieve full-duplex operation, frequency division multiplexing is employed, in which both modems simultaneously transmit and receive information over a single channel by dividing the telephone bandwidth into separate frequency bands: one for transmit with a carrier frequency of 1200 Hz and one for receive with a carrier frequency of 2400 Hz. A modem receiver consists of several functional blocks, which include answer/originate bandpass filters, AGC, demodulator, adaptive equalizer, clock recovery, carrier recovery, decision block, decoder, and descrambler. In this report, we are concerned with the implementation of a DSP-based AGC for a V.22 bis modem product[1]. One of the basic structural blocks ofa modem receiver is the AGC. The AGC is an adaptive system that operates over a wide dynamic range while maintaining the output signal at a constant level. The AGC is needed because several modules within the receiver use amplitude thresholds to make their decisions. These threshold levels must remain constant over the entire dynamic range of input signals, typically from -9 dbm to -43 dBm[2]. This is achieved through use of a software AGC, which multiplies the input signal with a gain factor, depending on the actual received signal level. Modem Transmitter The CCITT V.22 bis standard is a 2400-bps modem that uses Quadrature Amplitude Modulation (QAM) technique to transmit and receive data through the communications channel. This section presents an overview of QAM systems and the equations governing their operations. In Quadrature Amplitude Modulation, the information is encoded as phase changes of the transmitted carrier and amplitude variations. With R denoting the amplitude and 4> the phase change, the transmitted signal s(n) is mathematically represented as s (n) = R cos (we + An All-Digital Automatic Gain Control ifJ ) (1) 391 where we is the carrier frequency. Simplifying (1) and substituting In = R cos( <1» and On = -R sine ) into it results in (2); this is used to describe OAM modulation systems. s (n) = In cos (w n) + Qn sin (wn) (2) Transmission of a baseband sequence {In,On} is called quadrature transmission, with two carriers in phase quadrature to one another (cos wet and sin wet) transmitted simultaneously over the same communications channel. Figure 1 shows a two-dimensional diagram of the signals of form (2) with the horizontal axis corresponding to the in-phase signal (In) and the vertical axis representing the quadrature signal (On)' These signal points are referred to as a 16-symbol OAM-signal constellation. Each value of the {In' On} corresponds to one signaling element transmitted. The number of signaling elements per second is referred to as the baud rate. The baud rate is set by the CCITT V.22 bis recommendation to 600. By encoding four incoming bits (quadbits) in a single baud, transmission of 2400 bps is accomplished. The encoding of the incoming data stream dsCn) into values of the sequence {In,On} is accomplished by the encoder. The encoder maps the first two bits of a quadbit as a phase quadrant change relative to the quadrant occupied by the preceding signal element. The last two bits of the quad bit define one of four signaling elements associated with the new quadrant[3]. 392 An All-Digital Automatic Gain Control Figure 1. V.22 bis Signal Constellation Q PHASE QUADRANT 2 • • 11 01 010 00 -3 -1 • • 30 10 • • 01 00 • o 11 PHASE QUADRANT 1 10 PHASE QUADRANT 3 00 • 11 • 01 3 -1 • 0 00 10 -3 • 01 • 11 PHASE QUADRANT 4 The AGe Algorithm The AGe circuit is a closed-loop regulating system that maintains the output level of an amplifier at a constant level, even though the input signal may vary substantially. The AGe modeling and design techniques based on linear system design have been studied in detail[ 4]. The global stability of AGe loops assures the designer that the overall loop will stay stable under considerable weaker conditions if the proper design rules are followed[5]. Figure 2 is a block diagram of the modem automatic gain control. The AGe algorithm is partitioned into tasks performed once per sampling interval, and tasks performed once per baud interval. The sampling rate for the overall system is the designer's choice as long as it satisfies the Nyquist's criterion. A widely used sampling rate for the communications channel is 8 kHz. In the system in Figure 2, the sampling rate is chosen to be an integer multiple of the baud rate. Therefore, a sampling rate of 9.6 kHz is selected. This value is divisible by the master crystal frequency of 18.432 MHz. An All-Digital Automatic Gain Control 393 Figure 2. Modem AGe Block Diagram CONSTANT (RMS) SIGNAL FOR FURTHER SIGNAL PROCESSING FROMCODEC BAUD ENERGY DETECTOR 9600 Hz 600Hz EXPONENTIAL .. INTEGRATOR -AGC REFERENCE ERROR WINDOWING AND WEIGHTING TRACKING MODE r - - _.......- - : - - - - , CARRIER STAGE DETECT LOGIC SLEW MODE AGCSTATE DETECTOR EQUALIZATION CARRIER PRESENT AFE GAIN SELECT FREEZE Baud Energy Detector In Figure 2, every incoming linearized PCM sample is multiplied by the AGC gain factor. The result is available to the modem reciever for further signal processing. It is also used to update the baud energy detector. The energy of a baud interval is computed according to E = L (3) Xn 2 where xn represents the incoming samples. The accumulated baud energy is then compared against a reference level, which depends on the modulation scheme. This comparison is necessary to compute the AGC loop error signal. It is this error that the AGC is trying to minimize. The QAM transmitted signal shown in (2) can be rewritten, taking waveform shaping into account as follows s (t) 394 =L In g(t-n1) cos We t+ L Qn g(t-n1) sin We t (4) An All-Digital Automatic Gain Control where we get) T In,Qn =2Jt fe> where fc =carrier frequency =shaping waveform =sampling interval =data symbols AGe Reference Energy The signal energy for a particular constellation point (In,Qn) is given by (see Appendix A) (5) The energy reference level is chosen to be (6) Ere! = E ( En) where E{ } denotes the expectation operation. The Y.22 bis modem standard requires the transmitter to scramble the incoming digital sequence from the DTE and descramble the decoded data in the receiver[2,3]. The use of scrambler in the modem transmitter effectively randomizes the data and avoids data-dependent patterns in the transmitted sequence. This allows the constellation point sequences to be modeled as a random sequence, with each point having an equal probability of occurrence of E{(In,Qn)} = lIN. Therefore, (6) can be written as N Ere! = I (7) l/N ( En ) n~l Figure 3 shows a portion of the signal constellation diagram of a V.22 bis modem. Applying (7) to all 16 constellation points results in Ere! = 1/16[4 [ ( 12 + 32 ) + 1/2 ( 12 + 12 ) + 1/2 = 1/16 4 [ ( 10 ) + ( 1 ) + ( 9 ) ] ) = 5 An All-Digital Automatic Gain Control W + 32 ) ]) (8) 395 Figure 3. Signal Energy Constellation Diagram Q --... ......... , __ .. ~,3) AGe REF " " " " . (3,3) " '\ \ \ \ \ \ \ (3,1) \ ~ \ \ \ 5 9 (ENERGY) In Figure 3, constellation points (3,3) and (1,1) with respective energy contents of 9 and 1 outside the reference level of 5. A window function is then necessary so that the AGC does not treat these energy variations around the nominal energy as distortions induced by the communication channel. ~"lie Therefore, the AGC should apply corrections when the incoming signal level is outside the interval (1,9)(see Figure 3). Such implementation, however, neglects the effects of intersymbol interference (lSI). lSI arises in systems whenever pulses are transmitted in a band-limited channel. In such channels, pulses tend not to die out immediately, and the tail from one pulse interferes with the next pulse. lSI-related effects are more easily shown when constant amplitude modulation techniques, such as DPSK, are considered. In a DPSK modem receiver, the received signal exhibits gain variations, that are entirely due to lSI. Since the modem equalizer compensates for lSI, the AGe should not act upon lSI-related signal-level variations, because this would introduce noise into the modem receiver and degrade the overall performance. The received signal ret) at the input of the receiver is the convolution of the channel impulse response h(t) with the transmitted symbols Xj in r ( t ) = I Xj h ( t - jT ) + !-let) (9) where !let) is the additive white Gaussian noise. For the effects oflSI to be seen, the received signal must be sampled at the instant to+kT with to incorporating the sampler phase and delay effects. r ( to + kT) 396 = Xkh ( to ) + I xjh ( to + kT - jT ) +!-l ( to + kt ) (10) An All-Digital A utomatic Gain Control The first term of the right-hand side of (10) is the desired signal and is used to determine the transmitted symbol, while the middle term is lSI, which arises from the neighboring symbols [6]. With xk, a constant amplitude sequence, the middle term in (10) results in received signal amplitude variations. Thus, the AGC design must incorporate an energy window around the energy reference level as defined by xk's. DSP Implementation Hardware This section describes the hardware requirements of the modem. The modem hardware consists of the following functional blocks: 1) Host Interface 2) DSP 3) Controller 4) Controller-DSP Interface 5) Analog Front-End 6) Telephone Line Interface For the purpose of understanding the operation of the Automatic Gain Control (AGC), the discussion is limited to only the analog front end. Modem Analog Front End The function of the analog front end (AFE) in the modem is to convert the analog signals received on the telephone line to digital data that can be processed by a digital signal processing device, in this case the TMS320C17. Depending on the modem standard that is implemented, the modem AFE could further assist the DSP by preventing as many of the unwanted signals as possible from being received by the DSP. This reduces the signal conditioning and preprocessing required by the DSP, which, in turn, reduces the computational requirement. In the implementation described here, the modem AFE performs the bandpass filtering, a single-step gain stage, and the ND- D/A conversions. Although the modem hardware also includes the two-to-four wire conversion and the proper telephone line interface and impedance matching, it will not be considered in this discussion. Split-band Filtering In Frequency Division Multiplexing (FDM) modems, the originating and answering stations use different carrier frequencies to transmit data[2]. For Y.22 bis modems, the originating modem transmits data using a 1200-Hz carrier and receives signals from the remote modem at 2400 Hz. Since these signals are carried over the two-wire Public Switched Telephone Network (PSTN) for a full duplex communication, both signals are present in the telephone line simultaneously. For a modem to prevent its transmitted signal from interfering with its received signal, it must eliminate its own transmit signal at its receiver. Since the two modems use separate carrier frequencies to An All-Digital Automatic Gain Control 397 transmit, this task becomes relatively easy. It is done by bandpass filtering the received signal with the passband filter being centered at the transmit carrier frequency of the remote,modem. This implementation uses a commercially available modem filter that has special modes to allow call-progress signal monitoring. This filter must provide adequate adjacent channel rejection while maintaining linear phase. The filter must operate over the entire dynamic range required by the modem, typically from 0 dBm to -43 dBm. For better Signal-to-Noise Ratio (SNR) and linear phase, it is desirable not to operate the filter and the Analog-to-Digital converter at very low signal levels. If signals are weak, an external gain stage (turned on/off under software control) in the receive signal path easily accomplishes this goal. Hardware Gain Control The hardware gain switch is implemented by changing the gain in the analog input buffer to the filter. When the average signal energy falls below -28 dBm, the DSP sets a status line to the modem controller. The controller, in turn, switches on a different resistor in the feedback circuit of the op-amp, increasing the gain by 12 dB. This switching is normally done only once during call initialization. However, if the connection starts with low-level signals and later the signals become stronger due to change in line impedance, the DSP resets this status line to the controller. The modem controller then turns off the external gain stage. When the modem received signal is actually at the threshold level, it is possible that the external gain could frequently be turned on and off by slight changes in signal level. To prevent this, a 4-dB hysteresis has been established between external gain On and Off. This means the external gain will be turned On when the average signal level is less than -24 dBm and will be turned Off when the level is more than -28 dBm. Figure 4 shows the AFE schematic of the modem. Rx level LINE (dBm) AFE GAIN (dB) CO DEC (dBin) -12 -24 -25 0 0 12 12 -9 -21 -10 -43 . 398 -28 An All-Digital Automatic Gain Control Figure 4. Modem AFE Schematic B i -------;----- ~l- -;6dBGAiN: c 1 1 1 1 1 1 L ___ L ____ ~ L-~~ ~~N______ ~ ~----------~ TOUT :- - -",.-")----+...L.U'--__...J- - ~3~~5dB GA~:k~-l U~ 1 1 1 - R U~ 1 '::" 1 1 1 • L ______________________ 11 SPLIT BAND FILTER Codec Interface The TMS320A2400A features hardware companding logic to interface directly to a IJ.-Iaw codec[ 1]. The SCLK output provides the master clock frequency for the codec, and the FR provides the transmit and receive framing signal to the codec. Since the modem algorithm uses a 9.6-kHz sampling frequency, the codec must complete one ND,D/A conversion at this rate. The DSP serial port control register was programmed to provide an SCLK which is generated by dividing the DSP's input clock by ten. Thus, using an 18.432-MHz crystal as the DSP's clock input, a 1.8432-MHz SCLK was generated. The TCM29C19 uses an internal divide ratio of 192 to generate the 9.6-kHz sampling rate. Software The previous section provided a brief overview of the hardware design issues associated with the AGC for a V.22 bis modem. DSP implementation issues are the focus throughout the rest of this report. All values are represented in decimal format unless otherwise noted. Data values in a digital system are not integers, but they must be manipulated as such on an integer processor. Appendix B provides an overview of fractional number representation on a two's-complement fixed-point device. An All-Digital Automatic Gain Control 399 We choose to represent the signal within the AGe loop in S4.11 format. Recall that the {In,On} sequence can assume any value from the sequence {±1, ±3}. This means thatthe sequence is bound in the ±3 range. We use three bits to represent the values in the given range, while the rest of the 12 bits can be treated as the fractional part that accommodates noise. Allocating an extra bit to the {In,Qn} sequence fully represents the RMS signal and allows for some gain hit. For QAM signals, experimentation has shown that the ratio of peak signal to RMS signal is approximately 3 to 1. The maximum peak signal that can be represented using S4.11 notation is 16 (see Appendix B); therefore, 16 represents the peak value a QAM signal can attain using this notation. The RMS max is hence 5.33, which corresponds to approximately 14.5 dB (20 log 5.33). We design the system to work with a la-dB gain hit. It follows that the AGe should maintain the signal level at approximately 4.5 dB or 1.69 RMS level. The constant level of 1.69 RMS represented in S4.11 format is 3461.12. The AGe loop maintains an average squared level of2.86, or (1.69)2, per sample. Therefore, to determine the average baud energy, the sample energy must be multiplied by 16. The resultant value (45.8) is represented in SlO.5 format (corresponding to 1466 (05BAh) in S 15.0 format), the actual value used in the implementation (see Appendix E for the code listing). As shown in the previous section, the reference energy for a V.22 bis modem is 5. This corresponds to the energy level of the constellation points (1,3) and (3,1), shown in Figure 3. Hence it is possible to map the average baud energy of 5 into 45.8. Extending the mapping to the other energy levels results in the following: Average Baud Energy 1 5 9 maps into maps into maps into S10.5 Format S15.0 Format 9.16 45.8 82.4 292 1466 2632 Error Windowing and Weighting In the previous section, the need was established for an energy window around the nominal baud energy level to compensate for the effects of intersymbol interference. The AGe is not designed to, and should not be expected to, compensate for lSI. The equalizer in the modem receiver is designed for this purpose [6]. Experimental window values of 1320 and 950 were chosen for QAM and DPSK modes of operation, respectively. The windowed error signal must be weighted appropriately to provide an approximate one-to-one relationship between the positive and negative energy errors. In Figure 3, the disparity between the positive and negative errors can be observed. Assume that the received points are (6,6) and (0.5,0.5). The QAM signal energy can be calculated as (11) Therefore, the energy values of the received points are 36 and 0.25, respectively. When these energy values are represented in SlO.5 (10552 and 73, respectively) and the deviation from the nominal energy level of 1466 is calculated, full scale error values of 9086 and -1393, respectively, are obtained. This indicates a nonlinear relationship between the received constellation points signal energy with respect to the nominal baud energy level. It is important to determine the weighting 400 An All-Digital Automatic Gain Control factor to provide a parity between positive and negative errors while the AGC operates in the steady state or tracking mode. Appendix D provides a Fortran program to determine the best value for the expansion ratio of negative and positive energy values. AGe State Detector The AGC always operates in one of two modes: • Slew - (fast tracking mode) AGC uses a large step size to track the signal. • Tracking - AGC adjusts the signal level by adjusting the gain factor via an exponential integrator loop. It is important to design the AGC to ignore relatively small gain changes on the telephone line. Otherwise, the AGC loop responds to the smallest variation in the signal level by switching to the slew mode. In this application, the AGC is designed to simply track the incoming signal when the received signal level varies by not more than ± 6 dB from the window values. These levels are calculated as follows: 1010g(x/2632) = + 6 dB 10 log(x/292) = - 6 dB - (12) x = 10478 x = (13) 73 As long as the incoming signal stays within these boundaries, the AGC simply adjusts the gain factor; otherwise, it will switch to the slew mode. Once the AGC determines that the error signal is within the tracking mode boundary, it switches back to the slow tracking mode as shown in 5. Figure 5. AGe Operating Modes , SLEW MODE , , ,. , TRACKING MODE , I I I I ,'73 , , '. , , , REF , , , , , , ., ,I , 146 292 , , , I I -3.5 dB ,I , NO ' CORRECTION' TRACKING NO -, CORRECTION" MODE I. .1 WINDOW I. (1320) I I WINDOW I I , , , (1320) ,, , ,'1466 , ,. .',, , I , , , I 263~ , 2786 I , ,I , +6dB , , , , I , SLEW MODE .1 I , , , 10478 , , .,, , , , ENERGY I Appendix C provides a FORTRAN program that determines the best weighting factor for a given QAM signal range. A weighting factor of 2 provided the approximate one-to-one relationAn All-Digital Automatic Gain Control 401 ship. Since DPSK signals do not have amplitude variations, a value of 1 was chosen for the weighting factor when the modem operates in the Y.221Bell 212A mode. An upper and lower boundary for the AGC gain value must be determined. The V.22bis standard[3] requires the modem to operate at a signal level of -43 dBm. Therefore, the AGC is designed to work from the O-dBm signal level to -50 dBm. The DSP2400 contains a DSP-activated 12-dB gain switch. Therefore, our design should really have to cover only the range of 0 dBm to -38 dBm levels. The maximum codec output value is 1FFEh (8190 decimal) because the codec output is converted from 8-bit log value to 13-bit two's-complement value. When this value is saved in a data memory location of the TMS320C17 DSP, the number is sign-extended and is represented in 3S0.13 format. The RMS max is therefore 2730, which corresponds to a signal level of 0 dBm in our system. The minimum acceptable signal level from the codec corresponding to the -38-dBm level is computed as follows: - 38 = RMSmin = 20 log (RMSmin /2730 ) 34.4 (14) Given the maximum and minimum codec output values and the constant RMS output, it follows that umin =1.26 and u max =101 as shown in Figure 6. Figure 6. AGC Gain Value Computation FROM CODEC 1.69 RMS (S4.11) (3S0.13) 1.26 (HIGH INPUT) AGC GAIN VALUE (S7.8) ~ 101 (LOW INPUT) U The gain value requires 7 bits to represent; therefore, the S7.8 format is used to represent the values. Exponential Integrator Loop When the total baud energy stays within the window limits, the AGC is in the tracking mode and simply compensates for the changes in the signal levels by adjusting the gain factor appropriately. The gain factor is computed and updated via an exponential integrator loop. The exponential integrator loop implements the following function: an+l = an X ( 1 - Ke ) (15) where the constant K determines the speed of convergence of the AGC closed loop. In our implementation, K is set to 1/2. This value corresponds to step sizes of ± 6 dB when the AGC is in the 402 An All-Digital Automatic Gain Control slew mode. The error signal is in SO.15 format while an is in S7.8 format with the multiplication result in 2S7.23 format. When the upper half of the accumulator (ACCH) is saved with a left shift, the result is in S7.8 format. A further multiplication by 0.5 is necessary before carrying out the subtraction operation. Note that a divide by 2 is equivalent to a right shift, which cancels out the effect of the previous left shift. Therefore, saving ACCH with no shift accomplishes multiplication by K as shown in Appendix E. The AGC is designed to declare carrier present when signal levels greater than -43 dBm appear at the input of the receiver. The response time for tone detection depends on the AGC design. The AGC uses a constant that is subtracted from a hysteresis counter, and presence of energy is declared when the counter underflows. It takes 9 bauds for the energy to be detected, corresponding to a response time of 15 ms. Conclusion This application report has presented design and implementation techniques for an all-digital automatic gain control. The AGC has been implemented on a TMS320C17 digital signal processor as part of a commercial modem product (DSP2400). The approach of using a programmable processor resulted in minimal hardware configuration with excellent performance. The DSP implementation allows you to fine tune the AGC for your particular modem design, regardless of the modulation technique used. Acknowledgements The author wishes to acknowledge the contribution of Technekron Communications Systems and George Troullinos of Texas Instruments. This report is based on their work. References 1) DSP2400 Modem User's Guide, Texas Instruments, 1987. 2) Troullinos, G., et ai, Theory and Implementation of a Splitband Modem Using the TMS32010 (literature number SPRA013), Texas Instruments, 1986. 3) Recommendation Y.22 bis, "2400 bits per second duplex modem using the frequency division technique standardized for use on the general switched telephone network and on point-to-point 2-wire leased telephone-type circuits," CCITT Redbook, Volume III, 1984. 4) Mercy, D. Y., "A Review of Automatic Gain Control Theory," The Radio and Electronic Engineer, Volume 51, Number 11/12, November/December 1981. 5) Green, D.N., "Global Stability Analysis of Automatic Gain Control Circuits," IEEE Transactions on Systems and Circuits, Volume CAS-30, Number 2, February 1983. 6) Falconer, D.D., "Jointly Adaptive Equalization and Carrier Recovery in Two-Dimensional Digital Communication Systems," Bell System Technical Journal, Volume 55, Number 3, March 1976. 7) Antoniou, A, Digital Filters: Analysis and Design, John Wiley & Sons, 1986. 8) Lovrich, A, et ai, "An All Digital Automatic Gain Control," Proceedings of ICASSP 88, Pages 1734-1737. An All-Digital Automatic Gain Control 403 Appendix A QAM Signal Energy The general form of a QAM signal is written as s ( t ) =R =In ( t ) cos [wet + rp ( t )] (16) cos We t + Qnsinwe t The energy in a signal set) is defined as EQAM = f 00 S2 ( (17) t ) dt _00 Substituting (16) into (17) results in T EQAM = f S2 ( t ) dt 2n f = ~ f 1/2 [ =~ (In 2 COS2 We t + Qn 2 We t + 2In Qn sin We t cos We t) dt o 2n In 2 ( 1 + cos 2w e t ) ] dt + ~ (18) 2n f 1/2 [Qn 22 ( 1- cos 2w e t) ] o 2n + ~ f In Qn sin 2w e t dt o When the three terms in (18) are integrated, the sine and cosine terms drop out since the average energy of sinusoidal signals is zero. Therefore, (18) simplifies to EQAM 404 = 1/2 ( In 2 + Qn 2 ) (19) An All-Digital Automatic Gain Control Appendix B Fractional Number Representation Overview A typical digital communication system is shown in Figure 7. Two blocks (marked as waveform coder and waveform decoder) are of interest. These blocks are collectively referred to as a co dec, especially when both coder and decoder are implemented on a single device. An example is the TCM29C13 PCM codec, which consists of an amplitude quantizer and binary codeword generator. Figure 7. A Typical Communication Channel ANALOG SOURCE ANALOG OUTPUT SAMPLER 1-+----1 RECONSTRUCT 1 + - - - - - 1 The quantized data represent instantaneous values of a continuous-time signal in digital form. On the TMS320C17, these data values are represented in two's-complement arithmetic[7]. The binary representation of a two's-complement value is as follows: 15 A = ao + I a; 2-; (20) i=1 Consider that the incoming samples are coming from a 16-bit linear ADC. The data coming out of the ADC consist of a sign bit at the most significant location, followed by the binary point. This information can be represented in 015 format or, alternately, SO. 15 format. This translates into the following upperbound and lowerbound limits with increments of 2-15 (0.00003051): ( 2 15 -1 ) / 2 15 _ 215 / = 0.99996948 (21) 215 = -1 If two 015 (SO. 15) numbers are multiplied, the result is a number in 030 (SSO.30) format. When the 030 number resides in the 32-bit accumulator ofthe TMS320C17, the binary point folAn AIl-DigitalAutomatic Gain Control 405 lows the second most-significant bit. Assuming that the output of the encoder section is also Q15 format, the Q30 number must be adjusted by left-shifting by one while maintaining the most-significant 16 bits of the result. This is accomplished with a sach y,!. This instruction shifts the Q30 (SSO.30) number to the left by one and, following the shift, stores the upper 16 bits of the accumulator. The y value is in Q15 (SO. 15) format. The S notation is used consistently throughout this application report. The following table should assist you with the conversion between Q notations, S notations, and equivalent decimal representations. Thble 1. S Notation, Q Notation, and Decimal Conversion Information Q Notation 015 014 013 012 011 010 09 08 07 06 05 04 03 02 01 00 406 S Notation SO.15 S1.14 S2.13 S3.12 S4.11 S5.1O S6.9 S7.8 S8.7 S9.6 S1O.5 S11.4 S12.3 S13.2 S14.1 S15.0 Decimal Equivalent -1 -2 -4 -8 -16 -32 -64 -128 -256 -512 -1024 -2048 -4096 -8192 -16384 -32768 Ns 0.9999695 Ns 1.9999390 Ns 3.9998779 Ns 7.9997559 Ns 15.9995117 Ns 31.9990234 Ns 63.9980469 Ns 127.9960938 Ns 255.9921875 Ns 511.9804375 Ns 1023.96875 Ns 2047.9375 Ns 4096.875 Ns 8191.75 Ns 16383.5 Ns 32767 An All-Digital Automatic Gain Control Appendix C The following is a Fortran program listing that creates a table of AGe gain values and its relation to the input signal strength. The table also includes the corresponding peak input signal level and its RMS equivalent. An All-Digital Automatic Gain Control 407 'J£>~" ~ 00 +.:,r dBa ~,:~:,,:r;~:~~s~:~e~:t~:~~ R~;~ ~~~~:~ ~~D~~m sign~; ih~i= l~ - ?eiK 15 ~he ln~;,J'i: [lei.;': slyftal to 'tM rec~lyer a OAr, 5j5te~; SlG-e:. - RM'3 is tne 11,"1'3 slima1 Inout to tl'te receiver, \lihue lit a OA;"! system IS eQual to on tttlrc of the peak va,ue. - AlMa 15 t~e gur, value. c In tillS AGe C£!Slql!, the IfrilX cMec iflD!.lt 15 actual ~y c 8190 t>eak. olDen (l,ti;e IiIrlte U.S} (5:>:, ," for-mat 999 = 'iiblrl.dat~.stit\!S': tjblll~, ;J:.- ;:s ;J:.- b aQ. [ ;J:.- ;:: 0 ~ ~ o· .. Cl S· i'l C ;:s [ 15.x. " ;: ~ ~ -21.8 -21.7 -21.6 -21.5 ~21.4 -21.3 -21.2 -21.1 -21.0 -20.9 -20.8 -20.7 -20.6 -20.5 -20.4 -20.3 -20.2 -20.1 -20.0 -19.9 -19.8 -19.7 -19.6 -19.5 -19.4 -19.3 -19.2 -19.1 -19.0 -18.9 -18.8 -18.7 -18.6 -18.5 -18.4 -18.3 -18.2 -18.1 -18.0 -17.9 -17.8 -17.7 -17.6 -17.5 -17.4 -17.3 -17.2 -17.1 -17.0 -16.9 -16.8 -16.7 -16.6 -16.5 528. mEl 534.9139 541.1079 547.3736 553.7119 560.1236 566.6095 573.1706 579.8076 586.5214 593.3130 bOO. 1833 607.1331 614.1633 621.2750 628.4690 635.7464 643.1080 650.5548 658.0879 665.7082 673.4167 681.2145 689.1026 697.0820 705.1539 713.3192 721.5790 729.9345 738.3867 746.9369 755.5860 764.3352 m.l858 782.1389 791.1956 800.3573 809.6250 819.0000 828.4835 838.0769 847.7814 857.5983 867.5288 877.5743 887.7361 898.0156 908.4141 918.9331 929.5738 940.3378 951.2264 962.2411 973.3833 176.2636 178.3041> 180.3693 182.4579 184.5706 186.7079 188.8698 191.0569 193.2692 195.5071 197.ntO 200.0611 202.3777 204.7211 207.0917 209.4897 211.9155 214.3693 216.8516 219.3626 221.9027 224.4722 227.0715 229.7009 232.3607 235.0513 m.ml 240.5263 243.3115 246.1289 248.9790 251.8620 254.7784 257.7286 260.7130 263.7319 266.7858 269.8750 273.0000 276.1612 279.3590 282.5938 285.8661 289.1763 292.5248 295.9120 299.3385 302.8047 306.3110 309.8579 313.4459 317.0755 320.7470 324.4611 19.64 19.41 19.19 18.97 18.75 18.54 18.33 18.12 17.91 17.70 17.50 17.30 17.10 16.91 16.71 16.52 16.33 16.15 15.96 15.78 15.60 15.42 15.24 15.07 14.90 14.72 14.56 14.39 14.23 14.06 13.90 13.74 13.58 13.43 13.28 13.12 12.97 12.82 12.68 12.53 12.39 12.25 12.11 11.97 11.83 11.70 11.56 11.43 11.30 11.17 11.04 10.92 10.79 10.67 -16.4 -16.3 -16.2 -16.1 -16.0 -15.9 -15.8 -15.7 -15.6 -15.5 -15.4 -15.3 -15.2 -15.1 -15.0 -14.9 -14.8 -14.7 -14.6 -14.5 -14.4 -14.3 -14.2 -14.1 -14.0 -13.9 -13.8 -13.7 -13.6 -13.5 -13.4 -13.3 -13.2 -13.1 -13.0 -12.9 -12.8 -12.7 -12.6 -12.5 -12.4 -12.3 -12.2 -12.1 -12.0 -11.9 -11.8 -11.7 -11.6 -11.5 -11.4 -11.3 -11.2 -11.1 984.6545 996.0563 1007.5901 1019.2574 1031.0599 1042._ 1055.0764 1067.2936 1079.6522 1092.1540 1104.8006 1117.5936 1130.5347 1143.6257 1156.8682 1170.2641 1183.8151 1197.5231 1211.3897 1225.4170 1239.6066 1253.9606 1268.4808 1283.1691 1298.0275 1313.0579 1328.2624 1343.6430 1359.2016 1374.9405 1390.8615 1406.9669 1423.2589 1439.7394 1456.4108 1473.2753 1490.3350 1507.5922 1525.0493 1542.7086 1560.5723 1578.6429 1596.9227 1615.4142 1634.1198 1653.0420 1672.1833 1691.5463 1711.1335 1730.9475 1750.9909 Int. 2664 1791.7767 1812.5245 328.2182 332.0188 335._ 339.7525 343.6866 347.6663 351.6921 355.7645 359.8841 364.0513 368.2669 372.5312 376.8449 381.2G& 385.6227 390.0880 394.6050 399.1744 403.7966 408.4723 413.2022 417.9869 422.8269 427.7230 432.6758 437.6860 442.7541 447.8810 453.0672 458.3135 463.6205 468.9890 474.4196 479.9131 485.4703 491.0918 496.7783 502.5307 508.3498 514.2362 520.1908 526.2143 532.3076 538.4714 544.7066 551.0140 557.3944 563.8488 570.3778 576.9825 583.6636 590.4221 597.2589 604.1748 10.55 lQ.42 10.31 10.19 10.07 9.96 9.84 9.73 9.62 9.51 9.40 9.29 9.18 9.08 8.98 8.87 8.77 8.67 8.57 8.47 8.38 8.28 8.19 8.09 8.00 7.91 7.82 7.73 7.64 7.55 7.47 7.38 7.30 7.21 7.13 7.05 6.97 6.89 6.81 6.73 6.65 6.58 6.50 6.43 6.35 6.28 6.21 6.14 6.07 6.00 5.93 5.86 5.80 5.73 ....0 .j::o. ~ ;:s ~ 6 0Ii· ~. 5: !:: C ~ ....I:> o· ~ S· ~ ~ -11.0 -1G.9 -10.8 -10.7 -10.6 -10.5 -10.4 -10.3 -10.2 -10.1 -10.0 -9.9 -9.8 -9.7 -9.6 -9.5 -9.4 -9.3 -9.2 -9.1 -9.0 -8.9 -8.8 -8.7 -8.6 -8.5 :-8.4 -8.3 -8.2 -8.1 -8.0 -7.9 -7.8 -7.7 -7.6 -7.5 -7.4 -7.3 -7.2 -7.1 -7.0 -6.9 -6.8 -6.7 -6.6 -6.5 -6.4 -6.3 -6.2 -6.1 -5.9 -5.8 -5.7 -5.6 1833.5126 1854.7437 1876.2206 1897.9462 1919.9234 1942.1550 1964.6441 1987.3936 2010._ 2033.6860 2fIfj/.2350 2081.0566 2105.1541 2129.5307 2154.1895 2179.1338 2204.3670 2229.8923 2255.7133 2281.8332 2308.2556 2334.9839 2362.0218 2389.3727 2417.0403 2445.0283 2473.3404 2501.9804 2530.9519 2560.2590 2589.9054 2619.8951 2650.2320 2680.9203 2711.9639 2743.3669 2n5.1336 2807.2681 2839.n48 2872.6578 2905.9216 2939.5706 2973.6092 3008.0420 3042.8735 3078.1083 3113.~11 3149.8067 3186.2797 3260.4977 3298.2525 3336._ 3375.0787 3414.1602 611.1709 618.2479 _ 625.4069 632.6487 639.9745 647.3850 654.8814 662.4645 670.1355 m.8953 685.7450 693.6855 701.7180 709._ 718.0632 726.3779 734.7890 743.2974 751.9044 760.6111 769.4185 m.3280 787.3406 796.4576 805.6801 815.0094 824.4468 833.9935 843.6506 853.4197 863.3018 873.2984 883.4107 893.6401 903.9880 914.4556 925.0445 935.7560 946.5916 957.5526 968.6405 979.8569 991.2031 1002.6807 1014.2912 1026.0361 1037.9170 1049.9356 1062.0932 1086.8326 1099.4175 1112.1482 1125.0262 1138.0534 5.66 5.60 5.53 5.47 5.41 5.35 5.29 5.22 5.16 5.11 5.05 4.99 4.93 4.88 4.82 4.76 4.71 4.66 4.60 4.55 4.50 4.45 4.40 4.35 4.30 4.25 4.20 4.15 4.10 4.06 4.01 3.96 3.92 3.87 3.83 3.78 3.74 3.70 3.66 3.61 3.57 3.53 3.49 3.45 3.41 3.37 3.33 3.30 3.26 3.18 3.15 3.11 3.08 3.04 -5.5 -5.4 -5.3 -5.2 -5.1 -5.0 -4.9 -4.8 -4.7 -4.6 -4.5 -4.4 -4.3 -4.2 . -4.1 -4.0 -3.9 -3.8 -3.7 -3.6 -3.5 -3.4 -3.3 -3.2 -3.1 -3.<) -2.9 -2.8 -2.7 -2.6 -2.5 -2.4 -2.3 -2.2 -2.1 -2.0 -1.9 -1.8 -1.7 -1.6 -1.5 -1.4 -1.3 -1.2 -1.1 -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 ~.6943 3493.6862 3534.1412 3575.0646 3616.4619 _.3386 3700.7002 3743.5523 3786.9005 3830.7508 3875.1088 3919.9804 3965.3717 4011.2885 4057.7370 4104.7234 4152.2539 4200.3347 4248.9723 4298.1731 4347.9436 4398.2904 4449.2202 .4500.7397 4552.8559 4605.5754 4658.9055 4712.8531 4767.4253 4822.6295 4878.4729 4934.9630 4992.1072 5049.9131 5108.3883 5167.5406 5227.3779 5287.9081 5349.1392 5411.0793 5473.7367 5537.1196 5601.2364 5666.0957 5731.7060 5798.0760 5865.2145 5933.1305 6001.8329 6071.3309 6141.6336 6212.7504 6284.6906 6357.41039 1151.2314 1164.5621 1178.0471 1191.6882 12<15.4873 1219.4462 1233.5667 1247.8508 1262.3002 1276.9169 1291.7029·· 1306.6601 1321.7906 1337.0962 1~.5790 1368.2411 1384.0846 1400.1116 1416.3241 1432.7244 1449.3145 1466.0968 1483.0734 1500.2466 1517.6186 1535.1918 1552._ 1570.9510 1589.1418 1607.5432 1626.1576 1644.98n 1664.0357 1683.3044 1702.7961 1722.5135 1742.4593 1762.6360 1783.0464 1803.6931 1824.5789 1845.7065 1867.0788 1888.6986 1910.5687 1932.6920 1955.0715 1977.7102 2000.6110 2023.n70 2047.2112 2070.9168 2094.8969 2119.1546 3.01 2.'1"1 2.94 2.90 2.87 2.84 2.81 2.n 2.74 2.71 2.68 2.65 2.62 2.59 2.56 2.53 2.50 2.47 2.44 2.42 2.39 2.36 2.33 2.31 2.28 2.25 2.23 2.20 2.18 2.15 2.13 2.10 2.08 2.06 2.03 2.01 1.99 1.96 1.94 1.92 1.90 1.88 1.85 1.83 1.81 1.79 l.n 1.~ 1.73 1.71 1.69 1.67 1.65 1.63 ~ ;:, ~ ::::: 6 [ . tiQ. ~ ;:: ~;:, .... r;' G:l S· ;:, () C ;:, [ ~ -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 b431.0799 6505.5483 b580.8790 6657.0819 6734.1673 6812.1453 bB91.0262 6970.B2Ob 7051.5389 7133.1918 7215.79Q3 7299.3452 7383.Bb76 7469.3b8S 7555.BbOO 7b43.352e 7731.85Bb 7821.3893 7911.9567 8003.5729 8096.2499 8190.0000 2143.6933 2168.5161 2193.6263 2219.0273 2244.7224 2270.7151 2297.008"1 2323.6069 2350.5130 2377.73Ob 2405.2634 2433.1150 2461.2892 2489.7B9b 2518.6200 2547.7843 2577.2Bb2 2607.1298 2637.3189 2667.8576 2698.7500 2730.0000 1.61 1.60 1.58 1.56 1.54 1.52 1.51 1.49 1.47 1.46 1.44 1.42 1.41 1.39 1.37 1.36 1.34 1.33 1.31 1.30 1.28 1.27 Appendix D Appendix D provides a Fortran program that calculates an optimal value for the expansion ratio of negative and positive energy values, subject to some constraints (maximum signal levels). The program searches expansion ratios with their corresponding error values up to a maximum value defined by the user. The value that produces the least error is chosen as the optimal value. In this implementation, the tracking mode window is 6 dB for positive errors and at least 3.5 dBs wide for negative errors. The program, however, calculates the expansion window in 6-dB range. Error values are calculated using no-worse windows data. The index value for positive and negative errors correspond to the actual signal level in tenths of dBs. 412 An All-Digital Automatic Gain Control Program to determine the best value for the expansion ratio of negative energy values ind that of positive ones. b double precision oe9lbOl. posnrlbOl, negerrlbO) double precision SigKlbC», MXtrr. linert, bingo double precision totaH4Q01 open U,file = 'nl.dat',status = 'ntlil') QQ' [ ~ ;:: ~ a 1';' negtrr (ki =292.<(1. - (10. H (f1 ••tHI 1100.111 ..rittH,9) k,negerrlk) forlN.t (lx. ~negihve errorl',i2,'1 = ',lx,f20.41 300 c 300 ~ ;:, ~ clear all the total values 100 ~ s· 9 d. 301 k = 22,30,2 neg'" (kl =292.+(1. - (10 ... (fl,.tHI 1100.111 301 c 301 IIIrite<1,91 k,negerrlkl 302 c 302 d.302 k = 40.60,10 neg'" Ikl = 292.+(1. - (10. IIIrite(1,9J k,negerrlkl do 100 n = 1,400 t.t.1 (nl =O. H (fl.ilHI 1100.111 . Assuling that the .apping is actually linear, then tht follolllling criteria is used to deterline the optiltlll value for N. IIIrite(f.1) forMtUx, ~ent.r totaHn) = SigH. (e - e positive dbl level') k read ('.') db.pos ~ [ t n] tk-k IIIIritel f .21 for_tUx. rea.d (I •• ) lIII"iteC.,8} foraatctx, rea.d (••• ) 'enter neg,ltive do dblheg lenter nn RXilUI do 400 n = l,on d. 400 k = 1,60 sigr.a.lkJ = [loser-rlkl - float(nl totallnl = toti.Hnl + sigM(kl level~J value for N/) 400 * negerrlkl Nolil it is tiat to deterline the lIinilul w.lue of the error. dete,..ine positive errol's do 500 n ;; l.nn if ( bing•• It. 0.1 got. 504 if ( totaHnl .Ie. totalln+1)) goto 501 Since the AGe o[lerates in the tracking IIIOdt close to the boundary. 1I0re lIIfight lust be given to these regions. 0.0 to 1.0 dB 1.1 to 2.0 dB bingo = totaHn+U itt = 0+1 g.1o 502 bingo. = total (n) itr = n if ( n+l .gt. nnJ goto 503 continue itl' = n bingo = total (n) g.t.510 it' =n-l bing. =t.to1(0-1I 10 pis 10 pis SOl 2.1 t. 3.0 dB 5 pIs 3.1 t. 4.0 dB 1 pto 4.1 t. 5.0 dB 1 pts 5.1 t. 6.0 dB 1 pts S02 sao S03 c 200 d. 200 i = 1,20 poser, hi =2632. + ( 10. IIIrite U,S) i,poserrU) 201 c 201 do 201 i = 22,30,2 poserr (il = 2632... Ie 10. IiIrite U.5) i.postrrH) 202 c 202 do 201 i = 22,30,2 postrr (il I: 2632. oJ « 10. IlIrittU.S) i.poserrfil 200 H I fl.ot hi 1 100. II - 1. 504 H H ( ( calculate aaxiMl and liniAUII energy levels floatcil 1100.» - 1. float(i) 1100.» - 1. 600 5 601 ......... ~ SiM thing lIIith the negative errors . do 300 k = 1,20 I = 1,1x.f20.4) do 601 k = 1.60 neg(kl = it. + ntgt.. lk) deterlint negative errors Nt do the d. 600 i =1,60 IIIIrite 11.5) i. postrrH) for.tUx. "positive errorC ,i2,'1 6 IIIritt (1.61 k. negtrrek). ntgCk) for.tUx. lnegative errorC',i2.') ;; , • ix. f20. 4, +~ equivalent to". f20.4J ..""... 2632. + « 10. H ( dbllpos 1 10. II - 1.1 "; 414 An All-Digital Automatic Gain Control Appendix E An All-Digital Automatic Gain Control 415 ~ CI\ Av[!~Mn: ~ E no" suottict rtflirenCli' f!'om bau!! ~nf!rgy til get error. the baud entrgy 15 iO 510.5 format. ·the AGe milnh.ins tl'lit level at 2.8bX16 = 46.7 (1'I'5bo H****tHf**UHHH. **-HU*********fUffHHHI**UIHHfHHH*****fft****** In 510.5). tile aqer-ef is tnerefore tr'5llb aGe. ism agel: 1" 8gez ; Hf***fHfff***HHH**HffHfHHfHHf**HHH*fffHH*****fHHHH+HHH 1iC front end ige furll:hO;r.. 51&111 lDoCle It mOYi< agcref tile aver;,qe .sigDal sQuueci is computed by tne lrIiin progtifll_ind stoted in aVisor. IIIIIicl'l is clea.red by this routine after using it. the routir!e uses SDi.C lIIindo~ whose width (jeOfMs on the modulation (1200,2400) lnd it error WtlgbhT!9. lllhich aiso depenos on that rate. we first set those valuisl apc: """' lac gn Mz slllltch cMck if 2 =2400 2~OO . Jack aM sub blez and ; CheCK for aft slIIitcbing c.~ange stnus one,1 ageO laCK sacl It ~ b 00· SO 2 lOY' .ac !320 uc1 tlol agel b if status bits 0 and 1 ; if 2 • GO not II'IOGify t!lpO and taD! It t_pO .ne ~ ooyk 950 oac sacl tool on. ; agcref =Ir'5bb _ ;iveSQr - agcrtf - acc Clllioare tilt erN!' to IiIlndOIll (tIllOlJ. If errQr lIIinoolll = error - IlIlndolll - error If -wiiHl'OIf err:Qr windoll! =0 - error if error -lIIinaolll = tmDO x (error + lIIindolll) - errol' if tile a.verage Di.ud energy is a. tne pn.k DaUI1 energy fer QAM signals is 1.8 a and the RliniRlUII is 0.2 a. the IIIIMOIII is therefore chOsen to be {l.S a in either direction. with agcref = h'Sob the IIIlndow is 1l'492 for (los/{ sigr,als toe variaUons in baud fntrgy are entirely due to isi anl1 distortion and tiler fore the lIIindOIll is Iyet. slaller (h~a). first eliee" if error lIIiMOiIJ suo t.pl sac1 tlD3 °9tZ agc2 ; error - "indo,. - tmp3 trror uindolll = check if error 4IIi04Ob!. in which case zero tbe forror. flrst zero the i!rror H.t. iSSUU error -window) and aodify if IIIrong lark 'ir arl,O ari,t,pe3 ; asSUIN tap!,! agc2 ; error + windolll - ace ; assuiption is rigbt error -tlindou check aSUilotion .. d tlgez lack for nega.tive energy set to IliX positive energy level - forcel1 assullfitiM. ; it is 2400 i9 cQ: sacl -a" v.1 J yes tooO ••e ~~" ~ hose f., 2400 • 2 - topO aM 1320 - top! ~ ;s s· 00£0,15 ,ne : fHffHfHHfHt******tfHff***HHffffffUfffnHf**'***fHHfHfHfff****** a 0- contI sub ootH 5: l:: .a,ViSQr • it i, !2OO ; lIItighting fader - ; klindOlf - tap! tll~O uror -windOW =tllpOx(error11findolll) ,acl lt tap3 !ROY taoO top3 pac uel bo3 - tap3 ~ ;,. i.t this point, the lIItigMed windowed error is cont_ined in tap3. we consider it an 5.15 nulber Ind use it to update the age "in alpha. first 11ft deter.ine wheth.r to sl.111 or not. if error is larger than lEA6h or iK11er than F5E7h, go into sl.lfing lodt by setting error to 1FFFn or 8000h respectively. other.be Invt it unc.huged. ~ b o'Q' s· :;: age51 ,.e Hcl ives4r ; .ge2: i...;::;. Idpk lie sub sad b ~ s· , ;HHHffHfHHHlffHIfHHHliHlHHff••HtHHHHfHtltIHtHtHHHHH lie Idpk sub bin I:: ~::; Zfro baud energy register t.,3 energy detect 'GOp 1 POSSI age3 ... 1 do not 51.111 ; enter 50 10 ;fHfHHflHHHHHHIHfHtflHtftHtHffHfHHHftfHHHfHHHHIHIHf Mde stut by reading in hysterisis counter incrHtnt toasti-At one, 15 t1j13 Ige4 ; tljl3 7FFFh luk tbl. check if aft gain is on or off ; age3: g, hysine topS ; .dd Idd Idpk bgtz possa I acc tiPS ..g.. 0 i9C4 ; do not slew lie add sacl ont.15 one t.,3 ; enter 510 edt: aode ; t.,3 8000II the follOt1ing JintS update the gain alpha using -an exponential iottgrator alpha = alphiU-kxerror) (erroT' =tap3) .eT'e alpha is of foraat 57.8 and'error is 50.15 and k =0.5. alpha ... error: 57.8'" 5.15 = 57.24. by kttping acch without left shift the aultiplica.tion ~y k is a.ccolPlished. alpha is upperboundtd to 35.73 in s7.S ; Tack O8Ot. and bz shlrd edt! aft gain is on. chick if energy detect is on Csttlrd[61 lie Ind bz one,6 sttlrd edtOl lack tbl. za.lh It opy spoe suh .... Ip t.,O ,I ph. top3 alpha lot thresl t.,O topO sub bIz alphi .d12 e/leek if alpha IIlX alpha subh b1u topO age5 ; if 0 then 11:0 energy detect ; error - t cneck if afe gain stage snould be bypassed ; alpha alpha ; if zero = energy is not detectt'd =ehtck if level is larger than -43.5 dba. if stwrd[6J is one, ebeck if level less than -48 db.- . h.ck tbl. agc41 (1 - O.5Ierrorl - acc lack Ibl. 1« sub biz thres3 topO t.,O alphi edt3 is de gain on? ... ~ -.I lot topO sad alpha = 1) lack IJIlOb bz stlllrd .613 and ; if gain is off exit • 14t04l ~YPi.SS i.h gilA OIl 'ack aM lac om stllll'd sa.cl SaN! iaCK. 04. g. saci ret ; tdtll lack tblr Il< sub biZ Ov ,d'21 ; cliar oVirfloili bit nIh subn hyst ; hystt'resis counter tllP5 nyst , too5 Idt211 =1927 =32708/15 lICk or sacl lICk suI odt02 reI ut3' odlO2' , :s topO topO Ilplla "t3 (~.09 iR 57.8) theR turR .f. gliR .,.tus 080iI st,rd 51tord GI411 •• r.t {);Jf" stlllrd stllllrd ret ).. tbr..5 if alpha Ihros5 10 cUt of overflola! Geclare loss of energy detect lack ..d sacl 51tord ...t .11:2= bY 5tt0r4 socl if ,Fe gli. 51.,. is bypamd, check 1...1 of alplla· \1tcrtlH!ot nysterlsis counter Hen ont,6 or routiftt for _itehi •• tht afe .n/off following lines are executed if afe gain 15 high but no ertergy detect. CheCK if ilofta 21.28 (i.t. rective level -43.5 dOliI and InCrellent nystertsis counter if it "is. otherwise. exit. ; .-litchl odlOl' ).. ::::: b ~. liCk tbl, lac thru2 ,.b alpha bIz edt3 , 21.28 i. 57.8 t..o to.O ZiC sacl lack ..d b. Ivesqr OIGh g. ; _ oil .....t.d bits afeoll N. ~ ): I::: S' ~ R· ~ S· ~ :s ~ aJpna 21.28 =iocrereent bv edl011 "Ih add. Sid "yst too5 byst. counter ; cJei.f overflollll bit 'dIOU: ; tap5 contains inc. fOf reI lack and ••b bz Ofh ; MS. off tilt aft. on bit g. 0" ; dtCI'BIRt the counter ; Sl.Ye ",lchl hyst detect bit stlllrdCbJ =1. bv check if the gliR sho.ld be on eodt04 ; in CiSe of overflolll set energy Hcl lack go OIOb or !III sacl g. ret g.. value ; I Gad the ,Fe Oft bit ; rtitO'" de .R bit "",d bit ,R. ~ ;:, ; slI/tent: ~ SiCI litk tblr ret ~ ciQ. [ loe .,.~ R· thres6 alpha. load the 8M alpht. value N5et alpha to 5.05 sub bz gn one sIIItch2 IItIltiply input supJe by ag' gain ilphi.. the output forMt is 54.11 requiring sOle IN.nipulatiohs 1t opy pit topl alpl>o. ; multiply by at' word sac! gn shift accUiulator eight four tiaes before storing ; deereaent the counter sicl nch loe r.t sadl loe sllltch2: s· sub sac! lack ~ [ r-ts.t the 9n value to zel'o afeoff : ~ I:: ~ gn tblr gn thres4 alpha. ; load ntIII alpha value ; reset alpha to 8.98 in 57.8 ret and Sicl lit add sac1 tlPO topl topO,8 topO one,8 one t""O topO t""l,8 t.pO topl ; llisk off uy sign extension ; GOff - ace ; fffHUHffffHffffHHHHffffHHHfHfflftfHfffffffffffHHHfHHfffHff • update the signal POlitI' estilMte aves-qr. insqr := avesqr + (tap1>2 avesqr is zeroed by the age routine once per baud. RECEIVER PER SllN'LE PROCEDURE ; rstskH loe rin ; input 2'5 co.plileRt supTe high pass filter- tIM! incoming signal to rtlove the dc coaponent. Idpk sacl nls addh sub add' sub of>, 10 lit 5leh 1t IPY lopl,15 10pO topO t.pl ; tapO in 55.10 piC addh aVfsqr nch avesqr ; avesqr in s10.5 xl stlsb sl st, hu xl xl,hu-l subh add sac1 sach dlllov xl x2,tau-l stlsb ldpk 0 sach topl st xl end of receiver- per sup1e task 420 An All-Digital Automatic Gain Control Part IV. Telecommunications 12. General-Purpose Tone Decoding and DTMF Detection (Craig Marven) 421 " '422 General-Purpose Tone D"ecoding and DTMF Detection Craig Marven Regional Technology Center - Bedford, England Texas Instruments General-Purpose Tone Decoding and DTMF Detection 423 424 General-Purpose Tone Decoding and DTMF Detection Introduction The use of the Dual-Tone Multi-Frequency (DTMF) signaling scheme within telecommunications systems has become widespread over the past few years. It is replacing the older type of pulse oriented dialing methods in telephones worldwide, and also finds application in a number of other equipment types, such as personal computer (PC) telephone peripherals, remote signaling schemes etc. In parallel with the universal DTMF standard, the various telecommunications companies or public authorities (PTTs) around the world use a number of different tones to signal call progress parameters. Examples include busy tones, number unobtainable, timing tones, etc. Although DTMF operates to an internationally recognized standard, these additional tones do not. Therefore, there is often a need for a programmable tone detection capability operating concurrently with standard format DTMF decoding. Alternatively, there are also many possible areas of application for an expanded programmable tone decoding facility without DTMF capability. This document describes a single-chip solution to fulfill the requirement for concurrent DTMF and general-tone decoding or expanded, general-tone decoding only. These facilities are provided by a special program on the TMS320C 17 or TMS320E 17 firstgeneration digital signal processor (DSP). The term TMS320C 17 should be taken to apply to both the TMS320C 17 and TMS320E17 for the remainder of this report. See Reference [6] for full information on these devices. The TMS320C17 is particularly suited to tone detection as it possesses on-chip serial ports, a hardware multiplier and a 200 nanosecond (ns) instruction cycle time. These last two features allow high-speed calculation of the digital filter equations which implement the core of the tone decoding function. The main functions of the tone detector described in this report are as follows: 1. DTMF tone decoding to international standards 2. Power measurement at six selectable frequencies in the band 300-3400 Hz 3. Power measurement at three selectable frequencies simultaneously with DTMF tone decoding 4. Selectable bandwidth and resolution of frequency selection 5. Timestamping of tone arrival and departure 6. Selectable thresholds to define tone arrival and departure 7. Interrupt generation on tone arrival, departure or change 8. Interrupt generation on unidentified tone 9. Interrupt generation on validation of DTMF digits General-Purpose Tone Decoding and DTMF Detection 425 10. Variable gain setting on input to receivers 11. Self test In addition to a detailed description of the operation of the software within the TMS320C 17, a complete solution to a tone detection peripheral for an IBM XT or AT compatible PC is presented. Remember that this is just one possible application for the tone detection TMS320C 17, it could equally be paired with any other host CPU. This report is divided into seven sections and three appendices. A brief outline of the contents of each section serves as a useful guide. Although some sections refer to general principles of DTMF and tone decoding, keep in mind that the primary objective is to discuss a particular implementation of a tone detector. Theory of Operation Describes the basic theory of operation of the tone detector, describing total system scope and functionality, and giving a brief introductory description of each functional block. For this purpose the tone detector is considered as a set of software functions with supporting hardware. The high suitability of the TMS320C17 DSP for tone detection is also discussed. Implementation Deals in detail with the implementation of both the software within the TMS320C 17, and its supporting hardware. Each is split into its main functional blocks and then further subdivided into individual tasks. The description of software implementation is accompanied by a series of flow charts, allowing the reader to follow the description from the top functional level right down to the detail of individual tone detector features. This section also covers in detail how the tone detector program controls, and benefits from, some of the resources provided by the TMS320C 17. Host Interface Describes the host interface of the tone detector. This has been designed for easy connectability to a variety of host CPUs, and is essentially a single physical8-bit read/write register. The host interface software is implemented by an interrupt routine in the TMS320C 17, allowing host access at any time as required. Applications and Customization Briefly outlines some possible applications for the tone detector including traditional telephony applications along with some innovative approaches. These include a method for secure off-site remote control of equipment via telephone lines, a tester for telephone equipment, etc. For many applications it may be necessary to customize the program to some extent. A number of examples of this are discussed. 426 General-Purpose Tone Decoding and DTMF Detection Conclusion Within the appendices are a full listing of the source code for the tone detector in COFF (common object file format) source format, and a demonstration program for IBM or compatible PCs. This program is written in Turbo Pascal and is for use with the design example included in this report. History of DTMF There are two standard dialing conventions used in telephone systems throughout the world. The most common, and by far the oldest is known as pulse or loop-disconnect dialing. DTMF is a relatively newall-electronic method which is rapidly replacing the older electro-mechanical system. Figure 1 represents a highly simplified pulse dialing telephone terminal. There are other circuits required to make a practical telephone, but this diagram serves to illustrate several key points. Telephone Terminal "-' - Switch-Hook Local Line Earphone Speech Circuit Microphone Figure 1. Pulse Dialing Telephone When the receiver of a pulse dialing telephone is lifted, the hook-switch closes and a DC loop current of a few milliamperes flows from the central office or local exchange. The dial is arranged so that the switch within it opens and closes as it returns to its rest position. When the switch opens it causes the loop current to be interrupted, hence the alternative name of loop-disconnect dialing. The dial is arranged so that one disconnect period or pulse is created for the digit 1, two for the digit 2, up to ten pulses for the digit O. Dial pulses originally operated electromechanical switching systems, and still do in many countries. These systems have an upper limit of about ten operations per second and pulse dialing systems therefore produce pulses of a 100 millisecond (ms) duration. Nominal operation in the U.S. gives a break period of 61 ms and a make period of 39 ms. This is different from other countries which use a 2: 1 ratio (67 ms break, 33 ms make). An inter-digit pause is indicated by an absence of pulses of nominally 700 ms for U.S. systems, or as short as 200 ms in other countries. General-Purpose Tone Decoding and DTMF Detection 427 The time required to send the dial pulses needed for one digit can be up to 1.7 seconds (ten pulses for the digit 0 and a 700 ms inter-digit pause) which can make the dialing of a long international number very time consuming. For example, the international number (from the U.S.) for Texas Instruments in Bedford, England is: 01144234270111 This would take 15.1 seconds to dial with a U.S. pulse dialing system. It is not difficult to see why the method is now regarded as out-dated. In order to reduce costs, increase reliability, and improve service, the electromechanical switching systems used at central offices or local exchanges are being replaced with fully electronic systems. In most advanced countries this upgrading process is virtually complete. With the new equipment it is no longer necessary to have a slow . dialing mechanism to accommodate the response time of the old switching mechanisms. A new dialing scheme thus becomes possible using purely electronic means. The DTMF system has been adopted as the universal standard through the CCITT (Comite Consultatif International de Telephonie et de Telegraphie) which is a committee of the International Telecommunication Union (ITU), now part of the United Nations. The Use and Characteristics of DTMF The full name for DTMF is Dual-Tone Multi-Frequency which describes its operating characteristics very well. Consider that a telephone is equipped with a keypad as shown in Figure 2, instead of a dial. The A,B,C and D keys are usually not present, but are part of the full CCITT specification and can be decoded by the programmed TMS320C 17 used here. 428 General-Purpose Tone Decoding and DTMF Detection High Group Frequencies (Hz) 1209 , Nornal--......... Keypad ~ 697- , 941 - 1633 Extended , , ' , -rKeypad " -[J-0-[J-r-~I I I I -(R1) I: -~-0-~--0I 852- 1477 __ I 770- 1336 , -(R2) I: -[J-~-0--~I I I , , , -'-, (C1) (C2) (C3) (C4) -(R3) I: -c:J-~-0--0- -(R4) , , , ~ R=Row C=Column Figure 2. DTMF Keypad Pressing any key causes an electronic circuit to generate a tone which is a summation of the two individual frequencies related to the row and column of that key. The frequencies used in DTMF dialing have been carefully selected so that any DTMF decoding circuit will not confuse them with other tones that may occur on the line. As the tone generation does not involve a disconnect of the telephone circuit, DTMF tones may be sent down the line during a call just by pressing any key on the keypad. When this method is used as a form of low speed data transmission, it is important that speech is not accidentally interpreted as a DTMF tone. In order to reduce the risk of this happening, tones must be present continuously for a minimum period of about 50 ms, with an interdigit pause of similar length. With a minimum, dialing time of 100 ms per digit, irrespective of its value, our previous example !lumber would take 1.4 seconds to dial. This represents a saving of 13.7 seconds or 91 % of the time taken by a pulse dialer. Additional advantages ofDTMF dialing include the use of solid-state electronic circuits and compatibility with electronically controlled exchanges. ,General-Purpose Tone Decoding and DTMF Detection 429 Theory of Operation This section briefly describes the operation of the tone detection system presented in this report. A functional block diagram for the complete system is shown in Figure 3. Figure 3. Tone Detector Functional Block Diagram As is clear from examination of Figure 3, the tone detector may be viewed as comprising a set of software routines within the TMS320C 17, plus associated external hardware to provide interfaces between the TMS320C17 and both the incoming analog signal and a host CPU. The following paragraphs briefly describe the major software and hardware features of the tone detection system, and some of the features of the TMS320C 17 which are of special benefit to this application. Software The tone detection system described in this report comprises six groups of functions within the TMS320C 17. These provide a powerful tone detection capability for either DTMF decoding, general tone identification or a combination of both. These six functional groups are as follows: 1. 2. 3. 4. 5. 6. Input signal processing DTMF receiver Power (envelope) detector Tone receiver - comprising five sub-sections 1/0 routines (Interrupt Handler) Self test Figure 4 shows how the first four of these functions interrelate during normal operation of the the tone detector. Each block within Figure 4 is explained in detail in the Implementation section and each also has a detailed flowchart associated with it. The number of the figure for the associated detailed flow chart is shown inside each block in Figure 4. 430 General-Purpose Tone Decoding and DTMF Detection + I Signal Input Processing I DTMF Figure 8 I + + I Yes End of Filter Block? Figure 12 No ./ ....... t ... N() ./ ~ Power Detector ....... t Tone Receiver: Tone Depart Figure 3-5 Tone Receiver: Steady No Tone r r Queue Empty? ....... ./ t Tone Receiver: Steady Tone r ~ Yes Update Tone Receives Parameters Tone Receiver: Tone Onset Figure 3-3 r Figure 4. Tone Detector Flow Chart - Top Level Program execution remains within the flow shown in Figure 4 unless interrupted by either an liD request or a self-test command, which are independent functions. Selftest is merely a special case of a host CPU liD request. Both serial liD and host CPU liD cause an interrupt to the TMS320C17 and therefore function outside the normal program flow. Self-test additionally destroys all temporary data storage, leaving the tone detector in the same state as after a hardware reset (see the Register Read Functions section). The following sections briefly describe the relationship betwen the above six functional groups. A more detailed description of the operation of each is contained in the Implementation section. Input Signal Processing This ensures tha~ the incoming data samples are within the optimum working range of the tone detector. Software limiting of the incoming signal is applied if it exceeds the maximum signal input level (see the Signal Input Processing section). Program control passes to the DTMF receiver if it is enabled, otherwise control passes to the power detector. General-Purpose Tone Decoding and DTMF Detection 431 DTMF ReCeiver Using the signaling plan outlined in CEPT (Conference Europeenne des Administrations des Postes et des Telecommunications) recommendations TICS 46-02, the DTMF receiver validates and decodes DTMF tone pairs against a template of acceptable frequency deviation. The DTMF receiver may be enabled or disabled under software control by the host CPU. Once the operation of the DTMF receiver is complete, program flow passes to the power detector. Power (Envelope) Detector The power detector performs a simple smoothing operation on the incoming signal and, using thresholds programmed by the user, directs program flow among one of the four possible tone receiver flow paths shown in Figure 4: 1. 2. 3. 4. Tone onset Tone depart Steady no tone Steady tone Separate threshold levels may be programmed for detection of the onset and departure of the input signal. Tone. Receiver Power Level Determination The ioIie receiver determines the overall power level of the incoming signal and the individual power level at up to six selectable frequencies. In addition, it validates the signal onset or signal departure indication from the envelope detector to change the tone arrival or tone departure status bits (see Status section). The tone receiver operates independently of the DTMF receiver and provides programmable center frequency, bandwidth, resolution and thresholds for the recognition of general tones in the band 300 Hz to 3400 Hz (e.g., call progress tones). When the DTMF receiver is disabled the tone receiver monitors six programmable frequencies in the range 300-3400 Hz and reports the power levels received at each of those frequencies. When the DTMF receiver is enabled the tone receiver monitors only three frequencies. The power level of the three unused frequencies is registered as zero. The tone receiver also has an additional power measurement which reports the received power across the telephony band of 300-3400 Hz allowing the system to detect the presence of frequencies outside those programmed individually. 432 General·Purpose Tone Decoding and DTMF Detection When tl;te tone receiver is enabled, filtering begins upon the recognition of a tone by the envelope detector. The host may be interrupted at the end of the first block of filtering as a result of the tone arrival bit in the status register being set. At this time level information for the new tone is available at each of the search frequencies. The host may also be interrupted by tone departure. The tone receiver is also able to detect any change in signal content and may optionally generate an interrupt as a result. Host interrupt is described in detail in Host Interrupt section. The flow of program execution around the tone receiver is dependent upon the results of tests at a number of points. The most important of these is at the output of the power detector. As mentioned above there are four possible conditions the power detector can indicate: 1. 2. 3. 4. Tone onset Tone depart Steady no tone Steady tone The operations performed within these blocks are described in detail in Software Implementation section. The second most important decision point in the tone receiver program flow is represented by the end of filter block test. When the tone receiver is enabled, incoming samples are filtered in blocks. The block size is dependent upon the value written to the filter length register (see Filter Length section). If a filtering block has been completed, housekeeping functions must be performed. I/O Handler (Serial and Parallel) Any external 110 access will cause an interrupt to the TMS320C 17. External I/O can come from one of three possible sources: • • • A new data sample being input from the serial port A host CPU write access A host CPU read access The source of the interrupt is checked by the program and control passed to the appropriate portion of the interrupt handler code. A comprehensive discussion on the use of interrupts within the tone detector is given in Hardware Implementation section, including a detailed examination of some parts of the interrupt handler code. General-Purpose Tone Decoding and DTMF Detection 433 Self-Test One special case of a host CPU write access is a self-test request. The TMS320C17 responds to this by immediately performing a ROM checksum test, a RAM data test and a codec interrupt check. After these have been performed the host CPU may release the TMS320C17 from self-test mode. The TMS320C17 is then left in a state similar to that after a hardware reset (see Register Read Functions section). TMS320C17 Features The TMS320 family utilizes a modified Harvard architecture for speed and flexibility. In a strict Harvard architecture, program and data memory lie in two separate spaces, permitting a full overlap of instruction fetch and execution. The TMS320 family's modification allows transfers between program and data spaces. This permits coefficients stored in program ROM to be read into RAM, eliminating the need for a separate coefficient ROM. It also makes available immediate operand instructions and subroutine calls to computed addresses. . The TMS32OC17 provides all the basic features of the industry-standard TMS32OClO. Two serial ports, expanded data memory to 256 words, expanded program memory to 4K words on-chip, and a coprocessor mode are added to provide a powerful processor for a variety of communications-oriented applications. The TMS320C17 is a microcomputer device only, with no external program memory facility. The TMS320E17, a 4Kword EPROM version of the TMS320C 17 is available for prototyping or low volume production. The Tone Detection application takes advantage of the full set of processor resources shown in Figure 5. A few examples from the code, and a description of each, are given in Utilization of TMS320C17 Resources section to illustrate this. 434 General-Purpose Tone Decoding and DTMF Detection CLKOUT lCZ'CLKIN 1 lAgend: ACC.. Accumullllor ARP.. Auxmary Regl..... PoInter ARO .. AuxIliary Regl..a, 0 ARl .. Auxmary Regl"a, 1 DP .. [)alii Pege PoInter trMs32OC171E17 only PC P T TR RR .. Program Count... .. PReg...... .. T Regis'" Transmit Regls'er .. Receive Regl.te, Figure 5. TMS320Cl71E17 Block Diagram General-Purpose Tone Decoding and DTMF Detection 435 The Tone Detector program uses less than 50% of the available 4K-words of program memory and less than 70 % of the available 256 words of data memory within the TMS320C17. Of the 174 words of data memory used, 75 are in page 0, and 99 in page 1. A detailed list' of program and data memory utilization is shown in Table 1. Table 1. Program and Data Memory- Utilization Code Routine Listing Description Page 489 MAIN Program Data Memory Memory locations Locations Reset and interrupt vectors 4 490 DTMF Constants and filter coefficients 28 490 Tone detector constants 62 491 Tone detector filter coefficients 129 Read sample from input queue and up- 55 14 41 4 492 date current time, scale the input sample and call DTMF if it is switched on. ENVDET 494 Detect changes in signal envelope relative to user-programmed upper and low,er thresholds TON SET 495 Handle occurrence of tone onset 11 2 TDEPT 495 Handle tone departure 41 1 FILTER. 496 Routine for filtering and accumulating the 172 52 109 1 31 0 Write levels into registers 13 3 Complete operations ready for next filter- 39 1 input samples LEVCAL 499 Calculates the levels at the end of each block of filtering CHNGS 501 Check for level changes during a tone burst LVLS 501 COMPLT 502 ing operation RSTFIL 502 Clear down filter accumulators and reset 61 pointers ready for another filter operation SQRT 504 Generates the square root of an integer 32 DTMF 504 Detect DTMF digits 508 83 INTHDL 510 Interrupt handler 194 8 CRESET 514 Cold reset handler 14 1 WRESET 514 Warm reset handler 33 3 ATTEN 515 Write out status to draw attention to 4 change in one or more of the status bits XFUPD 515 Update the XF flag SLFTST 516 Self test of processor Total 436 17 111 4 1709 177 .General-Purpose Tone Decoding and DTMF Detection Hardware In order for the TMS320C 17 to receive its input signal and communicate with a host CPU it requires a small amount of support circuitry. This comprises just three devices, as shown in Figure 6. This example is specifically for interfacing the tone detection system to an IBM XT or AT compatible PC bus. A detailed description of this circuit is given in Hardware Implementation section. Analog Input IBM PC TMS32OC17 Bus Figure 6. PC Tone Detector Circuit Diagram-Block Level Analog to Digital Conversion The analog signal is converted to a serial pulse code modulated (PCM) serial data stream by an industry standard combined codec and line filter (COMBO), the TCM2917. This interfaces directly to the TMS320C 17 with no support circuitry. Host Interface A programmable logic array (PAL) provides read and write decoding for both the host CPU and the TMS320C17, including full address decoding of the host CPU bus. A 74ALS652 provides a two way latched data buffer between the host CPU and the TMS320C17. The TMS320C17 has a special coprocessor mode which can also perform the latched data buffer function in a wide variety of applications. The coprocessor mode is described in greater detail in Use of Coprocessor Port for Parallel 1/0 section. Implementation This section describes in greater detail how the tone detector functions described in the Theory of Operation section are implemented. It is intended for non-mathematical readers, and equations have only been included where they can aid understanding for readers familiar with general DSP techniques. It is not necessary to understand the derivation or purpose of these equations in order to gain a basic understanding of system operation. General-Purpose Tone Decoding and DTMF Detection 437 Software Implementation As described in Software section the software within the tone detector may be conveniently split into the following six groups: 1. 2. 3. 4. 5. 6. Signal input processing DTMF receiver Power detector Tone receiver comprising five sub-sections 110 routines (Interrupt Handler) Self test A detailed description of the performance and implementation of these functions follows. In all of the detailed explanations in this section ofthe report, references are provided to a page of the program listing included as Appendix A. Signal Input Processing This block contains only two straightforward tasks: 438 1. Read queue, increment time (program listing page 492)-Codec samples sent to the TMS320C17 are received via its serial port and then queued. The maximum queue length is eight samples. Under normal circumstances the queue will not contain more than one sample. However, at #1e end of each block of filtering or DTMF detection, there is a series of computations which must be completed before the handling ofthe ~ext codec sample. Operation of both the DTMF code and the tone filtering code are suspended during this period and new codec samples accumulate on the queue. At all times, information arriving at the TMS320C 17 via its serial port is handled with first priority, so that no samples or requests are missed. 2. Scale and limit (program listing page 492)-ln this report the TMS320C 17 is programmed to accept A-law input samples. The TMS320C17 can also be programmed to accept the u-Iaw samples in North American applications. The output from the on-board compander is scaled to· a number range which affords the maximum precision for the range of signal magnitudes allowed. The tone receiver is specified to provide linear detection of tones in three ranges. The dynamic range of the tone receiver is between 35 and 40 decibels (dB). Provision of three software selectable scale factors allows this dynamic range to be shifted so that the top of the range is at either +2, -;-10 or -22 dBmO. Where dBmO is defined as the zero reference point of the channel. The overall detection range is thus + 2 to - 60 dB approximately (see Figure 7). General-Purpose Tone Decoding and DTMF Detection 10 0 0 .I ·10 "D •~ ·20 II! J! -30 E I! ~ ·40 -50 -60 Gain Factor ·70 1 4 16 Figure 7. Tone Detector Active Dynamic Range vs Gain Factor The output from this block is the next sample to be dealt with by the DTMF code and the power detector. DTMF Receiver A brief specification is given in Table 2. For full details, refer to CEPT recommendation TICS 46-02. The operation of the TMS320C17 algorithm to this specification has been verified by use of the standard Mitel DTMF test tape. General-Purpose Tone Decoding and DTMF Detection 439 Table 2. DTMF Decoder Specification Measurement Signal frequencies Breakdown Value Low Group 697,770,852, 941 Hz High Group 1209,1336,1477,1633 Hz Frequency deviation for correct S;1.9% operation Power levels per frequency Operation (-6 dBmO - G dB) to (-36 dBmO - G dB)* Non-operation Power level difference between -45 dBmO - G dB* OdBto 10dB frequencies for operation Tone dur~tion Silence duration Signal to noise ratio required for correct operation Talk-off performance Recognition ~40 Non-Recognition S;20 mS mS Recognition ~40 Non-Recognition S;20 mS mS 12 dB , 1 5 hits in 30 minutes of condensed speech "*See Mode subsection in Host Interface section for an explanation of the gain control factor GdB. The DTMF receiver may be used to receive and recognize tones from a remote handset, e.g. in a PABX, or from a telephone set at a remote point on the public telephone network. The distortion of tones over the public network is often severe; for example, the attenuation of the signal from the remote transmitter could vary from 0 dB to 30 dB or more. The specification shown in Table 2 provides correct operation across the normal range of signals received over the public network. The range of received signal levels at which the DTMF receiver will correctly decode "signals can be varied by altering the gain of the tone detector module under software control (see Mode section). Validation of a DTMF digit while the DTMF receiver is enabled (see Mode section) causes a DTMF interrupt to be generated and suppresses the generation of any short tone interrupt which might otherwise have been generated by the tone receiver code. The arrival time of the tone is stored for the host to read if required. The following description of the operation of the DTMF block relates directly to the detailed flow chart shown in Fi~re 8. 440 General-Purpose Tone Decoding and DTMF Detection No SetOn••t Tim. Valid Flag Figure 8. DTMF Receiver Flow Chart DTMF (program listing page 508)-This revolves around a set of eighth order narrow bandpass filters at each of the individual tone frequencies which may be combined to produce a DTMF digit. The simple eighth order filtering process is executed on the incoming sample automatically when the DTMF receiver is enabled. If a valid DTMF digit is found, its value is stored in the DTMF digit register and execution passes along the 'validated' path. If the DTMF receiver is not enabled, program execution passes onto the tone receiver. Save Held Onset Time-The onset time of all detected signals is saved in a holding register. This is transferred to the tone arrival register only if the tone receiver is not already indicating the presence of a tone, in which case the tone arrival register will already have been loaded. Set Onset Time Valid Flag, Set DTMF Interrupt-The DTMF tone onset time is saved in a register for the host to read. The host is informed by interrupt (if implemented) that a tone onset has occurred and that timer registers containing information about the tone are available to be read. General-Purpose Tone Decoding and DTMF Detection 441 Power (Envelope) Detector (see program listing page 494) As described above the power detector performs an envelope detection operation on the incoming signal, and directs flow to one of four tone receiver paths. The smoothing filter applied to the incoming signal has the form: ENVEL= «2 15 x ENVEL) + ABS(32 x EDF x SAMPLE) - (32 x EDF x ENVEL» 215 Where EDF is the user programmed envelope decay factor (see Envelope Decay Factor section). This is equivalent to: ENVEL = «1-k) x ENVEL) + (k x ABS(SAMPLE» where EDF is k X 2 10 where EDF is k x 2 10 k positive'. The envelope decay factor may be programmed to provide a range of time constants for the envelope detector. There is generally a trade-off between the rejection of a glitch if a long time constant is used and iricreased accuracy of time-stamping with a short time constant. When the power detector identifies the departure of the input signal, a status register bit (see Status section) may be set, and the time of departure written into a register. This depends upon the signal having been recognized as a DTMF digit or a valid tone within the tone receiver search bands. Due to the method of implementation of the envelope detector, it should be kept in mind that there are two areas of operation when using the tone receiver: the arrival and departure time skew and the sampling frequency. These are explained in detail in Appendix C. Tone Receiver Band Pass Filter Generation The tone receiver generates a band pass filter for each of the chosen frequencies and uses these filters to select the desired frequencies from the incoming signal. The steepness of cut-off of each bandpass filter is defined by the length of time over which the received signal is filtered. This is programmed via a register and applies to all the filters in operation. The passband width of each filter is specified via a separate register, and the maximum value for passband width for any single filter is 492 Hz. Each of the filters in use may be selected to adopt either the passband width specified in the register (wide filter) or a passband width of zero (narrow filter). As described in the Tone Receiver Power Level Determination section, the power detector directs .the flow of the tone receiver along one of four paths: 1. 2. 3. 4. 442 Tone onset Tone departure Steady tone Steady no tone General-Purpose Tone Decoding and DTMF Detection A detailed description of the operation of each of these follows. Tone Onset Figure 9 shows the flow chart associated with a tone onset indication from the power detector. Set Tone Present Flag No Clear First Block Flag Figure 9. Power Detector Flow Cbart-Tone Onset Set Tone Present Flag-This flag is used to indicate the presence or absence of a tone on the line. Hold Onset Time-The onset time of all detected signals is saved in a holding register. Filter (program listing page 496)-This routine is the heart of the tone receiver algorithm. The FIR filters are of the lowpass type and there is one for each of the six search frequencies. A range of filter lengths may be specified, from 61 to 1025 samples, allowing filters of extremely steep cut-off to be implemented. With the maximum filter length of 1025 samples, the shortest quantifiable tone is one of at least 128 ms duration. The input signal is demodulated using a sine and cosine wave at each of the six search frequencies. The result of the demodulation is that any signal present at one of the search frequencies is transposed into the passband of the lowpass filter. Figure 10 shows the filter structure. General-Purpose Tone Decoding and DTMF Detection 443 Window Sample - -....-------41~-------- Accumulate J--e---+---------Sin (X) I X Sample Codec Sample Accumulate -.----1 Accumulate Ir--------------- tp------nww-4II_-I N II ------------~----, Sine Sample - - - - - - - j i - - - - + - - - - - i I I I 1--+-- Accumulate Coalne Sample - - - - - - ! - - - - - j i - - - - - - - I L_______________ I I I I Filter Select Accumulate _________________ I I I ~ Per Detector Figure 10. FIR Filter Structure The coefficients of the filter are samples taken from a window function stored in ROM. The function is a Kaiser window, chosen to give the narrowest lowpass response with the given stopband rejection. Where a wide filter response is specified, each filter coefficient is multiplied by a sample of a sin( X )/ x function to provide a second wide filter coefficient. This has the effect of widening the filter passband in a definable and convenient manner. The input sample is multiplied by the normal (narrow) and wide filter coefficients to produce both a narrow and wide intermediate sample. Each of the six filters is specified to be either narrow or wide according to the value in the filter select register. Depending on this value, the appropriate intermediate sample is multiplied by a sine sample and cosine sample at the required search frequency. The sine and cosine samples are generated as required by a special routine. The twelve products are separately accumulated to 32-bit accuracy. In addition to this, accumulations are kept of the wide and narrow filter coefficients so that the filter accumulations can later be normalized. An accumulation is also kept of the square of the input sample, so that the total signal level in the telephony band can be calculated. 444 General-Purpose Tone Decoding and DTMF Detection Reset Filtering-Clears down all the accumulators and registers used by the filters. Clear First Block Flag-Clears a flag set to indicate that the first block of data was being filtered. Tone Depart Figure 11 shows the flow chart associated with a tone departure indication from the power detector. No CIearOneet Time Valid Flag No Figure 11. Power Detector Flow Chart-Tone Departure Clear Tone Present Flag-This flag is used to indicate the presence or absence of a tone on the line. General-Purpose Tone Decoding and DTMF Detection 445 Reset Filtering-Clears down all the accumulators and registers used by the filters. Onset Time Valid Flag Set?-The program tests to see if a flag has been set at this point to indicate that the stored onset time is valid. This will be the case only if a complete block of filtering has been performed on the tone, or the tone has been recognized as a DTMF digit. If the flag is not set the program further checks to see if the tone detector is enabled. If not this section terminates. Timer registers are not updated and contain onset and departure times for the pn!vious valid tone or digit. However, the current time register is available for the host to read if it wishes to timestamp the short tone. If the tone detector is on, the short tone bit in the status register is set which can optionally generate an interrupt (see Status section). Clear Onset Time Valid Flag-Clears the above flag. Save Depart Time-Provided that a valid tone or digit has been recognized, the current time is saved directly into the tone departure register. Set Depart Interrupt-If the tone detector is enabled, the tone depart bit in the status register is set. This may optionally generate an interrupt. Steady No Tone In this case, the only operation performed is Reset Filtering which clears down all the accumulators and registers used by the filters. Steady Tone This condition causes execution from just above the "Tone Detector On" decision point in the tone onset flow chart (Figure 9). End of Filter Block? When the tone receiver is enabled, incoming samples are filtered in blocks. The number of samples in a block is set by the filter length selected, and may be between 61 and 1025 samples. After each complete block of filtering, much housekeeping must be done. Figure 12 shows the flow chart for· this process. 446 Genera/-Purpose Tone Deco4ing and DTMF Detection No Figure 12. Tone Receiver Flow Chart-End of Filter Block General-Purpose Tone Decoding and DTMF Detection 447 Calculate Levels-For each ftlter, the root of the sum of the squares of the corresponding sine and cosine. accumulations is calculated and normalized using the appropri~te filtercoefficient accumulation. The result represents the signal level falling within the passband of the ftlter. The square root of the signal-squared accumulator represents the total signal level present within the telephony band. Provided that the ftlters have been correctly placed, the root of the sum of the squares .of the ftlter outputs should equal the total signal level. This allows a check to be made for tones present but not registered by the filters in use. Check Changes, Write Levels-The output level of each of the six filters is checked to see whether any of them has crossed the change threshold programmed by the user. The signal levels in the six bands are then written to registers for the host to read. The second three filters will be zero if DTMF is switched on. Save Held Onset Time, Set Onset Time Valid Flag, Set Onset Interrupt-If the block of filtering that has just been completed was the first one performed on the current tone there are a few other tasks to perform. The tone onset time is saved in a register for the host to read and then the host is informed by interrupt that a tone onset has occurred and that timer registers containing information about the tone are available to be read. Changes?, Set Change Interrupt-If the completed filter block was not the first block after tone arrival, it is necessary to check for any changes to the tone. If any signal levels have crossed the change threshold in a filtering block other than the first block, then a change interrupt is asserted. Registers containing information about the tone may contain misleading information due to the likelihood of the change having occurred in the middle of a filtering operation. Reset Filtering-Clears down all the accumulators and registers used by the filters. Clear First Block Flag-Clears a flag set to indicate that the first block of data was being filtered. 110 Routines (Interrupt Handler) Both host and signal (serial) I/O are dealt with hy the interrupt handler. Host read or write accesses cause an external hardware interrupt to the TMS320C 17. The availability of a new codec sample within the serial port receive register causes an internal hardware interrupt. A flow chart of the interrupt handler is shown in Figure 13. A detailed description of some parts of the code within the interrupt handler are contained in Interrupts section. 448 General-Purpose Tone Decoding and DTMF Detection Interrupt t Check Interrupt Source E~ernal . .+ ~, Internal Clear Codec Interrupt + .... Ye. State Bit Sst? .. No Check For ResdlWrlte Read Queue Samlpe • t + Perform Second Half of Write Load Mapping Word Save Command J, , ....... " ....... ,r Output Stetu. ...... , Output Data " v ..... " Clear A" N~codec Interrupt. + Return Figure 13. 110 (Interrupt Handler) Flow Chart General-Purpose Tone Decoding and DTMF Detection 449 Self Test The tone detector system can be instructed to carry out a self-test operation at any time by writing to a bit in the mode register. The flow chart for the' self test routine is shown in Figure 14. The duration of the test is 6 ms. No access should be made to the tone detector until the end of this period when the result of"the self test is available in the mode register. 450 ,General-Purpose Tone Decoding and DTMF Detection, Self Test Command ROM Checksum Test RAM Test Codec Interrupt Test Warm Reset Save Test Resuhs Result Flherlng Inhlallze DTMF Code Output Status Clear All Pending Interrupts Restart Main Program Figure 14. Tone Receiver Flow Chart - Self Test General-Purpose Tone Decoding and DTMF Detection 451 Once the self-test is complete the tone detector enters a state where normal functions are inoperative, but the host data path may be tested. In this mode a write to any register other than mode or control will access a holding register inside the tone detector, rather than the register specified. This holding register may then be read by accessing any register other than mode or status, thus checking the integrity of the host data path. Self-test is terminated by a further write to the mode register. When this has been done, the tone detector is left in the default state as though it had received a hardware reset. Program Overview An integrated flowchart for the tone detector program is shown in Figure 15. 110 routines and self test are not included as they do 'not form part of the normal tone detector program flow. 452 General-Purpose Tone Decoding and DTMF Detection CJ ~ ;:;'" ~ '" '"Ql ::: '" b '" ~ ~ No C\ Yes <:0 Queue Empty? ~ ~. I::> ::: ~ b ~~ b '§.'"" C\ Tone Detector On? No Yes Tone Detector On? No ~ Figure 15. Tone Detector Flow Chart (Detailed) Utilization of TMS320C17 Resources Central Arithmetic Logic Unit (CALU) The throughput capability of the CALU is one of the keys to the success of the TMS320 family. At the center of the CALU is a two's-complement 16 by 16 hardware multiplier with a 32-bit product register, which provides a result in a single cycle. Other features interfacing directly to the multiplier are the 32-bit ALU, 32-bit accumulator (ACC), two shifters and the data bus as shown in Figure 16. One input of the multiplier is provided directly from data memory via the data bus, the other is from the previously loaded temporary (T) register. 454 General-Purpose Tone Decoding and DTMF Detection Shifter (0-16) Multiplier 16 P(32) 32 32 Figure 16. Central Arithmetic Logic Unit (CALU) General-Purpose Tone Decoding and DTMF Detection 455 The hardware intensive approach of the CALU allows mathematically intensive algorithms to be performed very efficiently. To show its performance, the following example is taken from the ENVDET (envelope detector) routine in the source listing. Its function is to implement a smoothing ftlter of the form: ENVEL= «2 15 X ENVEL) + ABS(32 X EDF X SAMPLE) - (32 X EDF X ENVEL» 215 Initial conditions are that EDF is stored in data memory location TEMP and the current envelope detector output is stored in ENVEL. LAC TEMP,S Puts EDF X (2 5) into the accumulator, using the barrel shifter to shift EDF from data RAM location TEMP left by 5 bits. SACL TEMP Stores 32 X EDF back into TEMP. LT TEMP Loads 32 X EDF from TEMP into T register. MPY SAMPLE Multiplies the data value from SAMPLE by 32 puts result into the P register. EDF and PAC Copies P register result into accumulator. Note that an instruction which transfers the P register into the accumulator must always follow a multiply in order to ensure the contents of the P register are not lost if an interrupt occurs during the mUltiply instruction. ACC = 32 X EDF X SAMPLE ABS The absolute value (magnitude) of the result is left in the accumulator. MPY ENVEL Multiplies the data value from ENVEL by 32 X EDF and puts result into P register. Note that it is not necessary to reload the T register. Subtracts P register contents from accumulator. ACC = ABS(32 X EDF X SAMPLE) - (32 X EDF X ENVEL) SPAC 456 X ADD ENVEL,15 Adds current value from ENVEL to accumulator with a left shift of 15 (i.e. multiplied by 2 15). ACC = ABS(32 X EDF X SAMPLE) - (32 X EDF X ENVEL) + (EDF X 2 15) ADD ONE, 14 Adds the value 214 to the accumulator to round up the result. General-Purpose Tone Decoding and DTMF Detection SACH ENVEL,1 Stores the upper 16 bits of the accumulator in ENVEL with a left shift of one to remove the extra sign bit (caused by mUltiplying two two's-complement numbers). As it is storing the high-order accumulator, the result is effectively divided by 215. Thus we now have the result: ENVEL = «2 15 x ENVEL) +ABS(32 x EDF x SAMPLE) -(32 x EDF xENVEL)) 2 15 2 .15 This calculation takes 11 instructions and executes in 11 cycles or approximately with a 20.48 MHz operating frequency. flS Interrupts The TMS320C 17 has an extended interrupt capability to handle a number of possible sources. These are external interrupt and serial port interrupts for any of FSR (external receive framing input), FSX (external transmit framing input) and FR (internal framing output). Two steps are required to enable an active interrupt to the device. First, the individual interrupt must be enabled by writing to the appropriate bits in the system control register. Secondly the master interrupt circuitry should be enabled by the EINT instruction. When an interrupt occurs, its source can be determined by reading the interrupt flag bits in the system control register. Program control can then branch to the appropriate interrupt handler. For a full explanation of TMS320C 17 interrupts refer to sections 3 and 5 of the First-Generation TMS320 User's Guide (Reference [6]). Interrupt Initialization In our example interrupts are initialized by the WRESET (warm reset handler) routine as follows. CTLPRT and CTLUPR are equated to 0 and 1 respectively to point to the 1/0 locations of the lower and upper 16 bits of the 32-bit system control register. Some data RAM locations are also previously set up as shown. CTL320 MSOOFF ONE contains contains contains FD9Fh OOFFh 0001h The interrupt initialization code also includes the serial port initialization. The use of the serial ports within this application is covered briefly in DTMF Telephone Tester section. The following listing should also be referred to when reading that section. General-Purpose Tone Decoding and DTMF Detection 457 OUT CTL320,CTLPRT Sets lower 16 control bits to FD9Fh. This resets all interrupt flags, enables external and FR interrupts only, connects 110 port 1 to the upper control register, sets the XF output low, enables the serial port, selects and enables Alaw encooing/decoding and selects SCLK (serial clock) as an input. OUT CTL32U,CTLUPR Sets upper control bits to OCFEh. This sets SCLK to 2.048MHz, sets FR to 8KHz, selects sign magnitude companding and selects FR for fixed data rate operation. LAC CTL322 ACC SACL CTL320 Stores 7C90h back into CTL320, for future use. OUT CTL320,CTLPRT Sets lower control bits to 7C90h. This sets SCLK to be an output, connects 110 port 1 to the serial port companding hardware, selects internal framing and leaves other options unchanged. Note it does not clear interrupt flags. = 7C90h. Interrupt Handler - Entry When a valid enabled interrupt is received, program execution jumps to program memory location 2. In our code, this contains a branch to labelINTHDL which is at the start of the Interrupt Handler routine. This routine contains the detailed steps for handling a serial port interrupt or an external (host interface) interrupt. All that is explained here is the code concerned with interrupt management. SST SRSAVE Saves the current contents of the status register in data memory location SRSAVE. This is automatically in page 10f data RAM, regardless of the value' of the data page pointer. LDPK 1 Sets the data page pointer to page 1. SACH ACCUHI Saves the current contents of the accumulator in data memory location ACCUHI (data page 1). SACL ACCULO As above. LDPK 0 Resets the data page pointer to page O. SAR ARO,ARSAVE Saves the contents of ARO in ARSAVE (data page 0). LARP IN 458 '0 ITEMP ,CTLPRT Ensures auxillary register pointer is 0 for future indirect memory accesses. Stores lower order system control register in data memory location ITEMP (data page 1). General-Purpose Tone Decoding and DTMF Detection = LAC ONE,3 Loads 23 into accumulator, ACC AND ITEMP ANDs data in ITEMP with 0004h in order to test whether bit 2 in system control register is 1, (i.e. is it a serial port interrupt?). BZ NOTCDC If bit 2 not set, it is not a serial port (codec) interrupt and execution branches to the routine for external (host interface) interrupts. 0004h. Interrupt Handler - Exit All external interrupts return through the following path LACK ADDS 7 CTL320 Loads 7 into accumulator. Adds CTL320 (7C90h) to accumulator with sign extension suppressed as we are not dealing with two' scomplement numbers. ACC = 7C97h SACL ITEMP Store accumulator into ITEMP. OUT ITEMP ,CTLPRT Clears all interrupts except internal framing, leaves all other bits in system control register unchanged. Note only non-codec interrupts are cleared here. Codec (serial port) interrupts are cleared at the start of the codec interrupt routine. This is because the two interrupt sources are asynchronous. Thus it is quite possible for a serial port interrupt to occur during the external interrupt routine and vice-versa. It is essential that these "pending" interrupts are not lost during the handling of the previous interrupt. The codec interrupts join the external interrupt exit path here LAR ARO,ARSAVE LDPK Restores ARO value to that prior to entering interrupt routine. Sets data page pointer to page 1. ZALH ACCUHI Loads high accumulator with exact copy of ACCUHI. ADDS ACCULO Loads low accumulator with exact copy of ACCULO with sign extension suppressed to leave high accumulator unaffected. LST SRSAVE Restores status register value with that prior to entering interrupt routine. EINT Enables interrupts. This instruction always waits until the following instruction has completed execution so that interrupts are not nested. General-Purpose Tone Decoding and DTMF Detection 459 RET Returns program control to the point at which the interrupt occurred. SeriaJ Ports Serial port initialization occurs at the same time as interrupt initialization as both involve the use of the TMS320C17 Control Registers. This is covered in detail in the interrupt section above. This application uses a single serial input only. A TCM2917 codec chip operated in the fixed data rate mode is used to provide analog to digital conversion. A 2.048 MHz clock (SCLK) is provided by the TMS320C17 along with a framing signal (FR) giving a sampling rate of 8 KHz. With CDCPRT having been equated to one, data transfer is simply by the use of the following instruction IN Inputs data from liD port 1 which has been switched to accept serial input from the companding hardware by a previous write of a one to control register bit 8. Hardware Implementation The example outlined below is a possible design for a tone detection system as a peripheral to an IBM XT or AT compatible PC bus. Figure 17 shows the complete circuit schematic for this design. The circuit uses only four Integrated circuits to implement a full-functionality tone detector. The signals required from the PC bus are SAO - SA9 (latched address bus), DO - D7 (8-bit data bus), lOW (I/O Write), lOR (I/O Read), RESET DRV (System Reset), and AEN (Address enable forOMA). Figure 18 shows the PC bus activity for these signals during an liD operation. For more detailed information on the function and behaviour of these signals see References [3] and [4]. 460 General-Purpose Tone Decoding and DTMF Detection Cl I'll Vee Vee ;,. le3 I'll ~ "" . . ,1,,80'015 ~ 14 011 I'll C;3 1M PC Edge Connection 8 ~ '" ;,. ~ tl ~"li tl I'll ~ §. "!" 'N'''~ '" ;,. "" VF C IC4 CC ~~AA_.l17~ 014 ,,--~,,_-,,16"D13 ~~AA_.l15~D12 .;:; tl -- V ::;; .: I'll Vee 1-30 SCLK 5 A2 82 19 20 06 50S 6 A3 B3 18 21 05 504 7 A4 84 17 22 04 ~ SDa 8 AS 85 16 23 03 SD2 9 AS 86 15 24 02 ~ SOl 10 A7 87 14 25 01 SOO 11 ~ ~ ~ ~ 5 ~ ~ ~ -5V 83 Vee Vee B29 ' GND T :~~ lel ~~ ~ ~ 12 ~r3 ~ 14 ~15 ~16 ~17 ~18 ~'9 M CAB ~ 13 CBA~ ~ GSA GAB 22 SBA SAB ~ 74ALS652 I 26 00 ~ PA2 ,----2< 'NT I~ ~ ~ WRITE 02 -21 RESET 03 20 320WR 04 19 32DRD 05~ Rl ~ 9 elK AIN 14 7 VFC Me 3 Ne Ne XF~ Ne PDN ...l. DCLKR f PWRO- ~Irsx DGNO ( Vee r I TCM2917 1 PAO~NC PAl ~ Ne CLKOUT~ NC X2 -5V 8 RST Xl Xl r B 20oj48 7 MHz Vss TMS320C17110 (D2saoO)G~D Cl of ~J C2 10pF GND 06~'~7~______________~ 07~'~6-H------__________--J 08Y"- ~Ill ~"2 ~113 ~114 1L-_~----,2:::0.::LB=-_----l Reset Drv All pull-up resistors are 10 K ohms ~ 1 D A Ne..2 PWRO+ Me/PM 27 C --c 10 FSX ~ 9 10K St< T 13 AGND r'-----~ ~ FSR ~"0 ~ Input R2 34 810 DEN 31 WE ~ 22 116 Vee GSX BII FSR 3:9 FSX FR 37 010 09 S06 7. 6 PCMI OX1 ~ Ne ~>-~SQDL7_ _ _ _ _ _~4~A"''--BB,~2~O_ _~~1~9 07 ~ 11 PCMO DXO 35 ORl 33 ~ 08 le2 ORO 29 Figure 17. Tone Detector PC Application Circuit Diagram AEN~ SAO-SAg Valid Acldr... \~==~b========~=/• IS IOwrow "Inl________ • DO-D7(Read)_ DO-D7(WrH.)~~ Valid ~ Figure 18. PC Bus Activity I/O Read or Write The XF (external flag) pin of the TMS320C 17 may also be used to signal an interrupt on one of the PC bus lines IRQ3 - IRQ7 (Interrupt requests), if it is desired to have an interrupt driven and not a polled interface. The example shown is based on a polled interface and does not utilize host interrupt. Host Read/Write Decode The PAL (programmable logic array) can give a host read or write function at any address in the range 0 to 03FFh (hexadecimal). Only one I/O address is used by the tone detection system in this example. For use in a PC, any free address in the I/O space could . be chosen. The AEN signal is also passed to the PAL to ensure that the system is not mistakenly accessed during a direct memory access (DMA) cycle. Assume that the I/O address of the tone detector is 0300h. The equations for the host read and write strobes would be as follows: READ = A9 # A8 # A7 # A6 # AS # A4 # A3 # A2 # Al # AO # lOR # AEN = A9 # A8 # A7 # A6 # AS # A4 # A3 # A2 # Al # AO # lOW # AEN WRITE where # represents the logical OR function. TMS32OC17 I/O Read/Write Decode The PAL also provides the decode function for TMS320C17 IN and OUT (read and write) operations. A TMS320C17 read and a data write always use I/O port 4. A status write is made to port 6. Ports 0 and 1 are reserved for internal functions of the TMS320C 17. Other ports are not implemented in this system. The equations for a TMS320C17 read and write are as follows: 320RD = DEN & PA2 320WR 462 = WE # PA2 General-Purpose Tone Decoding and DTMF Detection Host Data Write Upon r~ceipt of the correct I/O address and the I/O Write strobe, the data present on the PC bus is latched into the 74ALS652 on the rising edge of liD Write. Simultaneously, an interrupt is given to the TMS320C17. As previously described, the TMS320C17 responds to this interrupt by performing a read operation from its input port 4. The TMS320C 17 read is implemented by PA2 being set high and DEN (data enable) acting as a read strobe. While data enable is low, the high-impedance outputs of the 74ALS652 are enabled and the TMS320C17 reads an 8-bit value. This contains the address of the register to be accessed and the readlwrite bit which is set to indicate a host write in this case. The read of port 4 is then followed by a write of the current contents of the status register from the TMS320C17 to output port 6. This is implemented by PA2 and PAl being set high and WE (write enable) being used as a write strobe. When write enable goes high to signify the end of the write, the data on the low order data bus (D7 to DO) of the TMS320C17 is latched into the 74ALS652. The second part of the host data write operation is an exact duplication of the above sequence of events. It would then be normal to read the status information returned at the end of the cycle. This is done by a simple liD read from the address of the board which enables the contents of the 74ALS652 onto the PC data bus. Host Data Read This operation is based on the same sequence of events as above, as indicated in Host Read Cycle section. Host Reset The active high RESET DRV signal is taken from the PC bus, inverted and applied to the TMS320C17 RS input (pin 4). Host Interrupt As mentioned briefly above, the TMS320C17 uses the external flag (XF) pin (pin 28) to signal an interrupt to the host. This interrupt may come from a number of sources as described in Control section. This signal is active low and is set to a high level after a reset to the TMS320C 17. There is a period of 2 ms after the release of reset for which the state of the interrupt should be ignored, as it is set inactive only by execution of the appropriate instruction. The state of XF is therefore undefined for the period between the application of reset and the execution of the instruction which initializes it to the inactive state. The easiest method to overcome this would be only to enable the appropriate host interrupt line at least 2 ms after the release of reset. General-Purpose Tone Decoding and DTMF Detection 463 Host Handshake There is no host handshake implemented on the example application described here. The maximum length of time which a single read or write can occupy is 20 p,s. The host should ensure that consecutive accesses do not occur more closely than this. Analog Interface This function is performed by an industry-standard combined PCM codec and line filter (COMBO), the TCM2917 (see Reference [5] which provides AID and DIA conversion as well as transmit and receive filtering. In this application the codec is set to a gain of 1. The TCM2917 performs A-law companding and operates in this circuit in the fixed data rate mode of 2.048 MHz. As this application was developed in Europe, the A-law companding TCM2917 was used. For applications in North America this may be replaced with the TCM2916 which provides p,-law companding and is pin-for-pin compatible with the TcM2917. There is a small change to be made to the area of program which initializes the control registers in the TMS320C17. This is covered in detail in Substitution of TCM2916 for TCM2917 subsection. The TCM2917 interfaces directly to one of the two serial ports on the TMS320C17 which were designed to facilitate the use of this type of device (see References [1] and [6] for further information). Host Interface The tone detector function described in this application note appears to the host CPU bus as a single 8-bit parallel port. This port is used as shown below to give access to the sixteen read and write registers within the TMS320C17. ' In the particular example presented here the interface is of the polled access type. An interrupt driven interface can be implemented by setting the appropriate bits of the tone detector control register and connecting the XF pin of the TMS320C 17 (pin 28) to a host interrupt input. Host Write Cycle The host CPU writes to one of the 16 shown in Figure 19. 464 avai1~ble registers by a four step process as . General-Purpose Tone Decoding and DTMF Detection cpu action 110 port latch· Output _He addre.. zero In RIW bit TMS32OC17 action ... ... Read addr... + RIW bH (32OC17 I/O port 4) Write current contents of status register (32OC17 I/O port 6) 4 Input current conten.. of statue .. ____ regis" (optional) Output data ... ... Read data (32OC17 I/O port 4) Write current contenta of statue register (32OC17 I/O port 6) 4 Input current contents of status 4 register Figure 19. Host Write Cycle The write cycle is initiated by an output from the host CPU to the 110 port or memory location occupied by the tone detector. The first byte of data transferred is a command byte which contains the address of the register to be written to and the read/write bit set to a zero to indicate a write operati?n. The bit assignment is as shown below. D7 D6 D5 D4 D3 D2 Dl DO 1 1 1 0 A3 A2 Al AO R/W Register address A3 is the most significant bit of the tone detector register number and AO is the least significant bit. General-Purpose Tone Decoding and DTMF Detection 465 Following this host CPU command the TMS320C17 will make the current contents of its status register available for input by the CPU. It is not usual for the host CPU to read the status information at this point. This is followed by a host CPU write of the data to be transferred into the tone detector register. The operation is completed by the TMS320C17, which again makes the current contents of its status register available. It would be normal for the host CPU to read this status byte from the 110 port at this time. Host Read Cycle The read cycle is initiated by the host CPU in a similar way to the write cycle above, and is shown in Figure 20. vo port latch CPUactJon TMS32OC17 action .. Output addr... and one In RIW bit .. Input data Output address zero and one In RIW bit Read addre.. and RIW bit (32OC17 110 port 4) .. Writ. data (32OC17 110 port 4) .. Write current contents of etatue register (32OC17 110 port 6) .. .. Input current content. of etatue ....- - regleter Figure 20. Host Read Cycle In this case, the read/write bit is set to a one to indicate a read. Following the initial host CPU write of the address, the TMS320C 17 makes the contents of the addressed register available for the host CPU to read. The cycle is completed when the host CPU issues a second register read request with an address of zero (status register) and the TMS320C 17 makes available the current contents of its status register for the host CPU to read. 466 General-Purpose Tone Decoding and DTMF Detection Host Access Considerations The host CPU may not attempt to perform any new access of a tone detector register before the previous access is complete. A read operation must be fully completed before a write is initiated and vice versa. Additionally, neither read nor write operations should be nested. Both the host read and host write should be regarded as discrete tasks to be executed in isolation from any other host access. A delay should be allowed between the host CPU writing the register address to the tone detector and reading the subsequent response (data for a read cycle, status for a write cycle). This delay should be a minimum of 20 J.ts. No delay is necessary between reading the response and performing a subsequent write operation, but a further minimum 20 J.ts delay should be allowed prior to the next read. This delay allows the TMS320C 17 to retrieve the correct data from its data memory, perform any necessary calculations and output it to the interface latch. Host Interface Registers Although the tone detector only occupies one physical 8-bit read/write host location, the full interface is implemented by sixteen read and write registers within the TMS320C17. Their allocation is shown below: Address 0 1 2 Read Register Status Write Register Control Mode Mode DTMF digit Envelope decay factor Upper threshold 3 Tone arrival (MS byte) 4 Tone arrival (LS byte) Lower threshold 5 Tone departure (MS byte) Filter length 6 Tone departure (LS byte) Passband width 7 Current time (MS byte) Change threshold 8 9 Current time (LS byte) Frequency (MS byte) Band 1 signal level Band 1 frequency (LS byte) A Band 2 signal level Band 1 frequency (LS byte) B Band 3 signal level Band 1 frequency (LS byte) C Band 4 signal level Band 4 frequency (LS byte) 0 E F Band 5 signal level Band 5 frequency (LS byte) Band 6 signal level Band 5 frequency (LS byte) Filter select Total signal level Where MS byte refers to the most significant (upper) byte of a 16-bit word, land LS refers to the least significant (lower) byte of a 16-bit word. General-Purpose Tone Decoding and DTMF Detection 467 Register Read Functions Except where specified all of the 'following read registers are set to zero by a hardware reset, Status D7 D6 D5 D4 D3 D2 ST DT TC TA TD DI DO ST- This bit is set to zero when the departure of a tone is detected by the envelope detector before it has been validated as a DTMF tone or a filtering operation has been completed on the tone. DT- This bit is set to zero when the occurence of a valid DTMF tone pair is detected. TC- This bit is set to zero when a change in tone is detected. TA- This bit is set to zero when the arrival of a tone is detected by the envelope detector, and the tone has been validated as a DTMF digit or a filtering operation has been completed on the tone, TD- This bit is set to zero when the departure of a tone is detected by the envelope detector. Each of the bits in the register are set to one by writing the appropriate value to the lACK bits (bits 2-4) of the MODE register (see Mode section). A reset will cause all of the bits of the status register to be set to one. Mode D7 D6 D5 D4 TEST DTMF TONE D3 IACK2 D2 IACKI IACKO DI DO RCI RCO Each of the bits in this register, except RCI and RCO, simply reflect the last value written to the corresponding bit in the mode register. RCI RCO These two bits together form the result code generated by a self test operation by the tone detector. The meanings of the result codes are as follows: RCI RCO o o o 1 I 468 1 o 1 Meaning Clock failure Test successfully completed RAM failure detected ROM failure detected General-Purpose Tone Decoding and DTMF Detection DTMF Digit D7 D6 D5 D4 OVRUN D3 D2 Dl DO DD3 DD2 DDl DDO OVRUN- This bit is set to one when there has been an overrun of received DTMF digits, ie. a new digit has been received when the DT bit in the status register was set to zero (before the host has acknowledged the receipt of a previous digit). OVRUN remains set to one until a DTMF digit is received while the DT bit in the status register has a value of one. The digit indicated by DD3-DDO is the last received digit regardless of the state ofOVRUN. DD3 toDDO These four bits together identify the last valid received DTMF digit. The digits are identified as follows: DD3 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 DD2 DDl DDO Received Digit 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 2 3 A 4 5 6 B 7 8 9 C * 0 # D Tone Arrival (MS Byte and LS Byte) The two tone arrival registers are read by the host CPU in conjunction. They report the time at which the arrival of a tone was detected. The l6-bit value formed by (256 X MS) + LS is treated as an unsigned integer giving the time at which tone arrival was detected in milliseconds. This time is taken from the contents of the current time register (see Current Time section) at the moment of the tone arrival being recognised by the power detector. General-Purpose Tone Decoding and DTMF Detection 469 The tone arrival registers are updated when either a DTMF digit is detected, or a filtering operation is completed. Tone Departure (MS Byte and LS Byte) The two tone departure registers are read by the host CPU in conjunction. They report the time at which the departure of a tone was detected. The 16-bit value formed by (256 X MS) + LS is treated as an unsigned integer giving the time at which tone departure was detected in milliseconds, as taken from the current time register. Neither the tone arrival or tone departure registers are updated by the arrival or departure of a short tone, i.e. one which had departed before being recognised as a DTMF digit, and before a tone receiver filtering operation had been completed on it. Current Time (MS Byte and LS Byte) The two current time registers are read by the host CPU in conjunction. They report the current time indicated by the tone detector module. The 16-bit value formed by (256 X MS) + LS is treated as an unsigned integer giving the current time in milliseconds. Reading the current time (MS byte) register causes the value of the current time (LS byte) register to be copied into a holding register. In order to get a correct reading of the full 16-bit value of the current time the MS byte should therefore be read first. When current time reaches the maximum value of 65535, the next increment takes it to zero. The current time increments every millisecond upon release of hardware reset. Band 1-6 Signal Level The signal levels received in each of the frequency bands specified are reported in these six frequency band signal level registers. The values read from these registers are to be interpreted as 8-bit unsigned integers, SL. If a value of SL is read from a register, then the signal level represented is: (5.30 X SL) mV rms (root mean square) GAIN See Mode subsection in Host Interface section for a description of the gain factor (GAIN). Typical values which may be read are as follows: SL = 470 SL Signal Level Codec Level 40 254 212.0/GAIN mV rms 1346.0/GAIN mV rms + 2.0 dBmO - G dB -14.1 dBmO - G dB An input signal level of greater than 1346/GAIN mV rms will result in a value of 255. General~Purpose Tone Decoding and DTMF Detection When the DTMF bit in the mode register is set to one, the values read from Band Signal Level Registers 4 to 6 are all zero as only three frequency bands can be monitored while the DTMF receiver is active. The DTMF bit must be set to a zero if bands 4 to 6 are to be monitored. Total Signal Level The signal level received over the frequency range 300 Hz to 3400 Hz is reported in the total signal level register. The number format is identical to that described for the band 1-6 signal level registers. Register Write Functions Except where explicitly stated, a hardware reset will set each register to zero and, when the contents of any register are changed, the tone detector uses the new value immediately. Control D7 Dl DO Writing a one to any of the bits in the control register enables an interrupt to be signalled on the XF pin of the TMS320C 17 when the corresponding bit in the status register is set to zero. Mode D7 D6 D5 TEST DTMF TONE D4 IACK2 D3 D2 lACK 1 IACKO Dl DO GFl GFO The functions of the bits in the mode register are as follows: TEST- Writing a one to this bit starts a self test operation. The result of the test is reported in the lower bits of the mode register. As long as TEST is a one the tone detector remains in the TEST mode and no register accesses may take place. The self-test is terminated by writing a zero to TEST after which the tone detector is left in the default state assumed after a reset. A self test operation takes approximately 6 ms. DTMF- Writing a one to this bit enables the detection of DTMF digits. On entering the active state, the DTMF receiver begins looking for DTMF digits as though it had been monitoring a silent line in the recent past. TONE- Writing a one to this bit enables the detection of tones. When the tone detector is turned on, it will wait for the envelope detector to indicate that a tone is present before starting filtering operations. General-Purpose Tone Decoding and DTMF Detection 471 IAtKOto IACK2 The pattern written to these bits selects which of the five possible interrupt conditions from the tone detector module is being acknowledged. The acknowledgement of an interrupt causes the corresponding status bit to be set to the one state. The selection patterns are as follows: IACK2 IACKI IACKO 0 0 1 1 1 1 1 0 0 1 0 1 0 1 0 Interrupt to be acknowledged Tone Departure Tone Arrival Tone Change DTMF Digit Arrival Short Tone (TD) (TA) (TC) (DT) (ST) Other patterns have no effect GFI-GFO- The two bit pattern written to these bits selects which of three gain factors is applied to the input signal before it is passed to the DTMF and tone receivers and the envelope detector. By writing a suitable value to these bits, it is possible to adjust the tone detector module to accommodate very loud or very quiet signals. The selection patterns are as follows: GFI GFO Gain Factor (GAIN) Relative Gain (G dB) 0 1 1 X 0 1 4 1 16 12 0 24 Envelope Decay Factor The time constant of the envelope detector is the time taken for the output of the detector to reach 63 % of its final value. The value written to the envelope decay factor register is treated as an 8-bit unsigned integer, EDF. If the time constant required for the envelope detector is t, then EDF should be specified as EDF = 1024 X [1 - exp( -11(800Ot»]. For example for a time constant of 1.0 ms, EDF should be set to 120. A reset will cause this register to be set to a value of 120. 472 General-Purpose Tone Decoding and DTMF Detection Upper Threshold The upper threshold is the signal level at the output of the envelope detector at which the arrival of a tone is recognized. The number written to the upper threshold register is treated as an 8-bit unsigned integer, UT. If the signal level required for this threshold is Vut Volts rms, then UT should be specified as UT = 254 x (0.743 x GAIN x Vut) For example for an upper threshold of 425/GAIN m V, UT should be set to a value of 80. This represents a codec input of -8.0. dBmO - G dB. A reset will cause this register to be set to a value of 255. Lower Threshold The lower threshold is the signal level at the output of the envelope detector at which the departure of a tone is recognized. The lower threshold is specified in exactly the same way as the upper threshold described above. If the value programmed into the lower threshold register is larger than the value programmed to the upper threshold register, the value in the lower threshold register is taken as the threshold for both tone arrival and tone departure. A reset will cause this register to be set to a value of 255. Filter Length The filter length register defines the number of samples of the input signal which are required to produce one result from the tone detector. The rate at which the codec feeds samples to the tone detector is 8000 samples per second, or one sample every 125/Ls. The value which is written to this register is treated as an 8-bit unsigned integer, FL. The length of filter specified by the value FL is 16384 FL + 16 + 1 = N samples For example, for a filter length of 410 samples, FL should be set to 24, giving a fllter duration of 51.3 ms. The filter length defines the steepness of cutoff at the filter band edge. Figures 21 and 22 give an indication of the filter band edge shape for both wide filters and narrow filters of different lengths. They should be treated as indicative of the performance of the tone detector. General-Purpose Tone Decoding and DTMF Detection 473 o r::: ~ r.:a.. 10 ~ I-... '\, ," "\ \ \ m 20 'tI C 0 "' 30 CD ~ ~ :;:: ::J C ......... ~ 40 I3--EI Length 200 ~Length400 ~Length800 50 -50 -40 -30 -20 o -10 10 20 40 30 50 Frequency Deviation Hz Figure 21. Filter Band Edge Shape - Wide Filter ... .... 0 ~~ 1\ 10 m 'tI c -... IlL. t\. \ \ 20 1 0 i::J C ell ~ 30 ~ I'.... Length 400 v---'V Length 800 ........ '" "" "- ~ \ l 40 G--EI Length 200 *-4( ~ " '- 50 o 10 20. 30 40 50 60 70 $0 90 100 Frequency Deviation Hz Figure 22. Filter Band Edge Shape ~ Narrow Filter 474 General-Purpose Tone Decoding and DTMF Detection When contents of this register are changed, the tone detector waits until the start of the next ftltering operation before using a new ftlter-length value. A reset, will cause this register to be set to a value of 50 (250 samples). Passband Width The bandwidth of the bandpass ftlters used by the tone detector is specified by the passband width register. The value which is written to this register is treated as a 6-bit unsigned integer, PW. If a bandwidth ofY Hz is required, then PW should be specified as: PW = Y X 0.128 The maximum permitted value for PW is 63, giving a passband width of 492 Hz. The bandpass ftlters used by the tone detector are symmetrical about the center frequency, i.e. a bandwidth of X Hz defines that frequencies which deviate by up to X/2 Hz from the center frequency fall within the passband. Change Threshold At the end of each filtering operation (except the first after tone onset) the signal received at each of the monitored frequencies is compared against the signal received during the previous ftltering operation. If the signal level at anyone of the monitored frequencies has crossed the signal level threshold defined in the change threshold register, then the Tone Change status bit is set in the status register. The change threshold is defined in an identical manner to the upper threshold described above. When the contents of this register are changed, the tone detector uses the new value of change threshold on the next signal level comparison. Frequency (MS Byte) The 8-bit value, FMS, written to the frequency register (MS byte) forms the most significant byte of the 16-bit specifier of a ftlter center frequency. When a value is written to one of the frequency (LS) registers, the current contents of frequency (MS) is concatenated with the 8-bit LS value defined below to form the 16-bit frequency specifier. The frequency (MS byte) register must therefore contain the desired value when the LS byte is written. Genera/-Purpose Tone Decoding and DTMF Detection 475 Band 1-6 Frequency (LS Byte) The 8-bit value, FLS, written to one of the band 1-6 frequency (LS byte) registers is concatenated with the 8-bit value most recently written to the frequency (MS byte) register to form the 16-bit specification for the filter center frequency. If a center frequency of G Hz is required, then FMS and FLS should be specified as follows: (FMS x 256) + FLS = 8.192 x G or FMS = (8.192 X G) div 256 and FLS = (8.192 X G) mod 256 Filter Select D6 D5 D4 D3 D2 Dl DO Fl F2 F3 F4 F5 F6 07 1 I Writing a one to any of the bits in the filter select register causes the corresponding filter to adopt the passband width specified by the passband width register (wide filter). Writing a zero causes the filter to adopt a zero passband width (narrow filter). A reset will cause each of the bits in this register to be set to one. Applications and Customization The combination of a programmable tone receiver and a CEPT DTMF decoder in a single chip opens up a wide range of potential applications. The operation of the device across the 300-3400 Hz band targets its use towards telephony, but this is by no means the only area to which it can be applied. The examples shown here are chosen from the more obvious potential applications. Some examples do not utilize the full power of the system, but they will hopefully serve to illustrate the capabilities of the tone detector and act as a stimulus for the development of innovative designs. Secure Off-Site Control The tone detection system described may be used within a secure off-site control system. An increasing amount of such equipment is now available, designed to respond to commands given remotely via a telephone line, as shown in Figure 23. These commands are typically a single or a sequence of DTMF tone(s), and may be supplemented by special tones. 476 General-Purpose Tone Decoding and DTMF Detection System under Control ---, Tone I Detector I e.g. Bank computer Flood barrier etc. Figure 23. Secure Remote Controller The level of security required varies with each type of equipment depending upon its function. For example, a home answering machine does not require a high level of security to protect its stored messages from being replayed to a remote telephone. At the other end of the scale, it is clearly important that financial information or transactions be heavily protected in the new remote banking systems now becoming available. Sequences of DTMF tones of varying lengths with various intervals provide one level of security which would be more than adequate for remote activation in the case of the home answering machine. However, DTMF tones are limited by definition to a set of sixteen tones making computer coiltrolled attack (hacking) of any equipment relying on them for protection relatively easy. The method of protection used for cash-cards, etc., where three unsuccessful attempts at breaking a code (the personal identification number, or PIN) result in a machine refusing to return the card is not feasible in that any remotely accessed system must be ready to respond to its authorized user at all times. The system cannot just shut down if it suspects it is under attack from an unauthorized source. One way of providing the protection needed would be to make the number of possible combinations of activating tones impractically large for any systematic hacking. This could easily be achieved by extending the number of tones capable of detection beyond the sixteen provided by. DTMF. The tone detector presented here makes just such a scheme possible by providing capability for the accurate detection of a single frequency or any combination of up to six simultaneous frequencies within the telephony band. With the added variety of variable lengths of tone presence and absence, and sequential combinations of different tones, it is clear that a very high level of security can be offered. The tone detector offers time stamping of tone arrival, tone change, and tone departure and would thus make it easy for any equipment to which it is attached to decide whether or not to allow access. General-Purpose Tone Decoding and DTMF Detection 477 Call Monitoring Call monitoring functions may be implemented using the tone detection system described here. Across the various telephone companies in the world, there is a large variety of call progress tones used. It may also be useful to decode other tones received down a telephone line. An example might be for an answering machine to detect the fact that it is accidentally being called by a modem, or for auto dialing equipment to detect that it has accidentally called a modem. The ability to decode national call progress tones and other random tones received is of particular use in, for example, a PC with an integral telephony function. Here a range of actions may be expected of the PC depending upon the exact nature of the received tone. This application relates directly to the design example presented in the Host Interface section where a four-chip solution is shown for a PC tone detection peripheral. DTMF Telephone Tester Using the general purpose tone detection function, a low-cost DTMF telephone tester could be built to check the conformance of a telephone, or any other fixed tone generator, to a particular standard. With programmable center frequency (to a resolution of 0.12 Hz), programmable passband width and filter cut-off, a precise measure of an incoming tone for conformity is easily made. In a laboratory environment this could again be implemented as a peripheral to a PC. If required, the TMS320C17 could also easily be controlled by any general-purpose 8-bit microcomputer to provide a low cost portable programmable tone tester. Customization for User Applications The source code for the TMS320C17 program described here is presented as Appendix A. The code takes up less than half of theon-chip ROM and allows space for user application code to be included on-chip for low chip-count solutions to a number of complex tone decoding tasks. The TMS320E17 EPROM digital signal processor can be used for the development phase and low-volume manufacturing. For high-volume production, code can be masked onto the TMS320C17 to provide a custom DSP. To aid integration of additional application code, certain functions of the device are not utilized by the existing source code. Of most importance is the BIO pin (pin 9) which is effectively a software interrupt. By simple insertion of a BIOZ instruction, code execution could branch to special application routines. The XF (external flag) pin of the device is used to signal an interrupt to the host. If (as is the case in the design example in· this report) this function is not used, it is simple to reprogram the function of this pin for any desired purpose. 478 General-Purpose Tone Decoding and DTMF Detection The following notes apply to any customization of the tone detector source code: 1. The correct execution of both the DTMF receiver and tone receiver functions is dependent upon certain time critical functions. Care should be taken to ensure that any change made to the code does not affect the clean handling of the continuous stream of samples from the codec. 2. Any change to the ROM code will require a corresponding change to the checksum word at program memory location 0004h (label CHECKS at bottom of page 489 of the source listing in Appendix A). The checksum test routine (see page 516 of Appendix A) sums all the program memory locations in the code and tests the lower 16 bits of the final sum for zero. It is important to maintain this zero result by adjusting the checksum word. Alterations that may be made to the tone detector include: • Substitution of TCM2916 for TCM2917 in North American applications • Use of the coprocessor port for parallel I/O • Use of either DTMF or tone receIver code in isolation Substitution of TCM2916 for TCM2917 To change the TCM2917 codec for a TCM2916 requires only a small alteration in the program code. The only difference between the TCM2917 and the TCM2916 is that the TCM2917 performs A-law compression of its serial PCM data prior to output, and the TCM2916 performs /L-Iaw compression. The TMS320C17 can decode either Wlaw or A-law encoded data. The choice between /L-Iaw and A-law is made by the value written to bit 14 in the TMS320C17 control register. The lower 16 bits of the control register are set by writing data memory location CTL320 to output port zero. CTL320 is initialised with a value of FD9Fh in the existing code, with bit 14 set to a one (A-law conversion). Changing this initial value to BD9Fh will ensure bit 14 is set to a zero (Wlaw conversion). The change to a value of BD9Fh should be made by altering the statement .word FD9Fh ; CTL320 (second statement below label CONST! at the bottom of page 490 in Appendix A) to .word BD9Fh ; CTL320 within the source file. General-Purpose Tone Decoding and DTMF Detection 479 Use (Jf C(Jprocess(Jr P(Jrt f(Jr Parallel 110 The TMS320C 17 features a coprocessor port which provides a direct interface to most 4/8-bit microcomputers and 16/32-bit microprocessors. It is possible for the tone detection system to make use of this port for connection to a variety of possible host CPUs. Figure 24 shows a simplified logic diagram for the coprocessor port. Note that RBLE, TBLF and BIO are not necessary to the tone detector interface as it uses single byte transfers only. In ./ I - 11 ~ =- ~ I I PRE n 0 ~ PRE In from PAS O~ 0 I Out to PAS PRE PRE * 0 01- ,., F O I V 16- L01S-LOO I I I I I I OE 0 0--Hi OE' ... 16- 0 0 .... ~ 16.r 015-00 Figure 24. TMS320Cl71E17 Simplified C(Jprocessor Port Logic Diagram For full details of the coprocessor' port refer to the First Generation TMS320 User's Guide (Reference [1 D. As an example this section considers an 8-bit interface, as may be required by a TMS7000 8-bit microcomputer. 480 General-Purpose Tone Decoding and DTMF Detection · Coprocessor mode is selected by setting both the MC/PM input (pin 27) and the MC input (pin 3) to low. Bit 30 in the TMS320C17 control register selects either a 16-bit or an 8-bit interface. This should be set to zero for an 8-bit interface. Connections to the TMS320C 17 coprocessor port should be as shown in Figure 25. TMS320C17 TMS7000 MC 3 27 MC/PM 2 HI/LO CLKOUT 6 31 WR 32 RO L07 L06 L05 L04 L03 L02 L01 LOO 19 20 21 22 23 24 25 26 -:.= 17 XTAL2 7 A1 9 A3 19 20 21 22 23 24 26 27 07 06 05 04 03 02 01 00 Figure 25. TMS320C17 to 8-Bit Microcomputer (TMS7000) Interface The coprocessor port is accessed through 110 port 5 in the TMS320C17, and all parallel 1/0 IN and OUT instructions should be changed to access this port. In the listing file in Appendix A, IN instructions are from port 4 and OUT instructions are to either port 4 or port 6. All of these operations are within the interrupt handler section, INTHDL (see page 510 of the listing). Data transfers in coprocessor mode operate on the same basis as presented in Host Write Cycle and Host Read Cycle sections, but the host CPU write and read sub-cycles operate differently. Transfers to the TMS320C17 operate as follows: 1. The WR signal is driven low by the microcomputer using a single 110 bit. 2. Data present on the LD7-LDO bus is written to the receive buffer latch (D7-DO) when the WR signal is driven high by the microcomputer. 3. An internal EXINT signal is generated, causing the interrupt flag to be set in the TMS320C17. General-Purpose Tone Decoding and DTMF Detection 481 4. The TMS320C17 responds to this interrupt condition in exactly the same way as the present code does, by executing the interrupt handler and exeeuting an IN instruction (from port 5 in this case). Transfers from the TMS320C 17 use the following sequence: 1. The TMS32OC17 writes 8 bits of data to the transmit buffer latch (D7-DO) with an OUT instruction to port 5. 2. At some point after this, the RD signal is driven low by the micro-computer using a single 1/0 bit. 3. Data is driven from the transmit buffer latch (D7-DO) to the LD7-LDO bus until the RD signal is driven high by the microcomputer. This interface may be further enhanced by implementing hardware handshaking between the TMS320Cl7 and the microcomputer, using the RBLE and TBLF signals from the TMS320C17. Use of DTMF Receiver or Tone Receiver in Isolation This application report describes an integrated DTMF and tone detection system. Both the DTMF receiver and tone receiver may separately be enabled or disabled (see Mode section), but the code for both is resident at all times. For any application requiring only the DTMF receiver function or only the general-tone function, ROM space can be saved by removing the unwanted code. Due to the complexity of functions such as timestamping which are shared by both the DTMF receiver and the tone receiver, it is not feasible to describe a complete solution, but some of the major considerations are outlined below. Note all subsequent page references are to the page number of the listing file given in Appendix A. The DTMF code section cali be removed from the program without significant modification. The DTMF code is very self-contained and is executed as a single block, with few external calls to subroutines within it. The test for the DTMF bit in the mode register should be removed from the end of the routine MAIN (see page 492). Calls to the DTMF reset routine RSDTMF should be removed from the cold reset routine (CRESET on page 514) and the self-test routine (SLFTST on page 516). The DTMF routine may then be removed completely (pages 504 to 510). DTMF constants may be removed, and the data memory locations they were loaded into used for other purposes. Care should be taken to ensure that the correct initialization of locations required by the tone receiver is not disturbed. The section in the warm reset routine (WRESET on page 514) which initializes DTMF data memory locations in page 1 should also be removed. 482 General-Purpose Tone Decoding and DTMF Detection The tone receiver section is far more complex and cannot be removed as easily. Because the DTMF receiver relies upon certain of the ancillary functions of the tone receiver, these must be left intact. The routines which can be removed are: FILTER CHNGS LVLS COMPLT RSTFIL SQRT (pages 496 (page 501) (pages 501 (page 502) (pages 502 (pages 503 to 499) and 502) and 503) and 504) Associated data memory locations and initialisation values may also be removed. Care should be taken to check all remaining sections of the code for references to code or memory locations which have been removed. This applies particularly to the following routines: CRESET WRESET SLFTST INTHDL ENVDET (pages (pages (pages (pages (pages 514) 514 and 515) 516 and 517) 510 to 513) 494 and 495) It is recommended that these changes are not attempted without an in-circuit emulator for the TMS320C 17. This can be used to trace program execution and, with its powerful hardware breakpoint facilities can readily debug the modified source code. For anyone who wishes to investigate the possibility of customizing the code presented here and does not feel capable of taking on the development work, there is a U.K. company who may be willing to help on a consultancy basis: Ensigma Ltd. Archway House Welsh Street Chepstow Gwent NP65LL Wales Contacts: Dr. Mike Carey Adrian Anderson Telephone: (44) 291 625422 0291 625422 (International) (Within U.K.) Flexibility Through Programmability Due to the programmability of the tone detector, this solution is not bound by the constraints of a custom hardware solution. Although the DTMF decoder performance is targeted to the CEPT recommendations, the tone receiver is dynamically re-programmable to suit a wide variety of incoming tones across a range of applications. General-Purpose Tone Decoding and DTMF Detection 483 A simple tone detection system comprising no more than four chips may thus be controlled by a PC or a single chip 8-bit microcpntroller to perform any of the tasks described by merely re-programming the on-chip registers of the TMS320C17. . Conclusion This report has presented a high-functionality DTMF and general tone decoder. The application as described has been fully tested and incorporated into a commercially available telephony peripheral. Information has been presented which allows a designer to incorporate the tone detector function into a product. A full source listing is included in this report for customization. Performance characteristics for any customized version may vary from those given here. The objective has been to describe both a particular implementation of the tone detector and provide a level of insight for further development. In order to keep this last part as simple as possible the mathematical detail has been kept to a minimum. If a detailed explanation of this aspect is required Ensigma Ltd. should be approached (see Use ofDTMF Receiver or Tone Receiver in Isolation section). References [1] TMS320 First Generation Digital Signal Processors Data Sheet, Texas Instruments Incorporated. Literature # SPRSOO9A, January 1987. [2] Understanding Telephone Electronics, W.Sams Inc. [3] Technical Reference - Personal Computer AT, International Business Machines Corporation, September 1985. [4] Technical Reference - Personal Computer XI, revised edition, International Business Machines Corporation, March 1986. [5] Telecom Circuits Data Book, Literature # SCTDOOIA, Texas Instruments Incorporated, 1987. [6] First Generation TMS320 User's Guide, Literature # SPRT013A, Texas Instruments Incorporated, 1987. 484 General-Purpose Tone Decoding and DTMF Detection c;) HHHfttHtHHHllHfttHHHHHfttHtHHlfHHHHtHfltHHHHHHHHt ~ TIIS32OC17 srulCE COlE FOR T!l£ DETECTOR I'IIOOI.E '"~ COPYRIilItT (el TEXAS INSTRUl£NTS June 1m, lIoy 1987 RCO Rei ;p IlumN BY ENSIt1I1A LTD. ... "g RE~ISION 2.00 NOV 1988 '" ~ TONEST H**HtlfHIHHtHHfIHlHfI4HfHtHHl****HHftHHHHfIHHHffHfHH :: '" t:::t ~ &. S' OQ :::. :: :::: ;:::i ~ ~ ..... HHHffHffIHfH*fHffHHHHHHH+HHfHfHH4HflH'IHfIHtHHftHtHI PORT DEFINITIONS CTLPRT CTLll'R COCPRT ATTPRT PRI1PRT DATPRT STAPRT SIII"RT ••• t •set •set .s.t •s.t • set •.,t •set , , ; ; ; ; ; ; ~ '" ::::-. CQNTROL PORT IJ'I'ER CONTROL PORT CODEC PORT STATUS ATTENTIIlN PORT SIIIl..ATtIl INPUT PORT DATA PORT STATUS READ PORT SIIUATOR FLAG PORT FLAG POSITIONS IN FLAGS REGISTER TPRFLG IlNSFLG FSTFLG STIIFLG DTllFLG .s.t .set .,.t ... t •'et IS 14 13 12 11 TONE PRESENT ONSET TII£ ~AL1D FIRST 8LOCK OF FILTERING INTERRUPT IWIDlER STATE BIT ; DTI1F ON FLAG INTFLG .,et 10 ; INTERRUPT I'J\S 0CClIRfruI RESI RES2 FILTI FILT2 FILT3 FILT4 FIllS FILT6 •.,t • s.t .,.t •s.t .,.t .set •set .s.t PAGE! .set ; , ; ; ; ; ; ; ; ; ; ; RESER~D RESER'iED LE~EL I ABO~ ~ 2 ~ LEm 3 ABO~E ~ 4 ABWE LEm S ABWE ~ 6 ABWE CHANGE CHANGE CHANGE CHANGE CHANGE CHANGE WRRDY DPINBT OSINBT CHINBT DTINBT STINBT .set .,et .set ••et ••et .,.t .s.t •,.t CPCBIT "'" 00 VI • set .s.t ... t .s.t •set •s.t .set 10 11 12 13 14 C(ffTR(L BIT , , , , , , SELF TEST RESULT SELF TEST RESULT RESERVED RESERVED RESER'iED TIJE DETECTOR 1lN/1FF BIT ; DTPF IETECT~ OOOFF BIT , SEl.FTEST IN.Y 1lN/1FF BIT I NA (iAterfaCt CJoly) 9 10 , NA !interfote onlyl ; Tone Depart interrupt , To.. On .. t interrupt , T.n. Chang. int."upt , DTIF Digit interrupt ; Short Tone interrupt ; Re,.rved 11 12 13 14 IS EQUATES FOR SELF TESTS ROIIFAI RA/tFAI PASS COCFAI ACCHLD TOTIII. RO/WAL •.,t .s.t .s.t ... t .,.t .,.t •,.t C ; t=' ~ 'C C ~ ..... 00 .... f") ACCESSES REQUIRING SPECIIII. PROCESSING. THE FUNCTION OF EACH BIT IS IESCRIBED lIEL~. Q., 512 1024 2048 4096 8192 16384 ; ADORESS OFFSET FOR DATA PAGE I RWBIT LBIT UBIT !BIT FBIT S8IT .s.t • s.t .stt • s.t ... t .s.t "C5 = a.. g > ~ •set .s.t • .,t •set •set > _ ~ _ n THR TIll THR TIll THR TIll PORT I COOTROL BIT EX~ FRAIIING BIT IF OUTPUT LATCH BIT SERIAL PORT ENABLE BIT COIIPANIER OCODE ENABLE rot'ANDER DECODE ENABLE F-UlW, HAW SELECT BIT .....::I ~ ~::~~~~=~.~~~S=I: :r~~~ ~~~=N~~CATE SHIFTS FOR CEFBIT CXFBIT CSPBIT CEEBIT COEBIT CtIAIIIT ; SERIAl. ClOCK .,et • 'et • .et • .et ••et ... t • set .,et .Sft OSOh 15 ~REG~_ * RmDY 'oJ g Dnu=BT TESTBT ASSEllBLER EQUATES FOR T!l£ IETECTOR * •set rIlDE REGISTER BITS ';'- ~ CSCBIT TESTI~ 4 9 10 11 12 13 11£ REGISTER I1APPI~ BITS READ ACCESS OF REGISTER ACCESS OF ADDRESS 0 DR 1 ACCESS OF AN UPPER BYTE READ OF ClRlENT TIlE WRITE OF FREIII£Ii:Y ~ BYTE READ IF STATUS REGISTER C ~ ~. oj:>. ISIT 00 .set 14 ; WRITE TO I9JlE REGISTER .bss QUEUE,a .bss .bss ,bss .bss TE/lP3,1 ITEIf>,I CI!SIWE,I ARSAVE,I .bss WINDOW,I .bss .bss SNCWIN,I FILPOS,I .bss .bss IU.OW BETl4EEN 515 AND 715 IILE CYClES ElEEN CllIIEC INTERRUPTS 0\ ••• t ••et INTftAX INllIIN om 056h rlAXlM AND MINIItIIt _ OF YALID TRANSITS OF 1.OIl'lI IF CllIIEC IS INTERRUPTING PROPERLY ; ; ; ; ; ; CIRCtLAR Iltm FOR LII£ARIZ£D INPUT SAIf'1.ES SCRATCH LOCATION INTERRUPT HANIX.ER SCRATCH LOCATIIlI INTERRUPT HANIl.ER COIV1ANlI BYTE SAVE INTERRUPT HANIl.ER AUXILIARY REGISTER 0 ; SAVE LOOP LENGTH IS b CYCLES ••et INTLFT UNTrlAX-INTMIN) ; MINIM NIIIBER OF RElfAINING TRANSITS HfHHlffHHHfltffHHHfflHtHffHHHHHftlHHlllllllllllllfHHfHHH * ; HffHUfHHHff*ItHfHH4HHfllllllllllllllllllfHffHffffHfHtHHHfH .bss ACIINil,1 ACIINLO,I ACSIIlI,I so .bss ACSI«.O,1 ASSEIIBLER EIlIJATES FOR DTMF PROGRAM TlISTLO C) ~ ~ 'ti<:> .~ C' ::s no TIISTHI TIIlHLI •set .set ODAh 640 SCALING FACTOR SCALINl FACTOR MINII1\JI SAIf'1.E MINli'!LIt SIGNAL 2.5.2H8 .set 2048 034h TWRESHDLO COUNT FOR 2ND ORDER .set ,set .set THRHl.2 TWilHL3 TWRHL4 THRHHI TIfMl2 TWRHH3 LOLIM HILIM MIN . itt O6AOh O38Oh 120 .set • set Z SCNT HINTH ~ .set .set •set .set .set .set .set ~ .set FOR INPUT FOR T~ W OIl ~ t:;, ~ "li t:;, ~ g' ; ; ; ; ; ; WINDOW SAIf'1.E REAl) FRtlI RtlI TAlilf. 2<>15 FORI! SIN(X)/X • WINDOW PRODOCT. 2<>15 FORI! ClRREIIT ILOCl( FILTERING POSITION [COUNTS UP FRtlI -16384 TO +16384 IN STEPS OF 12FL + 3211 HIIl1 WORD OF 328IT WINDOW ACCUtlATIlRS LOW WORD OF 328IT WINDOW ACClIU.ATIlRS HIIl1 WORD OF 328IT SINIXI/X. WINDOW PRDDOCT ACCUIUATORS LOW WORD OF 32BIT SIN ,I ; (MITY , SCRATCH LOCATlIlI TEMPl,l TEII'2,I , SCRATCH LOCATION ; SCRATCH LOCATION SAMPLE,I ; ClRREIIT LI/£ARIZED INPUT SAIf'l.E SHARED ; WITH DTMF THE FDLLIlWIMl LOCATIOO MY lIE AT All AIIIIlESS ENDINl IN , POINTS TO NEXT FREE QlEIJE INPUT LOCATlOli ; POINTS TO NEXT AYAILAlilE LII£ARIZ£D , SAIf'1.E III QUEUE ; CORRECTION FACTOR FOR SINE AND cos = a ; ; ; ; ; ; ; ; ; , ; CONSTANT USED IN THE SINE COSINE RruTINE. SCALE FACTOR FOR SCALINl A-lJIII LINEARIZED INPUT SAIf'1.E INTO AN OPTIMAL tUIlIER RANGE. THE INTERNAl. SAIf'l.E HAS THE YALUE ISCALEF' 2.25 • L1NEARIZED(ALAWI 141. THE STARTUP VALUE FOR SCALEF IS 4, BUT TWO OF THE BITS IN THE MODE REGISTER rlAY BE USED TO SElECT SCALEF = 1,4, OR 16. SCALEF =4 GIVES TO/£ lETECTOR DYNAltIC RANGE SUCH THAT 001flJT OF 254 == -10dBoO. THE OTHER SCALEF YALUES MOVE THE Il'INAIIIC ; _ C) ~ ;:, .bss ... ~ ." ::; ~ Cl ;:, ~ t:::l ~ (') 0 ."" ;:;' ()Q ." ;:, ."" ~ VALUE .bss STItODE,I .bss FLSTOO,I .bss UPRTIfl,I .bss LIllTIfl,I .bss EOFCT,I .bss FIISFL,I ,bss FSPW,I ~ ; STATUS REGISTER (UPPERI AND ItIlE REGISTER ; (LOWERI ; LJI(A.E OF FL SAVEO TO PREVENT UPDATE ; MING FILTERING ; lPPER ENVEUfE DETECTOR THRESKIlD IN ; LCAiER BVTE ; Lilloel ENVELIl'E DETECTOR THRESKIlD IN ; LOoIER BYTE , ENI'ELOPE DECAV FACTOO (lI'PERI CHAI«i: , THRESHOLD (UIlERI ; UPPER BYTE OF DETECTOR CENTER FREQUENCV ; IN lIPPER, ~D FL IN LOoIER BVTE. FILTER : LENGTH IS (4' FL + 11 , FILTER SELECT (lI'PERI AND PASSBAMI WIDTH , IENDI-IVARI IS THE LENGTH OF THE PAGE 0 , INITIALIZEO VARIABLES SECTION (') fHffHHH:lfH*HHHutHHHfHUtHffHHHffHfHHHtffHfHHtH-HHH ~INITIALIZEO VARIABLES FOR TONE DETECTOR ttHfHfHtfHHtHfHfffHIHHHHH++HfHHHHtHffH.fffffHfHHffH+' .bss .bss IENDI,O OSTHE,I I!JllI.lO 65530 AND RELATIVE TO END Of LAST RESET .bss .bss .bss .bss IPTltE,1 CRTIIE,I OSHOLD,I CRIIl.D,I : , , , TONE DEPART TIllE IN I1S CLIlRENT TIlE IN I1S C»ISET TlI1E LATCH REGISTER ClIlRENT TIlE LATCH REGISTER DETECTED SIGNAL LEVELS .bss .bss .bss LVL12,l LVL34,1 LVLS6,1 , FILTERI (LPPERI FILTER2 (Lilloell , FlLTER3 (lI'PER) FILTER4 (LOWER) ; fiLTER5 ILPPER) FlLTER6 (LOoIER) .b5S .b5S ENVR,I CTLTSL,I , SIOOTI£D SIGNAL ENl'ELIl'E ; CC»ITR!L REGISTER (UPPERI AND TOTAL SIGNAL .j>. -...J FlAGS,I .bss SINCffi,I LEI'El. (LCAiERI ItLTlPLE FLAG REGISTER, III..L FlAGS HlGi ASSERTED, SEE ASSEftlIl.£R EQUATES HI! FLAG DEFINlTlC»lS, tJIIJS€lI BITS READ AS ZERO, ; PHASE F(II SIN(XIIX FOCTlC»l HffHtfHftfHftHHtt+fHHHHHfHHHfHHt+HffHfHffHfHH-HHHitHf VARIABLES USED IN FILTER ROUTlIE, CONTI~ INTO PAGE 1 DO I«)T INSERT (II DELETE rm WiUABLES lifTER THIS POINT HfHHffHfHHHHH4+fHlfH.HfHfffHfHHHHHHfl-fHH"fHfHtffH-tH • .bss FREQl,1 ,.bss .bss PHASEl,l COSIHI,I .bss COSlLO,1 .bss SINIHI,I .bss SINILO,I :(L~I g, 00 .bss )Q(IfF ffffffffHUHHfHfffffHffHfHffflHfHHH+HHHfffHf-lHfHfHHftHfff • t:::l ~ ;:, I'IISI( REGISTERS F(II C!l'II1IMlCATlON WITH INTERFACE t:::l ">:! ; BIT HfffHffHfHHHffHIHfHH-HfHfHffHHff-H4HHHH-HHHHHHHHHH I:: ~ ~ rtSOOFf,1 BV 12dlloO IN EACH DlRECTlC»l, .bss. fREQ2,1 .bss .bss PHASE2,1 COSIH2,I .bss COS2LO, I .bss SIN2HI,1 .bss SIN2LO, 1 .bss fREQ3,1 .bss PHASE3,1 COS3HI,I .bss .bss COS3LO,I .bss SIN:lHI,1 .bss SltaO, 1 ,bss FREQ4,1 .bss PHASE4,1 ; , , , , , : : : : : FREIlN = (FILTER N CENTER FREQUENCVI I 0,12207 PHASE OF FREIlN GENERATOR HIGH wmo OF 32BIT COSINE FILTER ACClIlJlATOO L~ ~ OF 32BIT COSINE FILTER ACClIlJlATOO HIGH wmo OF 32BIT SINE FILTER ACClIlJlATOO LOW wmo OF 32BIT SINE FILTER ACCLIU.ATOR , : : : , , : , , , , FREIlN = (FILTER N CENTER FREIlLENCVI I 0,12207 PHASE OF fREIJl GENERATOR HIGH wmo OF 32BIT COSINE FILTER ACCLItIlATOR LOW wmo OF 32BIT COSINE FILTER ACCLIU.ATOR HIGH wmo OF 32BIT SINE FILTER ACCLIU.ATOR L~ wmo OF 32BIT SINE FILTER ACCLIU.ATOR , : : , , , , : , , , FREQN = (FILTER N CENTER FREIlIJENCYI I 0,12207 PHASE OF fREIlN GENERATOO HIGH wmo OF 32BIT COSINE FILTER ACCLIU.ATOR L~ wmo OF 32BIT COSINE FILTER ACCLIU.ATOR HIGH wmo OF 32BIT SINE FILTER ACCLIU.ATOR L~ wmo OF 32BIT SINE FILTER ACCLIU.ATOR fREIlN = IFILTER N CENTER FREIlIJENCVI I 0,12207 PHASE OF FREIJl GENERATOO it 00 .oss COS4HI,1 .bss. COS4LO,1 .bss SIN4HI,1 Hltil IIOUl IF 32B1T COSINE FILlER ACWILATOR WI wom IF 32B1T COSINE fiLlER ACWILATIll HIIII IIOUl IF 32BIT SINE FILlER ACWILATIll HHHHIIIlIIIIIIIIIIIIIIIllllIIIIIIIIIllllIIIllllIIIIIlIIIIIIIIIIIIIHHlH .OJ!. .~5 .~s .~s .b5S ,bss IIIINITIALIZED VARIABLES FIll l1I£ IEECTlI! UXIITItlEDl .~s .~s .~s BETWEEN 1'& 0 AND 1'& I .bss .~5 HHHHIIIIIIIIIIII.IIII.I.IIIII •• llllllllllllllllllllllllffH11111111111111 ~ ~ I:: .bss SIN4LD,1 .bss FR£lI5; I .Oss. ~ .bss PHASf5,1 COS5HI,1 .b5S =.0,1 ::. .bss SIN5HI,1 ~ S! 11> [ ~. § .bss SIN5I.O,1 .bss FREQ6,1 .b5S PHASE6,1 COS6HI,1 ;:... .bss t:::J .bss COS6LO.I .bss SIN6HI,1 .DS5 SIN6LO,1 ~ ~ t:::J 11> ~ ; FRElIN = IFILTER N CENTER FREQUENCY I I ; 0.12207 ; PHASE IF FRElIN GENERATOR ; HIIII IIOUl IF 32B1T COSINE FILTER ; ACWILATIll ; WI wom IF 32B1T COSINE FILTER ;ACClIUJITOR ; HIIllIIOUl IF 32B1T SINE FILTER ;ACWILATOR ; WI wom IF 32B1T SINE FILTER ;ACCUIIlATOR ::. .bs5 SlIP, I setA, I .ks X,I .bss .Dss UNI,I LIN2,l .bss L2N1,1 .bss .bu .bss _,I ACCIIII, I ; INTERRUPT IWGLER STA1lIS REGISIER SAVE ; HIIII IIOUl IF INTERRlPT HANDLER ACWILATIll SAVE DECIMTI(JI FLAG WE-ME-IN-1I£-GAPFLAG IEWEST LItEM mTA SIIIfL£ HIGII'ASS/NlTCIH'ILTER SAIfLE IflAYS HIGII'ASS/NOTCIH'ILTER OOTPUT GAHlJST-flUlW· FLAG SAIfLE IlU!TER FLAG FIll AGCIRWIST/TM IIECDDE, FLAG SfMPII1RE FIll 11£ DECIMTI(JI IEWEST COIEt SAItPl.E L2N2,1 LDII-lIAND 8TH MDER IIANIFASS .b55 .bss ,bss .bss l3Nl,l L3N2,l L4NI,1 L4N2,l I.OII-l!ANII 8TH MDER FILTER OUTPUT .bss LV,I *. lDN-1IANIl 2ND MDER stJ8-FILTER OUTPUTS .ltss .bss .ltss .bss .bss .bss .bss .bss (") g. 1II1lY,1 DECI",I POOSE,I XI,I GIll, I 00,1 1'5,1 GAP, I SIGCNT,r FILTER IflAY SAII'I.ES C€IITltIED WlRIABLES USED IN FILTER RWTlNE WI IIOUl IF 32B1T SINE FILTER ACCUILlATOR ; FRElIN = IFILTER N CENTER FREQUENCY I I ; 0.12207 ; PHASE IF FRElIN GENERATOR. ; HlIJI IIOUl IF 32B1T COSINE FILTER ;ACClIUJITOR ; WI wom·IF 32B\1 COSINE FILTER ;ACClIUJITOR ; HIIllIIOUl IF 32B1T SINE FILTER ; ACWILATIll ; WI wom IF 32B1T SINE FILTER ;ACWILATOR 11'& II HHHHIIIIIIIIIIIIIIIUIlIIIlIlIlIlIIIIIUIIIU.IIIIIHtlIIIIIIIIIIIIIIIIII HtHHttH1f1111111J1111111111111111111111l111111111111111ffH111111111.,.1. ~ ; WI IIOUl IF INTERRlPT HANIl.ER ACWILATOR ; SAVE IIIINITIALllfD WlRIABLES IF 11£ DTIF _ P/\G£ I mTA IEFINlTIlM Fill l1I£ 1EECTlI!, TlIIS LOCATI(JI I'llST REPRESEftT TI£ _ I.E., mTA ItEIOftLOCATI(JI OO8Oh ACCWl,1 LVI,I LY2,1 LY3,1 LY4,1 FI,I F2,1 F3,1 F4,I 697 HZ 770 HZ 652HZ 941HZ FILTER DELAY SAII'I.ES HI_8TH MDER_ASS .b55 ~ ~ ~ I:: ~ ~ C;i .blS ,b55 .b55 .bss .b55 ,bSl .b55 HINI,I HIN2,1 H2NI,1 H2N2,1 H3II1,1 H3II2,1 INNI,I 1MN2,1 .bss ,bss .bss [ ~. ~ t:1 ~ ~ t:1 "' ~ §" .bS5 ,bs5 .bss ,bss .bss ,bS5 HY,l .bss .bss .bss ,bss .bs, .bss .b55 ,bss .bss .bss ,b55 ,bss .bss .b55 HYI,I HY2,1 HY3,1 HY4,1 F5,1 F6,1 F7,1 Fa, I TElIPD,1 AD..l,1 AD.It,1 CNTAI,1 CNTR2, I CNTR,I TESTG,! JESTS, ! TIf',1 L4D,1 ,bss .bss HIGIHiAItl 2ND ORIER SLII-FILTER ooTPUTS .Ds5 L~,I ,bS5 .bs5 ::0 "' ,bS5 FILTER CW'FICIENTS HIGH-_ 8TH IlRIER I!AIIII'ASS HIGH-BAND 8TH IlRIER FILTER OOTPIJT .b5s L2D,1 L3C,1 L3D,1 1209 HZ 1336 HZ 1477 HZ 1633 HZ SCRATCII-PAII REGISTER HIGH-BAND TIftSIIUI AD.AJST VALlE LOII-BAND TIftSIIUI AlUJST VALUE SCRATCH COONTER SCRATCH COONTER SAI'il.E COONTER Fill GAP SEARCH OOOD DIGITS JEST COONT BAD DIGITS TEST COONT TEIf' REGISTER FIll CODEC SfTTING HIC,I HID,I taC,1 H2O, I 1IlC,1 HaD, I ~,I .bss_ H4D,1 .bss .bss ,bss .bss _,I TIRII,I TIRO, I JM.(Ij, I DIGIT, I "INTIIi,1 "INTIL, I .bss .bss ,bss 8TH IlRIER TlftSIIUI VALlE 2ND OROOI TIftSIIUI· HIGH BAND 2ND IlRIER TIftSIIUI UlI/ _ STROIIE LtM IIASK DIGIT OOTPIJT RfGISTER ALTERNATIIE "INTH Fill L!* SIGNAl. I:£VEl.S HHHfHHfHHHfHfHlHfHfHHUUIIIIIIIIIIIIIIIII •• IIIIIIHHHfHHH INITIALIZED VARIABLE Fill 0ECKSlII RoomE IHHHHlfHHHfffffflHHHfHHHtHlllllllllllllllHHffHHHlHHHfH ,bss mRKfR,1 .b" IENDO,O , REGISTER TO IO.D PROORAII END AIII1lESS fHtHHHtHfHHffHlflllllllllllllllHfHlffHHffHHfHfHfHfHHHHtf INITIALIZED VAlUABLES CF TI£· DmF PROORAII (P/IGE 11 IECTIJlS AND C(lj5TANTS Fill TM IETECTOR HlHHlfHH •• IIIIIIIIIIIIIHfIIIIIIIIIIIIIIIIHHHHHHHHfHfIHHHIH HlGII'ASSIl«lTCH-FILTER CW'FICIENTS • text .bss .bss ,bn .bss .hss .bss IVARO,O AI,I A2,1 80,1 81,1 82,1 CRESfT INTHDL , COLD RESfT IECTIll , INTERRIJ'T \ECTIJl HfHHlfHfflfHHHfHfHHftHHHHfHfIIIIII.I.U ••• IIIIIIIIIIIHfHUH THIS IS TIE TABLE CF C(lj5TANTS IIIIICH ARE MGT Clf'IED INTO 1M FILTER CW'FICIElUS LOII-BAND 8TH IlRIER fHlHfHtHtHHHtHflHHHfHlllllllIlllllllllIllllllllllIlllllIllllllll1 ~ .bls .blS .bss LIC,I LID,I L2C,1 CIECKS sxcau ... rd ...rd 02CACh 23291 , lUI 0ECKSlII LDCATJ(II. I CENTRAl. MXIIUI.CF SINUl/X R.N:TION 8 TAIIlE IF 1'& 1 DTIF CUlSTIIIIIS FOR ClJ'YIIIl 1U DATA 1M BY IIESET -.ER - .1101"'41 -27801 -13617 +71)767 -28968 +71)767 03880II 0832Dh +11402 -31755 +7432 -31755 +2985 -31755 0D5II6II 085E411 OC234h 087tCh .Iord OM:Eb .ord 087tCh .~ord 09853h .word 087CCb .Il101"'4 07FFFh 07FFFh 07FFFh IFF7Fh 070h "INTH 0 PRGE1II .word .word ...rd •..,d .....d .lIIOrd .lIOrd .lfOrd .word .ltOrd .word .lOri .word .MOrd .MOrd .tfOrd c;) ~ III ~ ~ ;: ~ ~ .ltOrd .word .ltOrd III ~ ::s III :5 ~ OQ .lItOrd .1Ord ••r4 •CIIBIIl ,"1"'41 ; -30307 ; -1m2 ; +18463 ; -25764 ~ tl ~ ":j tl III ~ !l C' ::s ; QOUT I ; ; ; ,_d 059A8It 0411 .1101"'4 IFFh CORI£C 0,9050 • 2H12 1,4008687 • 2H14 K1 SC4II..EF 4 UEFAtLTS 1U 254=>-10<1Il001 IISOOFF ; C8fiEl107OS 11118 ; COEfFICIENTS FllI UII I!AIG'ASS CONEIII ; 1219/15 ; ; ; ; ; ; I ; 163(/71) TIfIESI«LD RIR 8TH IJUER OUTPUT TIfIESI«LD RIR 2IID IJUER HIGH TIfIESI«LD RIR 2ND IJUER UII _ FllI DATA VM.ID STROIIE OUTPUT DIGIT IINIT. INVM.IDI INITIIil VIIlIE FOR ·nINTHH INITIIil VAllE RIR "INTIt. .MOrd ,lOrd OCFEh .tllrd IIlE\£ OFFOOh . 032h ; flST(lI OFFh ;.lI'ftTIII .lIJOrd IFFh ; UImR .1II0rd .lIIOrd .lItOrd 07800h 032h ; EIFCT ; FIISFl O3F00h I ; STIllE FSi'N .set ...t HHffHIHIIIIIIIIIIIIIIIIIIIIIHfI •• 11111111111I11111111111HHHlfHHHIH illITE REGISTERS fHfHH11I111I11I1111111I1111111H1fHfffffff111111111l11111111111111l1l1III ,set IFD9Fh 07C90II •lIIOr4 .word .lOrd IHIS IS TI£ TAIIlE IF IIIIPPIIIlS BETWEEN TI£ 16 LOGIClil II£AD IIIIl illiTE BYTE AIlIIlESSES IN TI£ INTERF~ IIIIl TI£ PHYSIClil _ LOCATIONS IN TI£ Tn537!lC17 • , ..t .....4 INTERF~ HHHHHHHHIIIIIIII .. IIII.IIIIIIIIIII •••• IIIIIII.III.IIIIIIHH.......... I 1332171) ; COEfFICIENTS RIR HIGH I!AIG'ASS ; 148217!l TAIIlE IF 1'& 0 TM JlETECT(lI CUlSTIIIIIS RIR ClJ'YIIIl TO DATA 1M BY IIESET IIAIIILfR •CUlSTI REGISTERS FllI COtIUtICATION WIIH HlHHHHtllllllllUlllllillllllllllllHfllllllllllllllllllllllll1III1IIIIII ; +18427 1:1 ::s IIlE\£ OIlAEh ...t aIIISTO tl III ,lOrd .....4 .ltOrd ; ; I ; CTI.32O CTl322 CTL321l QIN Physial hcdioAS: Legial locations: .wrd . .ord .word .word .Iord (L+U+CTI.TSll (L+II+STIIlIIEl (U+EDFCTl (lI'ftTIIIl ; CONTRa. (UImR) ,1O.d (FIISFll .Iord •.ord ,.lOrd .word .Iord .word .Iord (FSi'N) ; lOWER TIfIESI«LD ; FILTER lEIIlTH SPECIFIER ; _ WIDIH SPECIFIER ; QIIINGE TIfIESI«LD ; FR£IIENCY ns BYTE I FILTER1 CENTER FR£IIENCY ; FILTER2 CENTER FR£IIENCY ; FILTER3 CENTER FRBlJEII:Y ; FILTER4 CENTER FR£IIENCY (ElFCTI (1J+FIISF1I (F+FREIl1l (F+FREQ21 (F+FREIl3) (F+FREII4) ;1IlIIE I ENVElOPE DECAY FACTllI ; lFPEI! TIfIESI«LD LS LS LS LS BYTE BYTE BYTE BYTE .Mord c;) ,lI1ord ~ ~ ~ 'ti ~ ~ ,lIIord (F+FREQ51 (F+FRfIl61 (U+FSPWI .word ., HHIHIHfHHfIHHHftHtHflHflfHHHHHffIHHHHfHHHH+fHfffHf Physical locations: 409. 8192 10384 0 lACK = 3 lACK. 4 lACK = 5 lACK = 6 lACK = 7 THIS IS THE TABLE OF WlNOOII COEFFICIEHTS. ONLY tW.F OF THE WlNOOII IS STORED, STARTIOO IN THE "1DIl.E. Logical locations: *H*fHHHfHffHfff***HfHH+HffHflHH-fffHHfHHHfffHtHffHHHHf .1II0rd tl .lIMItd (L+S+STIIOIEI (L+STIIOIlEI ! ~ .word (DIGITl .lIIord (U+OSTI~1 .word (OSmEI ,lIIord 1U+Il'TI~1 .werd IIl'TII£I IT+C!lTII£I ICRHOLGI (U+LYLI21 ILYL121 1U+LYL341 ILYL341 1U+LYL501 (LYLSOI (CTLTSl.l .lIIoro ,lIIord .lIIord tl ,lIIord ~ "r:i ,lIIord .word .lIIord tl .1II0rd ,lIIord , STATUS , IIOIE , DTi'f DIGIT , TONE ARRIYAL (~l , TOt.( ARRIYAL (LSI , TOt.( IE'ARTlilE (~l , TOt.E DEPARTlIIE ILSI , CIRlEIIT TII£ (~l , CURRENT TI~ ILSI , FILTERI SIGNAL LEYEL , FILTER2 SIGNAL LEYEL , FILTER3 SIGNAL LEYEL , FILTER4 SIGNAL lEVEL , FILTERS SIGNAL LEVEL , FILTER. SIGNAL LEVEL , TOTAL SIGNAL LEYEL fHHHfHffffHfffHHfHHHffHfHIM.III.lllllllfHHffftHfHfffHfttf*** l.OOIQP TABLE FOR CONVERTING 2 SC IIOIE BITS INTO A SCALE FACT!II iHffHfHffHHfHfHffHffHfffHfHfHff_HfHHtHHfHHHHH_HfHfHff •SCATAB 1. SCALEF=4 IDEFAI.I.Tl SCALEF=4 -IOdBoO RAOOE SCALEF=1 +2dBoO RAOOE SCALEF=16 -22dBoO RAOOE HfIIIIIIIIIIIIIIIIIIIIIIIIIIIHHHHffHHHffHffHftHflffH+HffHftffH UlIlK\P TABLE FOO CONVERTING 3 lACK It1IlE BITS INTO THE EQUIYAIENT STATUS BIT TO BE SET BY IW ACI ... S· OIl ~ ;: I:>... t::! ~ ~ t::! no ...::toii:" 0 ;:s ,1III0rd ...rd .lIfOrd .lIfOrd .1II0rd • word ••r4 .1II0rd ...rd •.ord ,ltOrd .word ... td ,1III0rd .lIIOr4 .word ,word .word .•r4 .liIord .word .1II0rd •.ord ,lIIIor4 ,!fOrd .MOrd •.ord •.or. ...rd 25917 25611 25301 24987 24668 8998 8701 84(]8 8119 7834 ...rd .word ... rd 7554 .word ,-.ord .1II0rd 5971 ,1II0rd 5723 5481 5244 SOl2 4784 .word ,lIIOrd ,lIIotd .1II0rd ,word .word 4562 .word 4345 4134 3927 ,lItOrd .1III0rd 3529 ,fllord .word .lIIOrd .1II0rd .1II0rd .word .....d ,1II0rd .WOl'd ...rd .1II0rd .....d .word .Iord .1III0rd •.ord ENDWIN TZT9 7008 6741 6480 6223 ,lIIIor4 ~ 24020 23691 23358 23022 221084 22343 21999 21654 21301> 20951> 20605 211252 19898 19543 19187 18830 18473 18115 17758 17400 1700 116330 15975 15621 15268 14916 114218 13871 13526 13184 12844 12506 ' 121n 11839 11510 11184 10861 10541 10225 9913 9604 9299 •.ord .set 3725 3338 3152 2972 2796 2626 2461 2301 2146 1996 1851 1712 1577 1448 1323 1203 ; EIID fJ' TABl£ fJ' WINroI ClEFFICIENTS HHHtHHHMtIIIIIIIIIIII,llIlllfHttHfIIIIIIIIIIIIIlIIlIIIIlUHHHHH ROUTINE. MIN IlEFERENCE IN FLOIICHART' READ QIE\£ INCREIOT TINE SCAlE D1lF FUN:TII)I: R£AD SAiV'I..E FRO! INPUT 1llRIE, AlII I.l'IlATE CLIIAENT TINE. SCAlE Tl£ SAItPI..E AlII au.. D1lF IF IT IS SWITCIED III• HHHHltHHfHfHlU111111111111111111111I111I111I11111111111111111111IIII MIN . set ; READ tEXT Sllll'L£ FRO! lIRE INTO SIIIFLE• ; IN:AEIENT CLIIAENT TINE E'JERV lIS. READQ ~ ttl ::: ... LAC SUB BZ QIN IlOUT READQ LAR ARO,IlOIJT , LOAD ARO WITH WEUE OUTPUT POINTER LAC *,0 , READ SMPLE FROI1 WEUE BGEZ POS~ ttl l:l :;;::: Il£MPT 'tiC WAIT FOR SOI1ETHING IJI QUEUE. THE QlJEUE IS ElIf'TY lIEN THE QUEIIE INPUT POINTER EIlLiIlS THE Ql.EUE (lJTPUT POINTER. LT II'Y ~ ADD SACL t:l SUB SACL ttl SAC~ SACL ttl POS~ , CONVERT FROI1 SIIJIED-IIAGNITUDE NEGATIVE , TO TWOS-{OI1PLEI1ENT NEGATIVE SAI1PLE , STORE IN SMPLE SUB 81.Z OI'RLOD C LAC SUB SACL ::: LAC OQ l:l "'t:l OR SACL ~ ttl ~ ~ TEMP 1JIE,3 TEMP /lOUT , POINTER COUNTS oo2Fh TI'ROUGH oo28h WHERE , THE QlJEUE STARTS AT 0028, SlZOK TEMP2 TEllP2 SACL LAC SACH TEMPI,I4 SAMPLE SUB XOR ; CHECK FOR OVERFLOW OF THE (4 ; LIMIT BY SUBTllACTING 32768 * 8192 SlZOK 1JIE,I5 OIIE TEMP2 TEIf'I LAC , DECREMENT OUTPUT POINTER MODULO 8 OIIE,I5 ; SAVE SIGN ; EXTllACT PURE SIll'I OF SAlV'LE ; LOAD UP 32768 ; 32767 ; 32707 * SIGN(SAif'LE1 ; DIVIDE BY 4, MAX VALUE IS 8191 OR -B192 UUHfffHUHlfHffffffHff'*ffHffHHfff*Hfff-fffHHH'***H**HflffHH ~ t:l IlOIJT IJIE LAC SACH () "'S· TEMP2 TEIf'I ABS 1JIE,I5 SMFLE SAAPLE, I , IIJLTIPLY SAlFLE BY SCALE FACTOR , 11,4 OR 1_) PAC '"ttl ::: SAMPLE SCALEF •INCR C· ::: OOEUE /lOUT LACK SUB BNZ SCALE ZALS CRTIME ADD SACL , EVERY TII1E THE QUEUE OUTPUT POINTER DETS , TO oo28h, IJIE tIS HAS ELAPSEO. , INCREMENT CURRENT TIME BY ONE, , MOrula _5S3b IJIE CRTII'IE CHECK WHETHER DTMF IS ~ITCHED 011. OM IS SWITCHED ON HN THE APf'ROPRIATE 8lT IN THE FLAGS REGISTER IS SET. THIS BIT IS COPIED FROI1 THE MODE REGISTER EVERY TIME THE RESEHILTERING ROUTINE IS CALLED, IIUCH MY BE DETERMINED FROM THE FLOCHART. THIS ENSUlES THAT THE ON/OFF STATUS OF DTMF CANNOT CHANDE IN THE MIDDLE OF A FILTERING BLOCK. !DTMF AFFECTS THE NUMBER OF Fl LTERS USED 1 fHfff*******ffH*****n*ffff*****ffffff***fHffHfHHHHffHffHfH"H+4fl +UIHIIU***HU***UH*HfHH****HfHH**-I******H****4UHHHHUU***+ • SCALE SAMPLE INTO WOOKING RANGE. THE WORKING RANDE IS SET so THAT MlNE OF THE ACClJIIlLATORS IN THE TIJIE !£TEeTOR WILL OVERFLOW UNOCR ANY SIGNAL CONDITIONS. THE PEAK-TO-PEAK SINUSOIDAL SWITCH OIjiCH CAUSES A FULL SCALE (2541 READING IN THE TOTAL SIGNAL OUTPUT REGISTER, HAS AN INTERNAL MPLITUDE OF 2030. HN THE DEFAULT FACTOR OF 4 IS SELECTED, 2030 CORRESPOIIDS TO AN INPUT SIGNAL LEVEL OF -10 dBoO. THE OTHER POSSIBLE SCALE FACTORS SHIFT THIS VALUE BY 12dB EITHER WAY. SOFTWARE LIMITING OF THE INTERNAL SIGNAL LEVEL OCCORS AT q 8191, WHICH, FOR THE DEFAULT SCALE FACTOR, CORRESPONDS TO A SIGNAL LEVEL OF +2.1 dBoO. THIS LEVEL IS ALSO SHIFTED BY 12 dB EITHER WAY BY SELECTING THE OTHER SCALE FACTORS, HilIEVER THE CDDEC WILL CLIP ANY SIGNALS LARDER THAN +3 dBoO. ffffHHfffIHfffffHfffHffHfHHffHH'H**H**fHUHfHHHffHf**ffHH** * SCALE .". \0 W .set ZALH ADD SACH FILCHK LAC lIND FLAOS OIIE,DTMFLG BI FlLCHK ; IF DTMF IS OFF, BRANCH AROlJIF THE CALL ; TO IT CALL DTMF ; CALL THE OM ROUTINE. FILPDS 1JIE,I4 LE'ICAL ; CHECK FOR END OF FILTERING, FILTER ; POSlTIlJI GREATER THAN 1b3B4. .set LAC SUB OOZ ffnHu ...H+HffffffffHf. .H ...HHfft ...... HHHfI-ffHff .. HH .......... HHHHHf IF FILTER POSITION ti\S INCREl1ENTED PAST 16384, Ti£N A BLOCK OF FILTERING SAMPLE SAIRE,I3 SAMPLE,I , LOAD SMPLE INTO HIGH ACCUMULATOR , 2.25 * SAMPLE IN SAlFLE HAS BEEN COMPLETED AND PROORA/I FUll liRANCI£S TO LEVEL CALCULATION, OTHERWISE IT CONTINUES WITH THE ENVELOPE l£TECTOR • f ...... Hf .... ftfftffHtfffftHHHHtfHHtHffHfHfHffH.HfHtfHH ..HHfHft HfHHfHHfHflHffHHHHHH"**HfHffHfHHfHfHfffHHHHHtHHH ~ HfffHfffHHfHHfHfHHfHHfHHflHfHfHHffHHHHHfHHffHHfHH FU~TION' FL~TI ENVOET ~TONE .set LAC SACH EDfCT,S TEMP LAc TEMP tISOOFF AND SACL LAC SACL , EXTRACT EDf ~ C;l :. ~ 8 S: OQ ~ 5.. i::l ~ 'li FR(l'I EDfCT • NlSIG TEMP TEMP,S TEMP ~ lI'RTIfl , lIE WANT TO ClIf'ARE WITH , (8' 21, • UPRTHR) , WHICH IS VERY NEARlY FIVE. UPRTHR SUB BGEI ENVEL LAC LIIRTIfl,2 AOO LIIRTHR SUB BLI EN'lEL TONSET , ffiOP TIflOlIlH TO NOSIG IF EN'IEL IS THE , LOWER THRESHOLD • RSTFIL , RESET FILTERING TO , CI'IINGED PARAI£TERS rAIN , RETlIlN TO START. ; SRAM:H TO NOSIG IF EH\I£l. IS Tl£ UPPER , THRESHLD. NOSIG CALL ; WE AlSO aJrIPARE WITH (8 • 2/C • LIIRTHR) , BECAUSE Tl£ HIllIER IF THE TWO THRESHOlDS , IS TAKEN AS THE UPPER !WE. THIS OPERATIoo III'LElENTS A SIIOOTHING FILTER OF THE FORM' EN'IEL = (21115 • EN'IELl + ABS(32EDf * SAMPLE) - (32EOF * ENVEL) 2ff15 WHICH IS THE SM AS EN'IEL = ((I - K) • ENVEL) + (K • ABS(SAI'I'LE)) IoI£RE EDf IS K • 2,*10, K POSITIVE HfHHHHfHffffHHfHHHHHfHHffHfHHHHH-tHHfHHHHffHHHff LT IIPY TEMP SAIf'lE PAC ASS IIPY ADD ADD SACH I~ORPORATE ANY HfUHfHHH-HHHfH+HHHfHfHHHHHHff+HHHHH+HfHHHfHH+H TONE PRESENT FlJIG WAS SET. IfffIHHHHHfHffHf"**"******"HHH-HHHHHHHHHHflflH***HHf TPRSNT .set LAC LIIRTIfl,2 AOO LIIRTIfl SUB 001 EN'IEL TOEPT EN'IEL lIE WANT TO ClIf'ARE WITH (8 * 21c * LWRTHR) WHICH IS VERY NEARlY FIVE' LIIRTHR ; IIRI\IOl TO TDEPT IF EN'IEL LOWER THAN THE , THRESHLD. OTHERWISE BRA/£H TO T_, AND IF THE T!WE DETECTOR IS 00, THEN BRA/£H TO Tl£ FILTER ROUTINE. SPAC ENVEL,IS !WE, 14 EN'IEL,I i::l §. lI'RTIfl,2 ADD .set ,32*EDfINTEIIP ~ -ti LAC 001 POWER DETECTOR DETECT CtWaS IN SIGNAL ENVELOPE RELATIVE TO THE USERPROGRIIIt£D UPPER AND LOWER THRESHOI.DS. ENVELOPE DETECTOR AlWAYS RtIlS, REGARlIL£SS IF IoI£THER T!WE DETECTION IS ENABLED. THE ENVELOPE DETECTOR IS USED FOR TIIESTAI1PING. HHHffHfftHffHHfHffltHHtHfHffHH***","*HffHfftH-HffHfH+HH ~ , LOAD A 1 IN TONE PRESENT FIA; POSITION ; AND WITH Tl£ FJA; REGISTER , IIRI\IOl TO T!WE PRESENT IF IT IS SET AND REFERENCE IN ~ !WE,1PRFLG FLAGS TPRSIIT LAC ROUTINE' EN'IOET TONCHK fHffH*IHffH*HHtHHHHHfHHHHHff-HHHfHH+HHHHfHfHH+HH THE NEXT PIECE IF COlE CHECKS THE ENVELOPE LEVEL AGAINST THE UPPER OR LOWER THRESHLD, ACCORDING TO THE STATE IF THE SIGNAL PRESENT FJA;. ROUTINE' TONS£T REFERENCE IN F~TI SET TONE PRESENT FIA; IIJ.ll OOET TlI£ C'l '" ;:, ...'" ;:, ~ ::: TOOET LAC OR SACL '"~ LAC SACL ;:, (lIE, TPRFLG FLAGS FLAGS ; LOAO A I IN TONE PRESENT FLAG POSITION OSHOLD ; SAVE OOET TIME OF DETECTED ; OOSET TIlE LATCH REGISTER SI~ IN CHECK THAT THE TONE DETECTOR IS SWITCHED ON. IF IT IS NOT, THEN RESET THE FILTER AND RETlJlN TO THE BEGINNING. IF IT IS, THEN BRANCH TO THE F1LTERING ROOTINE. S· ()Q ~ STINT tHHHffHHHH+ffHfHH-HffHHHHH*H**fHHHtfffHHI"************* T£tICHI( RSTFIL ; CALL RESET FILTERING ROOTiNE TO ClEAR ; D!Wl ALL ACruI.LATORS AND SET tP FILTER ; READV FOR THE NEXT flOCK. LAC (lIE,OOFLG ; LOAD A I IN THE OOET TIlE \W.ID FLAG ; POSITIOO AND 001 FLAGS OSVAL ; IF THE FLAG IS SET, IiIlIW:H TO OSVAL LAC AND Bl ONE, TOOEBT STlIJDE /lAIN ; ELSE IF THE TONE DETECTOR IS ON, SET A ; SHJlT TONE INTERRlPT. ; IF TONE DETECTOR IS OFF, GO HOME. LAC lOR AND SACL (lIE,STlNBT STlilDE WilDE STIIODE CALL AllEN ; WRITE OUT STATUS CALL IFUPD ; Ll'IIATE IF FLAG tJ '~" lOR SACL FLAGS FLAGS LAC SACL CRTlIE DPTlI£ ; TONE DEPARTlIlE TIlE LAC AND Bl (lIE, TONEBT STMODE /lAIN ; IF TONE DETECTOR IS 00, THEN SET A DEPART ; INTERRtPT. ; ELSE GO HOME. LAC XIII1 AND SACL ONE,DPINBT STMODE STIIODE STIIODE ; PUT A I IN TI£ T(lIE PRESENT FLAG POSITIOO ; THIS HAS CLEARED TI£ TM PRESENT FLAG • ; ASSERT SHORT TONE INTERRtPT .set LAC AND 001 '"r:i ONE, TOOEBT STI()DE FILTER ; IF TONE DETECTOR IS 00, !!RANCH TO FlL TER ; RClJTlNE 1"\ §" CALL CRTlI£ 1"\ tJ (lIE, TPRFLG FLAGS FLAGS ; THIS HAS SET THE TONE PRESENT FLAG fHffffffflHHHHffU*HfffHfffHHHHHffffffff.H**HHHff**tH****f** C) ;:, ;:, I'>.. LAC lOR SACL HH***HHHH·fH*HHfHHHHH**H**H***I-H"f**H**Hf4HfHH4Hf***** ~ ~ 'tJ" '" I'>.. TDEPT FUNCTION; HIIN1ILE octuRANC£ OF TONE OOET HHtHHffHHfHHHffHffl-HHHHHHfHHHffHfHHHH4UHffHHHHf •OSVAL IF AT THE END OF THE ROOTiNE A BLOCK OF FILTERING HAS BEEN COIIPLETED, PROGRAI1 FLilI IlRANCHES TO LEVELS, OTHERWISE IT BRANCHES TO /lAIN /lAIN ; CLEAR ONSET TIlE VALID FLAG =CIJlRENT TIME. tHHfHffffHf,"**fHHH-HHfHf.lHHHffH:HtHHHHfffHHHHH*"***** •TONOFF CONT3 ; RESET THE FILTERS READY FOR WI£N IT IS ; SWITCHED 00 AGAIN. ; SET A TONE DEPARTURE INTERR\PT HHHffHHHfUHHHfHftHffHfftHfHHHHHH****ffff**fHf**f**H*fH DPINT ROUTINE; TDEPT REFERENCE IN FLOII::HARn CLEAR TONE PRESENT FLAG RESET FILTERING 6fT OOET TIlE \W.IO FLAG CLEAR OOET FLAG SAVE DEPART TIlE SET DEPART INTERRI»'T SET Slf:JRT T(lI( INTERRUPT .j>.. 10 VI . FUNCTIOO; HANDlE TM DEPARTlIlE tHftHfffHHffHffttHHfHHfHHlffHHffl-HHffHHfHfHfHflHHfHfH* ; ASSERT DEPART INTERRtPT CALL AllEN ; WRITE OUT STATUS CALL IFI»'D ; tPIIA TE XF FLAG /lAIN fHHHUHfHUHHIHUHfHHffffHftHHHHHfffHffHHHfHHIHtHfff ROOTINE; FILTER •~ IIFEIIEIICE IN Fl.llNCHllRTI FILTER I FIKT_ ROUTINE FIR FILTERING AND IUUUATlNG 11£ III'UT _ •fit 11I1I.lllllllIlllIlllllllIllIlfllllllllllllllllllllll.I.IIIHH1111111.1111111 DIVO SIIIC UIQ( SIIIC SIIIC "'t:::l §. TIlR LAC BZ SXC£NT TElf'I SI1I:I'II,5 PHASEO SUIIC SUIIC SUIIC SIIIC (1£,14 TEIf' TEIf' ·SIIl (1£,14 TEIf' SACL LT LAC lt:::l II'Y TEItP KI,15 TEIf' SPAC So1CH TEIf',1 II'Y TEIf' ~ ~ (F LT II'Y g' So1CH TElf'I,1 TElf'I SlID'll IW: TEII'3 TEItP TEll' SUIIC TEItP N(p SINCPHASE. THIS IS SlID'll AND SACL LAC ADD SACL IISOOFF LAC aEZ TEII'3 PHASEO ; JOE IF REQUIRED SION IS POSITIVE TElf'I TElf'I ; OTI£RI(ISE INVERT SIGN TElf'I TElf'I,8 (1£,7 TElf'I ; 8 BIT R£SULT IN 2116 FIRII BY ADDING 128 ; FilIAl REStlT IN 21114 FIRII I ROIJII ZAC SlII SACL (F REStlT f PHASEO 85et ; SINIlIII So1II'LE IN TEll'I 'f 101 CALCIlATE WINOOW POsITION AND READ WI_ So1II'LE ~ RIWI TAII.E IW: So1CH i'ti ~ ; GElEAATE SINE TEIf' N(p I ADO SACL LAC ASS TEIf' N(p IJ' CSITRAI. VtLI£ (F slNm II ; AH:TION INTO TElf'I ; SIN(l)/1 IIERE 11£ PHASE X =ZERO IS A I Sl'ECIIL C41SE. (F TEIf' N(p ; I.IW) ACCUIILATill 101 CONTAINS All 2HO ~TATION _TED TO 11£ IIIML ~ c .REPR£!!ENTATION. TEIf' N(p 1fI1.111 ••• 11111111111111I1111I111111H111111111111111111IIIIIIIIIIIIIIIIHH ~. "t] ; 8 CYCLE DIVIDE LOOP N(p ~ :3 TEItP N(p 111 ••• 11111111111111111111111 ... 11111111111111111111111111111fHHHHfHHfH C;l SINE(l) IN 21113 FIRII • 21110 IN IUUUATill READY FIR DIYISION. INITIIL REStlT IN 2116, N(p 11£ FIRST SECTION CILCtlATES A SAIt'lE (F SINIlIII. 11£ PHASE X IS sroRED IN ~ FlRII'IO AWID POSSIBLE 0'.DfUII, lIND TiE REStlTlNG SAIt'lE IS IN 2M14 FfM, IlAIlIUI \NIllE el2 f 2M14. 11£ DIVISION ASSttIES N.ltERATIll IN· 2M14 FIRII, IIIIEVER 11£ SINE. SECTION PRlIIIXES A 2M13 RESULT, AND 11£ IEIMIIINllTill IS ACTUItiY IN ~ FIRII, TIIJS 11£ IU£RATIll IS SHIFTED LEFT BY 10 PLACES INSTEIIIl (F 14. (14-5+1 = 101 ~ ; 08TAIN POSITIVE DIVISill (PHASE XI IN TEIf' ; DIYlSill Ar«U STILL IN ~ FIRII I I ~ TEltPI,IO ASS FILTER ~ LAC TEIf' f .. I ~ SlID'll .. tHlll ••• IIIIIIIIIIIIIIIIIIII' •• IIIIIII.1I11I111111I1111111111IIIIIIUUllfH C'l LAC ASS SACL ; SINE!XI IN TEll'I IN 21113 FIRII T WITH SIN(l) IUIIY IILTIPLY IN ORDEA TO 08TAIN SIGN (F SIN(XIIX IWTIENT IN TEltP3 I.IW) LAC ASS So1CH FILPOS,9 TEll' UIQ( MINIM ADD TEIf' DIVIDE ASS (FILTERPOSITIONI BY 128 11£ REStlT IS 11£ CFFSET INTO 11£ HALFLEMlTII WINIIOII TABLE. ; ADD IN WINIIOII TAII.E CFFSET ~ ~ ~ ~ b g ~ OQ ot£,DTIIfLG FLAGS FUlOP ; IF DTIF IS LARK MO,5 ; EI.S£ 00 ALl. SIX PAC ; FILTERIII> LOOP SACH ~, au 00 TIIlfE FILTERS, FLIIOP .set HfffHf.IIIIIlIIIII.IIII.,HtHfHfHHHfHffHHI.I"IIII'11111111111I11II THIS IS TI£ FILTERIII> LOOP. FOR EACH OF TI£ FILTERS,. A SIrE AND A COSI!( ·SMPLE IS GENERATED, AND EACH IS IILTiPLIED BY TIE PROIltf OF TI£ INPUT SAPlPLE AND TI£ _lATE FILTER COEFFICIENT, WIDE OR _ . TIE_ FILTER COEFFICIENT IS .AJST TIE WINIOI SAIf'LE II£REAS TIE WIDE FILTER COEFFICIENT IS TI£ WINIOI SAIf'LE l'ILTiPLIED 9Y A SINIXl/XSAIf'LE. I:>... HffffffHttHfffHHHHHfffHfHfHHHfHHfHHtfHllllllllIllIllIlllll1 .~ ~ WINIOI ; RfAD WINIOI SAIf'LE LT WINIOI TEllPI ; TAKE WINIOI • SINIXl/X PRODl£T Sl«:WIN,1 ; STIllE PRODUCT LARP § b TJLR ~ ~ ~ ::s (\> AND BNZ LAC GENERATE SINE AND COSINE SAIf'LE AT THE SPECIFIED SEARCH FREOOEN:Y OF THIS FILTER ACCIJIlLATE WINOOI AND SNCIIIN INTO THEIR RESPECTIVE ACrollATORS; TI£S£ Will LATER lIE USED TO _12£ TI£ FILTER OUTP\JlS TO OOf'EHSATE FOR TI£ EFFECT OF TI£ WINOOIINO AND TI£ IILTlPLICATI~ 9Y A SINIXliX FtH:TlON. IIHHfftHfHHH •• IIII.III •• IJHHHIII.IIIIIII.II •••••• lfHHHHHIHHH ZIl.H ADOS ACSWHI ACSWLO ; LOAD UP SHeWIN ACrollATOR ADO SHeWIN ACSILO ACSIIfI ; STORE ACCUIIILATiON BAC1<. SACL SACH AClNtI b ZIl.H ADOS ACWNLO ; LOAD UP WINIOI ACCUIIILATOR ~ ADO WINIOI AClN.O AClNtI ; STORE (\> ~ §. LAC ADD SACL Of , LOAD UP FREQN IIiICH IS THE REllUIRED PIIISE ; INCIlEIEHT , ADD ClIlRENT PIIISE. , CIUllATE NEW PIIISE OF SEARCH FI£lII£HCY SINE AND COSINE ROOTINE. REQUIRES ARGIJ£NT IN TElf'I IN REPRESENTATION WIERE q 20015 REPRESENTS q c. RESULT IS -COSlTElf'Il SCALED IN LOCATION TEII'2 AND SINElTEllPIl SCALED IN LOCATION TElf'I USES TEll' AS A SCRATCH LOCATION. Kl IS A CONSTANT EllUl¥. TO 1.4008687·' 2814. TI£ 0CCtJlAANC£S OF 1IE,I4 REPRESENTCI2. TI£ RESULT IS ASINE AND A -COSINE SCALED 9Y 0,,050 • 20013. TI£ ALGORITHII ACCEPTS AlnES IN TI£ RIIIlGE q 2 • 20014, REPRESENT- INO q c, ·ANO CUMRTS THEIl INTO 2 EQUIIIAUNT AIIlLES IN TIE RANGE q 1 • 20014, ot£ SIIIFTED 9Y el2. IT THEN PERFORItSA SINE ALGORITHM ON EACH OF T1£SE·.TWO WIllIES TO YIELD TIE DESIRED RESULTS. § SINCOS .set LAC , !lIKE ANILE IIIIlJU) 65536 SACL SACH LAC SACL SAIf'LE,2 LT II'Y TEIf' TEIf' ACruI.LATI~ BACK. ; I!Ul.TlPLY SCALED LINEARIZED SNf'LE 9Y FOI.Il SNCIIIN , GENERATE WIDE FILTER S4IIIPl.E SACH SHeWIN,I ; SHeWIN NlI/ CONTAINS WIDE FILTER SAIf'LE ~ WINIOI ; IlENERATE NARROW FILTER SAIf'LE SACH WINDOW,I ; WINIOI NlI/ CONTAINS NARROW FILTER SAIf'LE LAC AND 1tSOOfF,8 FSPW ; MSK IN FILTERSELECT 9YTE SACL LAC SACL TE11'3 TEIIP3,2 TEII'3 , TI£ SIX FILTERSELECT BITS ARE NlI/ IN TIE ; TIP SIX BITS OF TEII'3 LARK LARK ARI,FREQI MO,2 ; .SET UP LIIOP COUIITER FOR TIE FIRST THlEE PAC PAC ASS SUB SACI. LT LAC If'Y SPAC SACH ~ 00 C) ~ ~ ~ 'ti ~ 03 8:::... ~. TEIIP,I II'Y TEIf' PAC SACH LAC ADD SACI. LAC ASS SUB SACL LT LAC MPY SPAC SACH If'Y PAC SACH . TEllPZ,I !l£,14 TEif' TEI1P .set ONE,!4 TEI1P,! LAC TEI1P,2 ADDH .. .. SACH SACI. If>Y PAC ADD SACH LAC TEMP,! TEIf> TEI1P!,! I THIS FILTER IS WIDE If>Y PAC ADD SACH ADDS !l£,14 TEif' TEI1P Kl,!S .TEI1P TEI1PZ I- I SAllPLEtCOSlNE I Z"IS I LOAD SAllPLEICOSINE PROIllCT, I ACCUIItl.ATE N(Ij I COSNiI ADDED I COSNLO ADDEO I STORE BACK ACCltU.ATOR, TEI1P! ONE,!4 TEIIP,! TEI1P,2 ADDH ADDS SACH SACI. .. IlANZ FLOOP 1- ",O,ARO I SAif>LEISINE I Z"IS I LOAD SA/lPLEISINE PRODUCT, NOW ACCUI'iJLATE SINlliI AODED SI~O ADDEO STORE BACK ACCIJItJI.ATOR • ARO NOW POINTIOO AT FREIlN FOR NEXT FILTER fHffHffHfH*****ffH****H**HHfHHfHfHHfHHHfHfHHffffHHfHf** HHHffHf**********fHHHlHfHfff**fHfHHHHH****HftHI-HffHf:HHfH THIS SECTION GETS ElTtER WIDE OR NARROW SAllPLE INTO THE T REGISTER. fHftH+fH*HfHffHHfHffH+HHHfffHtHHfHfHH+HHfHfHfHHHfHft I SELECT tJ ~ ">i §" •WIDEF IffHHfHfHflfffHfHHHHfffHfH******HHfHHHfHHf****HfH+HitHfH :::... tJ TEIIP Kl,lS TE1tP Hfffff*fHfHfffHHHHHHHfHHfHHHHHtHHHfHHHHfHfHHHHH END IF SINE COSINE ROUTINE ;:, ;:, '"~ TEIf' fHfHHHHtfH******HfHHHffHHHffH**fHHf************HH-HfHfffH ;:, '"tJ END IF SELECTION SECTION !l£,14 **HHfffHfHfHH****HHHHHHHffHfffHflfHf***H+fHHHfftHfHHfH ••• t LAC SACH LT SN::WIN I SNCWIN CONTAINS THE WIDE SAllPLE LAC TEI1P3,I I PICK OFF THE FILTERSELECT BIT FOR THIS ; FILTER SACI. TEllP3 WIDEF LT I1PY PAC ADDH ADDS SACH SACI. BLZ NARRIF THE NEXT SECTION ACCltIJLATES (SAif>LE/4ll SO THAT A MEASlIlE IF Tl£ TOTAL SIGNAL ENERGY IN THE llANO CAN BE CALCLlATED, ; THIS FILTER IS NARROW .set LT ; IF THE FILTERSELECT BIT WAS SET, THEN I THIS FILTER IS WIDE, WINDQI I WINDQI CONTAINS Tl£ NARROW SAI1PLE flffHfffHHfHHfffHHHt-HfH+fHHflHHHH-HffHtHHHf**fffHHH*** SAllPLE,I4 TEI1P TEI1P TEI1P ACSIIfI ACSQlO ACSQHI I SAif>LE/4 IN HIGH ACrutULATOR I (SAllPLE/4ll IN ACCltU.ATOR I ACCUI1!l.ATOR I STORE ACCUl!ULATOO BACK, ACS(LO fHf4H+HfffH****ff**"***flHHHHffHHHfIHffHff**********"HfHH** INCREI1ENT FILTER POSITION ff**HfftHf**HH*",*f************ffffHfftHfHffHfHfHfHffHfHHHffH <:) s ~ ~ ~ 01£,5 ADD S4ICI.. FILPOS FILPOS INCREIENT AS LAC ADD HfHfHHfHHlHfHHHHffHHHfHtfHHHHfHffHHHfI.IIIIIIIIIIIHU LAC lIND ~. IISOOFF FSPW •1K.00f IN PW Tl£ PASSIIANDIIIDTH, WHICH E!lIAS PHASE INCREftENT REQUIRED Fill THE Sin(X)!X PHASE. ItASI( SINCPH SINCPH ADD S4ICI.. § s::.. ~~ FILTERPOSITI~ IIICREI£IIT SIN(X)!X PHASE ~ t::l , CAlCILATE , (lFL +32) HHHHIIIII'III'IIIIIII"II'III'III'II+HftHHHHffHHtHHff'HHfI~ ~ (:;l :: !II FlSTlll,1 LAC AlII PlAIN , RETlJRI( TO BEGINNING IF PlAIN LOOP. HHHHHflHtllllllllllllllllHHflllllllllllllllHHHHtHtlHffHHHtHt • t::l RIlUTltE. LEVCAI. TooBIG REFERENCE IN FlIKHARTI CAlCILATE LE\IEl.S t"\ FlJlCTI(II. CAIClLATES THE LEVELS AT Tl£ END IF EACH Il.OCK IF FILTERING ~ go SIZE(l( HffHfffHHffHHHffHIIIIII',I'I'I.HHfHfHffHHIHfIIHHIHHHHHH lEVCAI. .5.t HfHHttHIHHHHHHHHIHHHfHlHHfHHHHHHHfHHHHfHH+ftHf • FIRST CI£CI( THAT THE QIElE IS EMPTY. IF IT IS lilT, .All' IIACI: TO THE BEGINNING IF Tl£ PROGRAII. IXJj'T 00 ANY IF THIS PROCESSING tllTIL THE IS EftPTV, THIS WILL RESTIIlE Tl£ INTEI1RLI'T TIlE Il\£RI£AD PIIDIIIDED BY HAYING AN EMPTY QIElE. QUEUE HIHHfHtHHfHffHfHHftHftHHHlHHHfHffffHHfHHt.HH.H.ttHHH LAC QIN SUI BNZ QOUT S4ICI.. 0NE,4 TEIf' ,GII'ESFl+16 , AS DIVI50l IN TEIf'. UIRI( 1IRO,15 I SET Ll'4IIRO AS 16 CYCLE COONTER ZALH OlE SUBC BANZ 1K.00f , Tl£ QIElE IS EftPTY WHEN THE QIElE INPUT , POINTER EIlIAS Tl£ OUTPUT POlrlTER. PlAIN AI.OOP M,2 ZAl.H ADDS ACSQHI SUB TEIf',15 BLZ SlZEOK ~ lIND SQUARE-fiOOTED. TEPII' , 4 • FILTERLfNGTH IN TEIf' ACSQlO , LIMIT DIVIDEND TO LESS TIWI (2H15 • , DIVI5Ol) 50 THAT RESlLT IF DIVISI~ WILL , WILL lIE LESS TIIIN 2H15 ZN: ONE .set ADD TEMP,15 , DIVIDEND L1"ITED. UIRI( 1IRO,15 , SET LI' IIRO FOl 16 SUBC'S SUBC BANZ TEftP ALOOf S4ICI.. LAC TEIf' TEIf',3 SACH TEMPI S4ICI.. CAlL SQRT LAC IWD ADD S4ICI.. CAlClLATE Tl£ TOTAL 51 __ LEVEl. IN TI£ WHOLE BIWD. IE HAVE All ACCUIIJLATI(II IF (SAII'lE!411 IN ACSQRD. THIS IS DIVIDED BY (44FILTERLENGTH), WHERE FILTER LENGTH IS U6384I1Fl + 16)) + I, AND THEN IU.TlPLIED BY 2 TEIf' ADD SACL SUB !II FlSTtll , RESlLT MIl IN 2H2 FOl" AS REQUIRED BY , THE SIlUARE ROOT RWTltE. TEftP2 ItSOOFF,8 CTLTSl. TEMPS CTLTSl. , SIlUARE ROOT. RESlLT IN TEMPS , ItASI( IN taiTR!l. REGISTER BITS ~ Y. , STIllE RESlLT IN UIER HALF IF CTLTSl. HHffHHftHf •• I.IIIIIIIIUI.IIIIIIIII'IIIIIIIIII.I.llllfD DIVllE Tl£ (WINDOW-SINmlll WIlE ACClIU.ATI~ BY 2H15. IICCIJU.ATI~ IN' Tl£ WINDOW _()I HHfHHHHHfHtHtHHHtHtlllllllllllllllllHflllllllllllllllHHftHfH VI ZAlH 8 ADDS SACH ZALH ADDS SACH ACSWHI ACSILO ACSILO,I ACWIIHI ACWNLO ACWNLO, I NARR~ .set , THIS FILTER IS NARRQI , RESUlT IN ACSILO , RESUlT IN ACWNLO •WIDER fHffHffHHHHffffHHHHHHHfH"*HHHHfHffHHfffff*****f**HfHiHf 161 NlRIIALIZE THE SINE AND COSINE FILTER ACClJllIJLATORS BY DIVIDING T1£" BY EITHER THE (WINDOW' SIN(X)/X} ACCtIIULATICllOR TI£ WINDOW ACCttlULATION DEPENDIND ON WHETHER THE FILTER IS WIDE OR NARR~. LAC SACL ACWNLO TEIf .set LAC LAC .. ZIILH f+ , ACWN..O COOTAINS TI£ NARRQI NlRIIALIZATICll , FIRST _IZE TI£ COSINE ACClIII.lATOR f+ ADDS , TWO rut!\' READS TO IM:R£/ENT POINTER TO , COSNHI , LOAD UP CDSINE FILTERII ACCUllJLATOR ADS fHfHHHff ....HHHfHHHfff*************H*fHffHf.Hfff**"*HH+HHH • LAC AND MSOOFF,8 FSPW , I1ASK IN FILTER SELECT BVTE SACL LAC SACL F1LPDS FILPDS,2 FILPOS , THE SIX FILTER SELECT BITS ARE OOT IN THE : TOP SIX BITS IF FILPDS LARK LARK ARl,FREQI ARO,2 , SET UP LOOP COUNTER FOR THE FIRST THREE , FILTERS ONLY LAC AND CllE,DTMFLG FLAGS 8HZ NLOOP ; IF DTMF IS ON, ONLY DO THREE FILTERS, LARK ARO,S ; ELSE DO IILL SIX CDIV ~ ~ ~ ::;::: 'ti<:> '" ~ :::. tl ~ <::> !:>.. S· ()q NLOOP :::. tl ~ ARI,mPl ARI,15 , SAI'EARI IN TEI1PI , USE ARI .TO COOTROL A 16 CYCLE DIVIDE. suee TEMP CDIV , DIVIDE BV THE SELECTED ACCI.I1WlTOR BANZ LAR ARI, TEMPI , RESTORE ARI SACL LT MPY PAC SACH TEMP2 TEMP2 CIlRREC , MULTIPLY RESUlT IF DIVlSION BY SINE , CORRECTION FACTOR. H,l,AR1 ; STORE 2*RESUlT IN CDSNLD ffHfHffHfHHHH***HHffHHHffHHHfHfHHHHHHHHtHfHHf**HH OOW REPEAT FOR THE SINE ACCttlULATOR fH'HH**HIH*****HHHHHHfIHHH+HH**"**HHHHfHHHf*******HH* .Sft • LARP f**HHHHf .......fHHHHHfHHfHHHHHH**fHfHt+****HtfH**Hf***"* THIS IS TI£ NlRIIALIZATlON LOOP. l:> !:>.. SAR LARK THIS SECTION GETS EITHER THE WIDE OR NARR~ ACWI.JLATION INTO TEMP f'f+HHHHfHHHttHHHHf*tHH+ftfffHHHHfflfHfHH*******HlffH*H •SDIY ZALH ADDS ADS It SAR LARK ARI, TEMPI ARl,IS ; LOAD UP SINE FILTERII ACClIIJLATOR suee TEMP BANZ SDIY ; SAYE ARI IN TEMPI , USE ARI TO COOTROL A 16 CYCLE DIVIDE. LAC SACL ACSWLO TEIf , ACSWLO COOTAINS THE WIDE _IZATION LAR ARI, TEMPI ; RESTORE ARI ~ LAC FlLPOS,l ; PICK OFF THE FILTERSELECT BIT FOR THIS ; FILTER TEMP2 TEMP2 CORREC ; Kl..TlPLY RESUlT IF DIVISION BY SINE ; CORRECTION FACTOR 5' SACL BLZ FILPOS WIDEFL SAeL LT MPY PAC SACH ',I,ARI , STORE 2*RESLlT IN SINnHI "t:! tl () :::. ; IF TI£ FILTERSELECT BIT WAS SET, THEN ; THIS FILTER IS WIDE. LTC MPY Me , SQUARE c;) s LT If'Y ~ SACH SACL i::"' ~ ~ ~ RESULT IT IN -) 41 SU1 OF , AND AIl) SQUARES .. lAC lAC IXmI READ 111 ltaflENT POINTER TO END OF IILOCI(. LOAD lIP RESlLT OF SQUARE ROOT ST!I1E RESllT (FILTERN OIJTPIJT LE'iEL) IN SINIt.O TEItP3 SACL EIFeT IISOOFF TElPI , LOAD lJI> CHANlE l1tlESI(U) , ST!I1E CT IN TElPI LARK ARO,FREQI • START POINTIMl AT FREQI lAC SACL ONE,FILTl TEll"2 ; INITIAL BIT 111 , NOTE THAT SIlRT ALWAVS RETURNS WITH ARP--() ClOOP LMP lAC AND SACL , SQUARE COS TElPI TEII'2 SII!T au. Cl ;:s "'t, ! .. SINE RESllT *.O,MO HHHfflHHHflHHHfltHtHHlHfHIHfffHfftHHHffHffffffHfHHfHHf IIIIR IIIIR IIIIR IIIIR IIIIR t::l ~ ~ t::l ~ §' END OF tGlI1A1.lZATION SECTION. REPEAT FIR EACH FILTER. It It ; to. POINTIMl AT SltRO lAC TEll"I SUB It , LOAD lJI> CHANlE l1tlESI(U) , ARI NOW POINTIMl AT _ I BGEl COO lAC TEllP2 TEIt' TEll" ; FLIP THE BIT IN TEIP TEll"2 FLAGS FLAGS ; SET TIE BIT IN FLAGS SACH TElP2,I5 TEll"2 ; SHIFT BIT OF INTEREST ALIJ«l TO TIE RIGIIr lAC TEII'2 BIll CLOOP XIR SACL IHltHHHIIIIIIIIIIIIIIUIHtHHHHHIII".IIIIII •• llllfIHflfttHHlHfIf BANZ lAC tI.O(p IR SACL HHHHlHlfHHHHHIfHHHHHHfHHHfHfHffHfHffffHtHHHHHHH WITH IN FLAGS .... I:> ;:s I:>.. I0Il( It TO END OF LOll' IF LE'iEL IN THIS BAND IS BELOW THE CHANIE l1tlESI(U). LOAD lIP _lATE FLAG BIT IIASK (I!(J> I COO RruTINf' CINlS 1e"ERENC£ IN FLOIoOiART: FLlNCTION' CIfCI( CIfCI( lAC CIW«S FIR LEI'EL CHANGES DlI!IMl A TlINEBl!!ST ; REPEAT CLOOP FM EACH FILTER tff*IHfHHHHHHtHtfHHtHtHtfHHtHHtHHHHtHHHtIIIIIIIIIIIIIII ROUTINE' LI'LS tHHffIHlHlHHHHffflllllllllllllllllfffffHHffHHHfHffHfUHH+HH REFERENCE IN FLOWCHART. WRITE WI LEVELS to. O£CK FIR CHAMlES IN 1lIIY OF THE FILTER LE\'ELS hlilCH CROSS THE CHANlE TIE FLAGS REGISTER INTO TEIP. NF USE THAT 111 CIfCI( FIR CHAMlES WHILE TIE REAl. FLAGS REGISTER IS ItlDIFIED 111 Ie"LECT THE FILTER OUTPUTS hlilCH ARE ClJRREllTLV ABO'IE THE CHANIE l1tlESI(U). l1tlESI(U). COPY FUNCTION: WRITE LE\'ELS INTO REGISTERS HHHffHHHHfHffHHHHHHHfll •••••••••••••• HHHHHf............_ . I .. IHHfHHlHlfIlHHIIIIIIIIIIIIIIIIIIIIIIIIIJIIIIIIIIIIIIIIIIIII .. 1111111111 .set lAC SACL FLAGS TEIP lAC 1ISOOFF,8 AND FLAGS FLAGS QJ>V FILTER WlPUT LE\'ELS INTO THEIR RESPECTIVE REGISTERS IN caFRESSED FORItAT. 2 LE\'ELS TO A lDID. ; Cll'V FLAGS INTO TEIIP HffHHfHfHHHHHII ....... IIIIII.lfHHHHffffllll.IIIIIII •• lttHfHHH ~ SACL LI'LS •set , CLEAR WI THE SIX FILTER LE'iEL BITS. lAC SINlLO,8 s ADD SMl. 51Il21..0 LYLI2 LAC LD'K SIN3LO,8 ADD SIN4LO LD'K 0 SMl. LYL34 LD'K LAC FSTTI" LAC I SAC!. LAC OR SIn I ADD SIN5LO,8 SIN6LO LD'K 0 SMl. LYL56 RIlUTII£'. COI'I'LT i:l ~ .$:: "ti ~ 03 ~ IWZ t1 LAC AND ~ R ~. ~ :3 1:1.. t1 ~ 'll ~ ~ §" •cam BZ OIE,FSTfLG FLAGS FSTTI" LAC XOR AND 1lNE,001NBT STIfJIE ST!!OIE SIn STIfJIE au ATIEN au au au ATIEN XFlPD , illiTE OUT STATUS , UPDATE XF FLAG au RSTFIL , RESET TIE FILTER LAC lOR AND OIE,FSTFLG FLAGS FLAGS FLAGS , CLEAR THE FIRST BLOCk FLAG MIN , RETIJlN TO BEGINNIIIl SIn , IF IT IS TIE FIRST BLOCk, SKIP OYER TIE , NEXT SECTION , ASSfRT ONSET INTERRlI'T HffHHHffHff+HfHtfiHtH*HffHfHffHHfHfHffHHHfHflHHfHHHHH mP IISOOFF CONT3 • •OIINT SIn .Stt .set LAC AND , SfT TIE ONSET TIlE VALID FLAG OIE,OSINBT STIIODE STn:lIE STIIODE LAC XOR AND FUNCTION. ClIfLETE IJ'ERATIOIIS READY FOR I£XT FILTERINl IJ'ERATION CO/IPLT OIE,ONSFLG FLAGS FLAGS , COPY ONSET TIlE FROIIIO..DIIil RESISTER , INTO ONSET TIlE RESISTER fHfllllll.II.I.llftHfHitHHffHHHffHHHffHfIIIIIIIIIIIIIIH'**'fH*HH OSINT REFERENCE IN FUIDtART. FIRST BLOCk FLAG SfT? CIWlGES? SET CIWIlE !llTERRUPT CLEAR FIRST BLOCk FLAG SAVE I£LD ONSET TIlE SET ONSET TIlE YALID FUIG SET ONSET INTERRlI'T ~ OSIWI OSTIIE SET AN IJISfT INTERRlPT fHfHHHHffIIIIIIIIIIIIIIIIIIII ••• ,'IIIIIIIIIIIUIIIIIIIIUIIHHIHHH+H C) ...t XFUPD CONT3 RIlUTINE. RSTFIL , IF /u TIE b FUIG BITS lIRE ZERO, TtERE , WAS I«l CHANGE IN Lf'IEl. ACROSS THE CIWIlE , THRESHOLD REFERENCE IN FUKHART' RESET FILTERING , ELSf TIERE WAS A CIWIlE FUNCTION' CLEAR DOWN FILTER ACruUJITORS AND RESET POINTERS READY FOR AI«lTtER FILTERING IJ'ERATION. , ASSfRT OWIGE INTERRlI'T , IIUTEOUT STATUSs , II'DATE XF FLAG HHHtfHffHffHHHfHHHHfttHfHlllllllllllllllllllllllllllllllllllftt* *RSTFIL , RESET FILTERING ROUTINE • • Stt LAC AND SAC!. /ISOOFF FIISFl. FLSTOR ZAC SUB 0IE,14 LDAD II' UJiER BYTE MSK MSK IN FL FL IN FLSTOR '"5~ SIICL FILPUS ; RESET FILTER POSITION TO -16384 ~ lAC S ~ CIILCtlATE INiTllII. SINUl/X PHASE :i;; EXPRfSSION FrM THIS IS' IINITIIil. F1LTERPOSITION WHICH IS 11£ SI¥£ AS' I:: ~ ~ 1-16384 f f SINClI/1 INCRE/lEllTI/HIILF-fILTERLENGTH PII) / 12fL +32) !l> ~ ;: It , TI£N ZERO 11£ ACClIUATIII AlII) PUT ZERO Zf£ 'HfflHffHffHtHtfHHHftlHIIIIIIIIIIIIIIIIIHffHfffHfHfHHtHHHHH f !l> lAC tl !l> AlII) FSPII IISOOFF SIICL TEIP lAC CIE,14 SIICL TElPI ~ ; LOAD UP FILTER SELECT AlII) PASS_IDTH ; lIASI( iIj _10TH SPECIFIER PII , INTO 11£ !£XT FOIl LOC/lTiONS, SIICL It SACI. SACI. SACI. It IIMI ZLOOP ; TI£N ZERO 11£ REltAININl ACCUIlATORS SIn. ACSQHI I HIGH WORD If 32B1T SIIJI1l SIIUARED ,ACCUIlATIII ; LOll WORD If 32B1T SIONIII. SIIUARED , ACCUIlATIII , HIGH WORD If 32B1T WINlOi ACCUIlATIII , LOll WORD If 32B1T WINIOi ACClIUATIII It I+.O,ARO SIn. ACSGLO SIn. SIn. I¥:INtI ACWIU SIn. ~I SIn. ACSIILO <:) ~ Oq I:> ::s I:>.. tl lAC ADD SIICL ~ '":i LT II'Y tl ~ TElPI TEIf' ; HALF FIUERLENGTH • I2FL +32) , DIVlSOl HHHfHHflfHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII'1111111111111111 INTO BIT IN IIOIE REGISTER REGISTER ACCORDINGI. Y QEC!( ; 16384 f PII AlII) SET 11£ DTIF ON/iff FLAG IN 11£ FLAGS lJIRI( 0,15 5lAIC lIMI TEIIP2 SLOOP lAC AND SIn. CIE,DTI1F\.G FLAGS SIICL SINCI'H SINCI'H,I SINCI'H lAC AND SIn. CIE,DlftFBT STIIOIE lAC 1M TEI1PI,IDTIFLG-DlIf'BT) TEIP ; RESU.T IS A CIE IF FLAGS ARE DIFFERENT 1M SIn. FLAGS FLAGS lAC M SACI. CIE,FSTFLG FLAGS FLAGS f SLOOP HIGH WORD If 32B1T SINIXl/X. WINIOi PROOUCT ACCUIlATIII LOll WORD If 32B1T SINIXl/I. WINIOi PROOOCT ACCUIlATIII , DIVIDEND IN ACClIUATIII PAC '~" g' FLSTIll,1 .CIE,5 TEIF2 , 16384 SUB SIICL ; INITIIII.SIMl'HASE HfHHHHHHHfHHfffH I«lW ZERO III.L TI£ ACCUIlATtIlS *HUHIIII.IIIII.IIIIIII LJIRI( lJIRI( lAC AlII) ARI,FlEQI MO,2 ; SET If l.DII' cruITER Fill TI£ FIRST 1lR£E , FILTERS ONLY, CIE,DlftFLG FLAGS TEIf' TEltPI ; !lET aJlAEIIf DIftF FLAG INTO TEIf' ; !lET STATE If DlIf' BIT INTO TElPI ; DlIf'LG I«lW EIIlIII.S DTlFBT ; LOAD A 1 IN TI£ FlAST BLOC!( FLAG POSITI(JI ; THIS HAS S£l TI£ FlAST JILOCI( FLAG RET 1111 ll.DII' , IF DIftF IS ON, ONLY DO 1lR£E FILTERS, lJIRI( MO,S ; B.SE DO III.L ·SII UIRP ARI lAC It , Fill £lICIt FILTER, DO JUII'I III:REIENTS If , ARI OVER 11£ FREIIN AlII) PIIISEII LOC/lTiONS, ................ 'HHHHH ............ II •••••• III.II ••• II •••• 111.1.".flllll' @ Zl.DII' ROUTINE' SQRT f<£FERfNC[ IN FLOIICIIAAT' IDlE i ADD SACL BANZ fUNCTJON' USED IN TIE LEVEL CAlCUJlTlON RWfINE. OEIIERATES TI£ SIJlIARE ROOT Of 'AN INTEGER, WITH 1\\1 OUTPUT WHICH cSATiJlATES AT 255. U. fHffHHftHl'IIIJII"II~III'HHHffH:fHHf-HHHH-IHHtHHHHHUH*fH .Stt ff".tHftHHHHfftHHH+IfHfHHfHHHttHfltHffHtff********tHffHfffH • THIS IS TIE SIJlIARE ROOT RfJI.ITlNE. TI£ RESULT RAt« IS ZERO TO 255 I\\ID IS TIE NEAREST INTEGER TO THE SIlUARE ROOT Of THE INPUT Nli1DER. ANY iNPUT NJIIBER IIHICH HAS A SQUARE ROOT r 254.5 WILL GIVE A RESULT IF 25S. THE INPUT MR1IIER ItUST lIE STORED IN TI£ PAIR OF LOCATIONS TEI1PlIHIGH) I\\ID TEI1P2ILOW) IN 2H2 FCIlI1, I\\ID ItUST lIE POSITIVE. t£GATlVE NlJtlBERS WILL GIVE TI£ RESULT ZERO. TEI1P IS USED AS A TEII"ORARY LOCATION, I\\ID TIE RESULT IS RETURNED IN TEIf>3. TIE ROUTIt£ TAKES 111 CYCLES. SQRT ALWAYS RETURNS WITH ARF = 0 LAt M,B SACL SlIB SACL TEI1P ONE TEI1P3 ; INlTlAL ROOT GUESS IS 127.5' 2**1 LARP SAR ARO ARO, SAIIPLE , SAVE ARO IN AN I.INUSED LOCATION UIRI( ARO,7 ; SET UP ARO FOR S ITERATIONS LAC SACH TEItP,IS TEI1P , HALVE TI£ IOCREI£NT LT ItPY PAC TEI1P3 TEIf'3 0 SUBH SI.IBS TEI1Pl TEItP2 !:> ;: BLEZ RTOOSII -C') ~ ...!:> ; LGAD UP 128 • 2"1 ; WORI< IN 2"1 FORI! THROOlHOUT. ; INITIAL INtRfIIENIIS 128 • 2"1 ~ 0 "" * LOOPO ~ C;l ;: ~ tl ~ ~ RTIJOIlG tl ~ "li .set ZALS SlIB SACL SAN! tl ~ ~ .... (') ~. § RTOOSII ZAlS RSDTIIF ., SQUARE TIE ROOT , ROOT TOO SItALL ; SlIBTRACT et.mEIIT IOCREi'lENT FROi'I ROOT AGAIN DTMf TEI1P3 ; RETRIEVE ARO .FROII ITS TElll'ORARY· STORE. FUNCTION' DETECT DTIIF DIGITS TEI1P3 .set ARO,SAllPLE fHHHHHHHffHHHUHHH*******HH-H-tHfHHff-HHtfHffH*HHfHfH* ; ROOT TOO BIG TEI1P TEI1P3 LOOPO END ; PUT ROOT INTO 2*<0 FCIlI1 LAR RET REFERENCE IN FLOWCHART: DTIIF (') ~ QQ TEI1P3.15 TEIIf'3 ROUTIt£. DTMF ~ ~ ;:: LAC SACH HffHfftHfHHfHff****HHHfHHffHHfHHDHffHfHffHfHHHHtHtfH fHffHIHHHHHHHHHHlffffHffHHHfHfftHffHHHHHHffH******H* • ; ADD CI.RRENT 1000000000T TO ROOT ;set £lID SQRT TEI1P IDI'3 LOOPO .set LDPK ZAC SACLC SACL SACL SACL SACL SACL SACL SACL SACL SACL SACL SACL SACL SACL SACL SACL SACL SACL SACL SACL LACK3 SACLTItP LDPK RET SIGCNT CHTH OORI CHTR2 STOP , ZERO YARIABLES GAP PAUSE F1 F2 F3 F4 FS F6 , ZERO FREQUENCY ARRAY F7 FS ADJL ADJH SElIA ; INITIALIZE SEIIAPHORE TESTG TESTB ; RETURN TO PAGE 0 ; END OF DTIIF PROCESSING .set LDPK , DTIIF PROCESSING ON PAGE 1 LAC XlIl AND SACL aliNP C) '" ;: ~ ~ LlI'K :::: ~ Sl 'Ol" ;: '\::l" 'C" <"I IIIITY fECI" IIIITY fEClft ; fECillATE 11£ SAII'l.ES, DTIF USES ; /I. TERllATE DIES, fHfHHHfIHfHfftHHfHftHttfHHUlIlllllllllllllllllllllllllHfHfffHf LT ; RETLIlN TO PAGE 0 RET SCAlE INPUT SAII'l.E SO THAT 11£ 2ND IHfHHHftHfHHHHfHHfHfflHtHHHHHHfHtHHfffHfHfHf**fHffH THIS SECTION ADDED TD ·III'RO'IE 11£ DVNA!lIC RIWlE BV PROVlDIMl A DYNAI1IC TIflESIIIl.D ftlNTHi IliICH ~ INTO PLAV DURING LOUD SIOOAlS, ffffHHfIIIIIIIIIIIIIIIIIIIIIHHlfHfHHHfHHHfHfl+ffHff:lf*fHHfffHf S: ;: 1:1 ;: LAC SUBAD..l ftiNTIIi,2 ItTHEII ~~ \::l '..." BIll ftElSE LAC SACH lAC SACL ADJL, !4 ftlNTHi IAlH ADDS SmI SACH SACl .set MEND LACK SmI IlEI LACK SACl ftNTlD( so ; SCAlE IT lIIIoW ; AND STORE IT AS 8TH (lti)ER X,15 L1N2 LID L1Nl ;NO lie N2tD Nl-)N2 NltC LVI,! l2N2 L1Nl,l NO+NI tC+N21D--)Y NO+NltC+N2tD+NltC-)IACCI IACCI-)N1 APAC ftlNTlli ftlNTIL ftiNTIIi,6 "INTItl "INTIL ; DECAY HAlF LIFE OF 700 SAII'l.ES SACH LTA SACH LAC NPV LTD i'I'Y - SACH LTA SACH "INTH "INTHi ; SCAlE INTO COORECT _ HHfHlfHfHHIIIIIIIIIIIIIIIIHHfHHHH •• llllllllllllf*VHtHfHHHtH I DTftF DEtmER PROCfSSIMl UNl L2C LV2,1 l3N2 UNl,l LAC X,15 NPV LTD l3D IIPY APAC SoW'LE,2 X,15 l2D APAC "INTH "INTHi UI'K! SACUl VI IMRfI.Qj llfUT ffHHfHfHHfffHfHHfHtfftHHfHfHHHfHHHHHHfHffHHHHHfffH LT NPY LTD NPY 15ft LAC NPYK PAC SACH LAC "INTIL LlI'KO VI SUB-FILTERS DO NOT 8TH !IlDER DETECTlDN WlNOClI Fill DTftF LOW BAND BftEND ftElSE C· ;: 0 (lti)ER HHfHHHffUttHHHfHHfIIIIIIIIIIIIIIIIIIIIHtfllllllllllll •••••••• fHH l:l.. iii' <"I ; GET LlNEM llfUT SAII'l.E .set INP Oq \::l XI fHfHffHffHffHfHHfHfHHHHHHHlHHfIIIIII.lllllllltHftHfHftfHf SACH LTA SACH L3Hl LX LY3,1 L4N2 L3Hl,l LAC X,15 i'I'Y LTD II'Y IV'AC L4D L4Nl L4C SACH LY4,1 II'/¥: II'/¥: S40I VI ~ S40I L4NI,1 HY4,1 II'/¥: S40I ZAlH SlIIH ADD! SlIIH S40I 11£ WTPUT IF 11£ 8TH ORDER FILlER (SIJIIF lND ORDER SUB-FILlERS) HIlS MY + 11£ _ITUIE (BY TI£tllV), SO 1I£RE IS IW !J'SCIU BY 00 lAlH SlIIH SlIIH S40I LVI ; PROCESS -RESIUS LV2 LV3 LY4 LY,I ; !J'SCIU BY 00 II!D STORE RESlLTS H4N1,1 HYI ; PROCESS RE5llTS HY2 HV3 HY4 HV,I ; LI'SCAl.E BY 00 II!D STORE RE5llT ZAlS IINZ_ PAUSE G/lPI ; LOO(JNG AT G/IP ? ZAlS IINl G/IP ; AGe IXES NOT Rtti lUliNG I 11£ G/IP T8 1I111I111f.11111111I'1111111I111.111111.IIIIIIIIIIIIIIIIHI11111.1"11111 1IIIIIIIIIIIIIIJlHHlIIIIIIIIIIII.1 8TH ORDERIETECTION WII/II(I/ FON DTlF HIGH _ • IUtlW\TE PEAKS HfHHIIHHfHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII.1. lAC LT C) no ;3 no II'\' LTD II'\' i:l X,15 HIN2 HID HINI Hie S40I LTA S40I 'ti ~ C5l ;3 no HYI,I I12N2 HINI,I lAC X,15 II'Y LTD II'Y II'/¥: H2O S40I HV2,1 R.S· LTA It3II2 S40I N2W1,1 lAC II'\' X,15 H3II H3II1 H3C ;3 ;:,. \:J ~ "li \:J no ~ ...... g' . LTD II'\' II'/¥: S40I PIC HV3,1 LTA IMN2 S40I H3II1,1 lAC II'\' 1,15 H4D LTD H4N1 II'\' H4C ; SAVE PEAK lIFO FON MlI lAC SACl lAC TEll'D AM. PIC TEIIPIl A1IJ.. HV ; SAVE PEAK- lIFO FON HIGH ASS SACl SUB I1lEZ H2C \:J ;:, SACl SUB I1lEZ H2II1 no LY ASS II'/¥: ~ I: ~ lAC PlCI lAC SACl ZAlS ADD SACl TEll'D AD..It PlCI TEII'D AD..It CNTRI ....ITV CNTRI IQ' 1JIC1( SUB IIGl PIIN CNTRI T8 ; SAVE PEAKS MIl "IN SAII'lES ZAC SACl CNTRI ZAlS CNTR2 ADD .... ITV CNTR2 SACl ; SET AGe FU\G AF1ER CNTR2 tl'llATES I UICX7 C} LACK SUB BIll ~ IN: SAC!. CNTR2 lACK SAC!. 1 STOP ;:s ...;;:, ;: ~ ~ ~ .;:, . <:) ~ , 6 • 7 • 0.25 \'IS tfHHffffHfHfHIHHHHHHfHHfHffHHHfHffHfHfffHHHfHHIHtHf CNTR2 TSTW T8 •THR tHftHfffHHflHfffHffHHHfftHHffHI-HHHfffHHfHffffnftHHHtttf* •!STW ;;:, ;:, I:>... tl ~'l"i tl '"...,..,~ (S. lAC SAC!. lAC LTA rfYK SPAC BIlEI ADJL TEIIPD lAC LTA ADJH,B ADJl.8 TIIlSHS Till ADJST D.Il TWSTHI DJl TWSTLO SPAC BIlEI RSDTtF lAC SUB BIlEI MINTHH AM TCNT , TEST FOR lAC MINTIfl ADJl , IN HI AHD LO BAHD • LT l!PYK PAC SACH LT rfYK PAC SACH LT rfYK PAC SACH MINI"~ SIGNAl TCNT TEI1PD I , CAlCUlATE NEW THRfSHlllDS IA!..S ADD SACL LN:K CNTR UNITY CNTR , IF Itf'llT SIGNAL IS , GO/£ FlI! MIN CONSEaJTlYE , ~S. RESET SVSTEIt ~IN SUB BGI CNTR TeNT , OR LOll< FOR GAP IAlS BI GAP , IS GAP REQUIRED ? •GAPl GAPe SAC!. SACL lAC SACH lACKl SACL lAC LT I'I'V LTA ~Y RSD~ !ill GH2 YS lAC SIGCNT CNTR THRSH8,13 TEItFD PAUSE Xl,12 GNl Al GN2 A2 APN: TIIlSHS,4 AM I SACH lAC VS,l ~Y B2 llli Bl VS I LTD ItPY LTD ItPY THRLO,4 SACH TlIUU,4 AM APAC lAC HlHHffHIHHIHIHHIHfHHfH+MHHHlffHHHHHfHflflHHHffHffH ASS • SUB THRESIO..D 8TH ORDER RESIl.T , IERO TEI1P CNTR SECND lAC SACl SACL SACl RSDTtF ~YK SUB BGEZ CNTR , GET LOW RESU. T , PlAKE POSlTlYE , APPlY TIIlESIIlLD , TEST FOR TWIST BEFIJlE ;:, VI LY SUB BLEI lAC SACL , ST!P WAITING FlI! FILTER TRANSIENT TEST FlI! TWIST - SET LEVElS WITH TWSTHI (Lo)HIl AHD TWSTLO (HDLO) ()q S lAC ASS flffHtfHfHHHfHHHffffIHffHt***HHfHHHHfHffHHf*******"******* tl ,.., 6 eo VS,l YS TEIIPD , USE THIS FOR GAP COUNT , GAP THRfSIIlLD = PREVS, 8TH THRESIO..D I 8 IDB) , Sf! FlAG FlI! GAP TRAP THRESIIlLD Itf'UT SAItPlE HIGI'ASS CHIIItlEl NOIAHD NOTCH OUT CP TONES VI 0 !lEZ I1/IP2 ZALS ADD SACl ZALS ADD SACl CllYR 00 I1/IP2 UNITY CIITR SIGCIIY lJUTY SIGCNT ,000000000TESllltPLES , AIIIMi GN' TIIIESI«llI , IN:REIIENT GN' COUNT THR2 IHHHHHIIlllllllllllllffHHHHfHHHffHHHHHffHHHHfHHHHHH INTER-DIGIT PAUSE IS IlETERIIIt£D BY FIII.lDIING INSTRltTlOO Hffllllllli ••• IIIHfHHHHHfIHfHHHIffHHHlfHfHHfftfHUHHffHH I LACK OICh , LOAD GAP TIlER 107 ItS + ) SUB IIGZ SIGCNT OOAIN , IS GAP TIllE lI' ? LACK O3Oh CNTR c;) SUB Il.EZ , SItOOTH rur GLITtlES , IF THERE AA; TOO lIMY SIIItPLES , ABIl'IE TIIlESIIILD, 00 GAP OOAIN ~ UFK CAlC i:l"' ZAC SACl SACl SACl B ~ 'ti I: ~ ["' "'t::I "' ~ ~ GN'C RSDTIF THR3 THR4 l1fi5 TlIlESHOI.D 2ND DRIER RESlLTS BNZ GAP OOAIN 5. ZALS ~ UI:: AIlS LVI SUB !lEZ THRLO THRI ZALS FI BZ t::I "l'j t::I no ~ Il. All) 001 UNITY SACl F1 LY2 AIlS LY3 TIIlb ZALS ADD UNITY UI:: TliRl.O F3 F3 LY4 TIRIl 004 ZALS ADD F4 SACl F4 HYI UI:: AIlS UNITY SUB !lEZ THRHI l1fi5 ZALS ADD SACl F5 UI:: AIlS HY2 UNITY F5 THRHI OOb Fb lIIIlTY Fb UI:: AIlS HY3 SUB Il.EZ THRHI 1HR7 ZALS F7 lIIIlTY F7 HY4 ADD SACl THR7 UNITY F2 TIIl3 . SACl STOP TCIIY UI:: UI:: AIlS nm SlJ8 !lEZ ZALS ADD fHffHHHffHHHfHHHHHfHHfflfHflllllllllllllllllHlfHfHHffHHH ZALS F2 SUB Il.EZ I SECND ZALS ADD SACl ·ABS SUB a.EZ fHffHHffHHfIIIlIIIIIIIIIIIIIIIIIHHHHflllll ••• 111111111111111111111111 1:0 g' ,RESETSYSTEII TIRIl SACl GNI IJI2 Y5 SUB Il.EZ UI:: AIlS SUB !lEZ THRHI TCIIY ZALS ADD FB SACl FB UNITY c;') TOO ~ D,2 0, TEJt>D TElV'D ADD CAlL XFU'D .set S AGAIN IIFINl F8 ; + LOW-BAND ffFSET *4 ,t HIGH-BAND IFFSET ZALS TESTS ADD SAC!. LNlTY TESTS , IN:REIENT BAD DIGITS LACK SAC!. 8 1 GAP AGAIN , TII'£ lilT VALID , r«IW LOOK FIll GAP HfIlIII •• II •• IIIIIIIIIIIIIHff HfHHfHHHfHHHftl+HHfHlMHHHHffIHfHIHHHfHfHitfHHHHHH OUTPUT ROOTlNE ROOTlIE: INTHDL 1111111111111 •• IIIHHHfHHHofoIHHHHf-IHHftHHfHiHtfHtHHfHf-HHH** •DINT SAC!. LACK ADD SAC!. Lll'K LAC AND 86Z C) ~ :3 ~ ~ ~ Ul'K ~ DIGIT 070h DIGIT DIGIT 0 (JE,DIINBT STIIlIE IIMltIi I 080h LACK ADD SAC!. Lll'K 0 EINT LAC SAC!. OSIWI OSTlIE S· LAC AND (JE, TPRFLG FLAIlS ~ ::. 8Z BTINT t::J LAC III SAC!. 1JIE,1JISfLG FLAIlS FLAIlS LAC' xtI! (JE,DTINBT STIIIIE STIIIIE &l ~ (:;l :3 ~ •IIlI/RUI t::J ~ g !:>.. DIGIT DIGIT ~ ~ t::J ~ •DTINT 1i> C'\ g. :3 •!WITTEN AND SAC!. FUN:TIOO: INTERRUPT HANlLER *HflH+fHHfHffIfHfHHHlllllllllllllltHHHfIHHHHHHHffflfflHlH INTHDl .set SST Lll'K SACH SAC!. Lll'K SIIR SRSA\£ 1 OCCUHI ACCULO , SAlt: STATUS REGISTER , SAlt: ctWTENTS llF ACCIJIILATal 0 ARO,MSAVE UIRP SAlt: ClIlRENT AUXILLIARY REGISTER IN MSAVE POINT TO ARO IHffHHHHHffHff**UHHHfHlllllllllllllllllllllfHflHfHHffHHHIH OQ !:>.. , INTERRlPT PROTECTED BW\USE TI£ 0YEIlRUII , BIT HAS NIIT lIfEN UPDATED YET REFERENCE IN FLOWCHART: NII'£ om SWlCE llF INTERRlf'T, EnIER COlEe 00 PARALLEL INTERFACE. IN LIIC AND lTEIIP,CTLPRT , READ ctWTROL REGISTER 11'£,3 ITEIV' , om FIll COlEe INTERRlf'T BIT BZ IIlTCOC , SET fHtHHHHHMHHHHfHllllllllllllllllllllllllllllHHHHHHffHHHfH CODEC INTERRlPT HANlLER STIIlIE fIHHHHHfHHHHHI .... III ••• UIIIIIIIIIIIIIIII •• IIII'I.IIIIIIIIIIIIIII •• au ATTEN COIIEC C) S .set , COlEe INTERRU'T HANIlER ADDS SACL ~ ~ ~ 'ti ~ ~ IIiEAII (lIT CTL320 ITEIP ITEIP, CTLPRT LAC (JI SACL IJ£,INTFLG FLAGS FLAGS , ClEAR CODEC INTERRUPT TIE STATE BIT WAS MIT SET, SO IE AIlE AT TIE BEGIIIIIIIl OF A TRI1HSFER IfERATlCII, EITIER READ (JIIilITE, READ IfERATlII6 REQUIRE TIll TRANSFERS IJ£ EACH IlAY, illiTE TRANSFERS REQUIRE TIll TRANSFERS IN EACH DIRECTlCII AlII TIll INTERRU'TS, WHICH IS IIIf A STATE BIT IS REQUIRED TO FLAG TIE SECCIID HIilF OF A WRITE IfERATlCII. tHtHffHHHfHfHHHHHfHHHHHflllllllllllllllllllllllllllllllllllll1 , SET COlEe INTERRII'T INDICATOR FlAG IN ITEIP ,DATPRT , READ CONIIIl FlIOII INTERFACE. , ItASK INTERFACE LAR ARO,GIN , LOAD lJ' TIE GIN POINTER LAC IJ£,5 SUB (lIE IN f,CDCPRT , READ NEXT LINEARIZED SAI1Pl£ INTO ' Ql£IJE IN SIGNED 1tAIlN1~ FIlRII. AND SACL ITEIIP ITEIP LAC LAC AND IJ£,RllBIT ITEIIP :3 GIN IJ£ ITEIP , DECREIlEHT THE GIN POINTER. SACL I:l LAC (JI SACL B ITEI1P GIN CINEND Ol :3 ~ i::l ~ C e., SUB , CI£CI( CINWi) TO 5 BITS RW BIT, IF IT IS SET, THIS IS A , READ. OQ :3 !:>.. i::l ~~ INTEND .set i::l LACK ~ SACL OOT ADDS ~ ~ g' CINEND LAR OOZ IJ£,3 • 7 CTL320 ITEIP ITEIIP,CTLPRT ARO,ARSAYE LIJ'I( I lALH ADDS LST EINT RET ACtUHI ACCtJl.0 SRSAIJE , POINTER COONTS 003Fb TlRJ 0038b , lI'DATE GIN , C£MlN EXIT PATH FRIll INTERRlJ'T HANIlER THIS IS THE FIRST PART OF A "'UTE TRANSFER 11'111111~lllllfHHHHHfffHfHfHHfHflHHfH+HlHHHffHHfHflf*HH f illITE! .set , ClEAR ALL LATCHED tOI-COIIEC INTERRlJ'TS , RESTORE ARO LAC OR SACL IJ£,STAFLG FlAGS FLAGS , RESTORE ACCUIUTOR , REST(JlE STATUS RESISTER LAC SACL ITEIIP CltsAVE f ACkNll f PARALLEL INTERFACE INTERRUPT HANIlER (lIT - .s.t , PARALLEL INTERFACE INTERRtJPT HANIlER LAC AND IJ£,STAFLG FLAGS 001 IIlITE2 , CI£CI( STATE BIT, IF IT IS SET IE ARE HIilF , IlAY TIRIOOH A illITE IfERATlCII AND I'IJST , DO TIE SECOND PAIR OF TRANSFERS. , SAVE TIE CINWi) BYTE FOR TIE SECOND PART , OF TIE WRITE TRI1HSFER. STItOOE,8 ITEIP ITEIP , ACKIQIlfDGE illiTE BY WRITING OUT STATUS , TO STATUS PORT IISOOFF ITEI1P ITEIIP,STAPRT , ALSO CLEARS _ INTEND THIS IS TIE FIRST PART OF A READ TRI1HSFER VI 1IIIIIIIIIIIIIIIIHHffHHfHHfIIIIlIIIIIIIIIIIIIIIII.IIIIIIIIIUHUtHlHf f , SET TIE STATE BIT TO FlAG THAT TIE FIRST , PART OF A illITE IfERATlCII HAS BEEN DIJ£. .Sft LAC SACH LAC AND SACL HHHffHHHfHHIIIIIIIIIIIUIIIIIIIIIIIIIIIIIIIIIIIII ••• IIIIIHHHHnlH MlTCDC READIl' *"UfH+lffHUfftfHfHHHfHfHHffIlIlIlIIUIIIIIIIIIIIIIIIIIIIIIUII .. 1I READIJ' .s.t INTERRUPT SOORCE. VI LACK N ADDS [NTTAB ITElI' ; LOAD UP THE START ADDRESS (I' [NTTAB • ADD ON THE INTERFACE COItIM), WHICH [S AN (l'FSET INTO TliE INTTAB TABlE OF REGISTER HfffHfHffHHH+HHH-Hfl-H+HHf+fHHfHftHHHHHfHHHfHflHHHH THIS IS A READ OF THE CURRENT TIlE lIS REGISTER. IIAPP[NGS. TlIlR lTEtIP ; READ THE REG[STER tIAPP[NG. fflHHfHffHffHHfHIII,IIIIIIIIIIIIHHHHftHHHfHHHHfHHHHfHf* UIR MO,lTEtIP ; ; ; ; , , TBTSET tIAPP[NG ImD [N MO. THE IW' ImD [ND[CATES WHICH PHVS[CI'L IUOCATION [S TO BE ACCESSED [N ITS LOWER 9 BITS, AND ALSO COOTA[NS COOTROL fLAGS IlH THE UPPER BYTE. THESE CONTRlL fLAGS ARE USED BY TliE [NTERRUPT HANDLER TO [ND[CATE WHAT TYPE , OF TRANSfER [S fIIlPPEN[NG. ... t LAC SACL CRTIIE CROOLD , SAI'EWCURRENT TIlE UBITRO l*fHHfHfHfHIHHHfHffHff"*HHHfHI+HHflHHHHHfHfHtHff***** AND 1lHE, TESTBT STIllDE BZ NOTEST LAC IlHE,LBlT ITElI' LAC ; CHECK fOR TEST BIT SET [N MODE REG[STER , WH[CH lEANS THAT TEST MODE [S Clm£NTLY THIS IS A READ OF THE STATUS REGISTER. ,ON AND IHHHftHHHHHfHfffHfHfH+ltHfHfHfH**HHHfHH"**HHfflffHfH , CHECK FOR L BIT SET [N ti\P IOlRD , WH[CH lEANS AN ACCESS (I' ADOR 0 OR 1 SBTSEr .set LAC C') ~ r> ~ :!;; l:: NOTEST OUT CI1SAI'E, DATPRT ; ALL OTHER REG[STERS [N TEST IllDE ARE , IW'PED ONTO THE SAlE REG[STER (CI1SAI'EI. [NTEND IlHE,TBIT IIDf> OOZ TBTSET LAC AND IlHE,SBIT IIDf> OOZ SBTSET £:: ::s LAC s::. ::s AND IlHE,UBIT ITElI' BGZ liIITRD '"r> ~ ::s r> t:I r> n <:) ()Q b ~ ~ t:I r> ~ NOTEST LAC (I' SooDE INTEND , CHECK FOR T BIT SET [N ti\P ImD WH[CH (I' CLIlREIIT TIlE , lEANS A READ TH[S IS A READ OF THE UPPER BYTE BITS (I' THE IW' WORD (I' THE LOCATION SPECIF[ED IN THE LOWER 9 HHfHfHflHHH-lffHfHftHHHHHtHHfHfHfHfflAHHlfffHfHffH**** , CHECK FOR S BIT SET [N IW' ImD WHICH , lEANS A READ (I' THE STATUS REGISTER ; CHECK FOR U BIT SET [N ti\P ImD WH[CH (I' AN UPPER BYTE •UBITRD •••t LAC ',8 SACH OUT ITElI' ITEPIP,DATPRT , lEANS A READ [HTEND .HHffHHIIIIIIJJIIJII.llffHfHHHHHfHl.IJJJIIIIIIIIIIIIIIIJfHfHfffH +HH+H+fMIIIIIIIIIIIIIIIUIIJ IllIIlHtHHHllIllIllIl1 1111 Jill UllI UHUH THIS IS THE SECIlHD PART (I' A WRITE TRANSFER TH[S IS A READ (I' THE LOWER BYTE OF THE LOCATIOH SPECIFIED IN THE LOWER 9 BITS (I' THE IW' ImD AND ALSO IN MO. fHHHUHflllllllllllJIllHfHfHffHtHftHHfHfHHHUHHfiHHflHHH n 5" ::s SOODE,8 lTElI' ITEPIP,STIIPRT; WRITE OUT lIS BYTE HfHHffHH4HH-HfHHHfHfffHfHflll.'I.U.JIII'llfHfHftHHHHitHtH AND 'ti<:) SACH (lJT OOZ IlIT .,DATPRT INTEND .set XOR SACL FLADS FLADS ,a.EAR STATE BIT IN FLAGS REGISTER LACI( CJ no no ADDS ;::: i:l INTTAB Cl!SAI'E ADD ~ TIE SAVED INTERFACE rovtAND, WHICH IS AN IFFSET INTO TIE INTTAB TABLE OF REGISTER IWI'IIKlS. READ TIE REGISTER I!APPING, TII.R ITElI' LAR MO,ITErIP C IN C;l LAC no SACL Cl!SAI'E,DATPRT ,READ TIE DATA IN WHICH IS TO BE IIlITTEN , TO A REGISTER, USE Cl!SAI'E FOR THIS. Cl!SAI'E PISOOFF Cl!SAI'E , MASK OUT UNDEFINED BITS ~ THIS IS A WRITE TO TIE tIlDE REGISTER f'lSTSET ~ '"no lIND ;::: .set , HAPPING WOOD IN MO. (J'ERATIIH> TO BE PERFORMED IERE ARE: 1. CIlFY TIE BYTE IIlITTEN, INTO TIE MCOE REGISTER. PRESERVING TIE STATE OF TIE RC BITS WHICH ARE ALREADY IN TIE NGIE REGISTER IN POSITIONS 0 AND 1. 2. SET TIE SArIPLE SCALE FACTOR ACCORDING TO THE SC BITS. 3. IF TIE TEST BIT HAS BEEN SET, lIEN CLEAR THE DTIf' lIND TOlE BITS. 4. IF ANY INTERRlI'TS HAVE BEEN ACKIOILEIXiEII IIACK BITS SETI lIEN SET TIE APPR!PRIATE STATUS BIT BACK TO A 1 AND !PDATE TIE STATUS OF THE XF FLAG. S. If THE TEST BIT IS SET, THEN IX) A SELF TEST, ACKIIlWl.EIIGE THE WRITE, THEN RESTART, ELSE ACKtOILEIJGE TIE illiTE AND RETIRl FROM INTERRlPT. tl no LAC C lIND (I£,I1IIIT ITEIt' ()q OOZ MBTSET LAC lIND (1£, TESTBT STMCOE , CHECK FOR TEST BIT SET IN IIlDE REGISTER , WHICH MEANS A TEST IIOIE IS ClmENTLY ~ BZ CHECKF , TEST MOlE NOT SET LAC lIND (I£,LBIT ITElI' , CHECK FOR L BIT SET IN I1AP WOOD WHICH , MEANS A illITE TO AOORESS 0 OR I Bl ACKNGI , TEST MOOE. LEAVE DATA IN Cl!SAVE LAC lIND (I£,FBIT ITEIt' , CHECK FOR F BIT SET IN I1AP WOOD WHICH , MEANS A illITE TO A FREQUENCY REGISTER 001 FBTSET LACI( LAC lIND M,LllIT ITEIt' SACL OOZ liIITWR 1'\ E:: ;::: 1::. ;::: !:I. tl ~ "lj tl no ~ 1'\ 5";::: CHECKF , CHECK FOR " BIT SET IN I1AP WOOD , WHICH lEANS A illITE TO TIE NGIE REGISTER HffHHl-tHHffHtHHHtHfHHHHHfHHfHHHHftffHHHHfHH"**"H LAC ADD ADD AND SACL AND , CHECK FOR U BIT SET IN I1AP WOOD WHICH , MEANS A WRITE TO AN If'PER BYTE LACK ADD TBLR HfHfffHUHHHfIfHfHflfHHHHfHHfllllllllll'I,I'.'HfHf-HHftHHH LAC THIS IS TIE SECOOI PART OF A WRITE TO TIE LMR I'IILF OF A REGISTER SUB IISOOff,8 M,1 M STNGIE STIIOIE , ZERO MOOE BYTE, EXCEPT FOR TIE BOTTOM TlIO , BITS, AND STORE BACK IN STMOIE 3 Cl!SAVE ITEIt' , EXTRACT THE SC BITS FROM THE BYTE BEIMl SCATAB ITEIf' SCALEF (1£,8 M,2 HtHHHfIHHfHHHHHflHffHfHHfHHf-HHHHHHHfHHffftHUHHH (.II LIlWWRT LAC UIIIWR2 lIND ADDS SACL AND ADDS PISOOFF,S CMSAYE , ADD TIE ClmENT COO"ENTS OF TIE LI'PER , REGISTER TO TIE NEW LCloIER HAlF SACL Cl!SAVE STNGIE STMODE AND (1£, TESTBT STMODE Bl CLAACK LAC ACKNGI , I1ASK IN STATUS BYTE AND RC BITS IN MODE , BYTE. , WOOKED , ADD IN TABLE OFFSET , READ TIE OESIREG SCALE FACTOR INTO SCALEF I1ASK IN LCloIER BYTE, EXCEPT FOR TIE BOTTOM 00 (SCI BITS, OF TIE BYTE BEING IIlITTEN TO MCOE ADD TP STNGIE. PIlIIE IS NGI !PDAlED, BUT TIE BGTTOM 00 (RCI BITS lOWE BEEN LEFT INTACT IN TIE READABLE VERSION IlF MODE. CHECK FOR TEST BIT SET IN MODE REGISTER WHICH MENAS THAT TEST NGDE IS CURRENTLY ~ W u. ~ SlFTST TESTY •ct.RACK LAC SACH LACK lIND SAC!. LACK ADO TIIlR LAC 00 SAC!. ENIlSLF CItSA\£,14 CItSA\£ 7 CItSA\£ ROOTINE' CRESET REFEIIENCE IN FLtN:fIMT. to£ , I1ASI( IN TI£ ~ IACKBITS ITEIf' ACKTAB ITEIf' ITEIf' ITEIf' STItJIIE STItJIIE , ADD IN TABLE OFFSET AlHCTlON' CG.D RESET HANIl.ER HHHUI+tHHffHHHfHfHfffHHHHfl III. I ••• 11 •• II ••• HHfH4HHHHtH , INITIALISE f'ROC£SSlll , STATUS BIT TO BE SET TO I, IF ANY CRESET XFUPD , I.I'OATE XF FlAG CLROI'F HlfllfHfHffHHHfIfHHffHffHfHHHfffHfHfHlHHfHHfHlfHftHHH ~ THIS IS TI£ SECOOD PART IF A WRITE TO A FILTER WlTER FREIllENCY FBTSET .set LAC lIND ~ '"til ~ &. ~. tl ~~ tl '"~ _,8 FllSFL . RSTFIL CALL RSDTIF , REINITIALIZE TI£ DM COlE EINT B , ADD TI£ rulRENT CONTENTS IF FREI!£NCY MS , BYTE MIN , Jlif> TO MIN (MINSTREAI1 COllE) CALL RESET FILTERING RlJJTINE TO CLEM DOII'I ALL ACClI«LATORS lIND SET UP FILTER READY Fill TI£ FIRST BLOCK. , ENABLE INTERRUPTS ROUTINE' ~SET 11111111111111 •••• lltHH-fH4HfHHHHHfHHfHHfHfHfHH+HHHHHHff REFERENCE IN FLtN:fIMT. NONE _ THIS IS TI£ SECOOD PART IF A WRITE TO TI£ UPPER HALF IF A REGISTER FUNCTION' WARII RESET HANll.ER HfHHftHHtHHHt+HHHH+lHHHHfffHHHHHHHfHHHHHHfHHfH UBIM • set LAC lIND ADO IffffHffHffHfHfIHffHHHHfHfHffHHHHfHHfHHfHHHHHHflHHf , RE-INITIALIZE f'ROC£SSOR •CItSA\£,8 , ADO TI£ ClIlRENT CONTENTS IF TI£ LOWER , REGISTER TO TI£ NEW UPPER HALF XFlI'D , UPOATE TI£ XF FlAG (ONLY AFFECTED BY , WRITES TO TI£ CONTR(L TEGISTER.) CALL fHfHffHHH,"**"**.fHfHHfHHHfHffHHHffHHfHHHfHHHHHftH ~SET SAC!. () g" ~SET CALL L0WWR2 l:> ;:s l:>.. CALL HfHffHf,.IHH+HHHfHHffHIJIIIIIIIIIII.lfHfH+HfHHHfHHHfHfHH ;:, 'tl" , SET OVERFLOW rillE SOVI1 fHHHftH+H++HfHtHfHHHfHHHfHffftHHHHHHHffH-IHHffftffH*' 'ti , CLEM OVERFLOW FlAG UIRP C) ~ , INITIALIZE OATA PAGE POINTER CLROI'F BY ACKIOI ~ , COLD RESET, IIRAN:H I£RE FRa! RESET , \£CTIll. .Stt lIIPI< , SELF TEST IIRANC1£S BACK TO I£RE .set CALL , IIRAN:H TO TI£ SELF TEST RlJJTIt£ .set , WARII RESET. CALLED BY SELF-TEST RWTIt£ , lIND BY CG.D RESET HANIl.ER. fHHHffHfHfffffHHI'IIIIIIIIIII •• lffHH+ffHffHHHffHIIIIIIIIIIIIII •• ACKNOW ZERO ALL RAIl LOCATIONS IN PliES 0 ~ 1 C) 1IIIIIIIIIIIIIIIIIIIIII, •• IIIIIIlIIIIII.IIIIIHHHHHHHHllllllllIlJIIIII. ~ ~ ~ 'ti ~ ... t:;l ::. ... tJ i \:I ::. ARO,OFFh LARK •IEROO , SET IJ' ARO TO CONTRIl. ClPYIMl LOOP lAC OUT CTL320,CTLPRT 1.£1&: BITS FRIll CTL32O. KEEP THIS AS TIE !£FIlLT !/AlL( IF CTL320 IN IWI SET IJ' UMOR CONTROl REGISTER BITS TO LAR SAC!.. /!ANI •IEROO LACKI SAC!.. (J£ PAllO IlET fHfHtHllfHHHfHffHHHflHllllllllllllllllllllHHHHHHHflHHfHH ROUTINE' ATTEH UIPK I SAC!.. UNITY UIPK 0 REFERENC£ IN FL.OOIMT' N(J£ FUNCTII*' WRITE ruT STATUS TO DRAW ATTEHTIIlII TO A CHANGE IN OF TIE STATUS BITS. (J£ OR tOlE ffHflllllllllllllll.IIHHHfHHHHffHflHHHHHHHHHHHtfHHHHH •ATTEN INITIIUIE DTIF PEtIllY LOCATiOO IN PAGE I ••• t *HfHHfHIHfI.IIIIIIIIIIIIIHfHHf+HHHfHHHHHHfHHH**"lHtflfH tJ LARK LARK ~ "tj ~ CTL320 7C9Oh 1:1.. ...tJ SAC!.. ClPYO <"I g' LAC SACII ARO,IIENOO-IVllRo-ll , SET UP ARO TO CONTROL ClPVlMl LOOP ARI,IIENOO-II, SET IJ' ARI TO POINT TO DATA SltI LACK CIJ£NO SUB LAR TIl.R BANI (J£ ruT , LOAD ACClIIIllATOR WITH II + END OF TABlEI STI1OIE,8 ITEII' ITEtIP,ATTPRT, WRITE OUT lIS Bm: OF SlIKlDE IlET HfHHHlfftHHHHHfIHfHffHfHHffH-fHfIII.,IIIIIIIIIIIIIIIIIIIIIII. I • PARI ROOTiNE' XFUPD "',ARO ClPYO REFERENCE IN FI.OI.OiART' NINE ffHlfffHH ••••• IIII •• IIIIIIIIHHfMfHffHfHHf-HHHHHHfIH.HUHfHf INITIALIZE ~ IETECTOR LOCATI~ IN PAGE FUNCTION' _TE TIlE XfFlA1. CALLED EVERY T11£ A STATUS REGISTER INTERRIPT FIA1 IS _TED, AND EVERY TlI£ TIE CONTROL REGISTER IS WRITTEN TO. (I tfMllfHHHfHfHHHHHfH"IIIIIIIIIIIIHHfHffHHHHHfIHHlfHffHf HffHtlfHHHfHfHHtHHHHfHHlfHfHHHHHHHHHffftHHHHHHH ClPYI VI VI LARK LARK ARO,(IENDHVllRHI , SET UP ARO TO CONTROl ClPYING LOOP , SET IJ' ARI TO POINT TO DATA IWI. ARI,IENDI-I LACK CONENI SUB LAR TIl.R BANI (J£ OUT •XFlI'D .set AND _.8 STIIlIE CTLTSL ClPYI SAC!.. LAC AND 1tSOOFF,8 ITEtIP BI SETXF ruT CTL32O,CTLPAT ,SET UP LIllER CONTROl REGISTER BITS TO , FD9Fh CTL32U,CTLtJI'R ,WRITE VAlUE ocm TO IJ'PER CaNTRIl. PORT LAC CTL322 ClRXF XOR LACIJ£,CIFSIT , INTERRIPHSI ASSERTED CTL320 , CLEAR XF BIT CTL320 , LOAD ACCIJItU.J\TIlR WITH (I + END IF TABlEI LAC XOR PARI "',ARO , RfSET TIE PORT CONTROL SIT TO POINT AT , TIE L~ CONTROL PORT, AND SET SCLK TO BE AN OUTPUT. ClEAR TIE IWTERRUPT ACKNIII(I AND 1TEIt' , ANY BITS MIN SET I£AN PENGIMl ENABLED , INTERRlPTS? SACI. .... 0'1 Ut Cll320 RET I LAC III SACI. serXF IJ£,CXFBIT Cll320 Cll320 , NJ IN1ERRIJPT , ser XF BIT UIIIEI..2 , CTL320 WILL GET liRlTT£N TO lIE ar.rrROI. , REGISTER OORINJ lIE NEXT COIIEC INTERRI.I'T, RET flHHflHHHlffHHtllllJllllllllllllllllllllllllllllllHtHfHHHHlfHfH I SACI. ACCHLD ZALS ADDS SACI. ROML TOTIL TOTIL ACCHLD LAC BNZ ROII.P LAC BNZ TOTIL IlESlA.T , CHECK AI! ZERO 0ECKStJI ROUTINE' Sl.FlST IlEFEREII:E ,IN FLOOMT' tIl£ Cl ~ ~ RAIl TEST FUNCTION' SElF liST IF PROCESSIR. PERFIIII1 INTERNIL RAIl TEST AND ROIl CHECKSllt TEST. SElF TEST USES lIE STIO: AS A HWIINJ REGISTER. AT T/£ END IF lIE SElF TEST, lIE I'ROCESSOO IS REINIlIILIZED AND lIRAID£S INTO lIE MIN STREAIt COlE. lIE CUNTENTS OF 11£ STIO: ARE D15CARIEl. EACH TIlE A VALL( IS PUSHED, lIE STIO: IS FlAST POPPED, TO FfiEYENT STIO: IlIIEIlFUII IESSAIa FROII DCruIRINJ DN SIIILlATIIlS. TIESE ~ f'(f IIISTROCTIDNS MY BE ~, 1I£Y ARE IlARl .. SACI. t:J CDCTST TOTAL , SET C/£CKSlI'I TO ZERO I IJ£ I , RESTORE T/£ UNITY LOCATlDN ~ UI'K SACI. UNITY t:J LAC I1ARI(tR '"l"l ~ ~ ~. ROII.P UI'K 0 SIll TBLR IJ£ ROIIVAL PUT RAIl FAIL IlESlA.T INTO STACK ARO CWlTS 0100II ITERATIONS IF OOTBI LOOP ARI COONTS 16 ITERATIONS IF 1tt£R l.OIP START WITH IJ£ , STORE IN RAIl LOCATlDN , READ IT BIO: AND CHECK IT BY SUBllW::T1DN SACI. SUBS BNZ Sl.FlST , , , , , , SHIFT OPERAND LEFT BY IJ£ BIT, REPEATINJ , Fill EACH BIT POSIlIDN. FINALLY CHECK THAT BIT IllS SHIFTED OOT IF l.IJIER ~TIIl (FFFFOOOOh IN ACe' FLIP BIO: TO MO, REPEAT IHl.E AI! EACH LEAVE TESTED LOCATlDN AT ZERO RAIl LOCATlDN .set COIIEC IIITERRU'T CHECK 1HIIIIIIIIIIIIIIIIIII,IIIII •• IIIIIHHHHfHHlHIIIIIII ... 11111111111111111 , _ END ADDRESS IN ACCUIIA.ATIIl , 1+' seE NJTE IN ROUTINE I£AIER. f'(f CALL WRESfT ZAUt IJ£ , DO A _ RESET TO RE-INITIILIl£ ALL , YMIABLES C'l <1> ;: ... <1> SUB 1l£,7 AND S4ICL CTl320 CTl320 , CREATE IiISK TO ENAEl.E MY CODEC , [NTERRlPTS [F PATH IlfACl£S !£RE, ALL TI£ TESTS HAVE BfEN SlIXESSFlL IfHtHUHIHHfHHfffHffHHfHHfHHHHHffHH+HfHffHII.11111111111 I:> Cl ;: E[NT CTL320,CTLPRT ,ENAEl.E CODEC [NTERRUPTS (H.Y, [N 1iISK. , (H.Y TAKES EFFECT IIFTEI1 TI£ NEXT E[NT MO MO, [NTIIAX , LOAD MO WlTH TI£ PI'IWU1 tu1IIER OF LOO'S , EXPECTED IlETWEEN [NTERRUPTS. LOOPA [S 6 , CYCLES LIHl. , COOEC [NTERRLI'T5 NOW ENABLED. <1> LAC AND xm SACL Il£, [NTFLG FLAGS FLAGS FLAGS OOT ~ :::: UIRP 'tiC) LJIRI( '" <1> t::l <1> 'I:>.." C) ~. HHfHfHfHfHf+f+HHHHfHHHHI.IIIIIIIIIIIIIIIIIII.lllffHHtHHHfH LOOPA I:> ;: l.ACI< PUSH ~~ t::l <1> •FSHNT ~ END '"g.;: • LOOPB LABEL3 , CLEAR [NTERRUPT [ND[CAToo FLAG. AWAlT , NEXT [NTERRLI'T, COONHNG LOO'S WlTH ARQ Il£, [NTFLG FLAGS FSHNT ; BRANCH II£N NEXT COOEC [NTERRLI'T ARR[VES BANZ LOOPA , LOOP UNHL MO COCERR =0 m RESULT SACL FLAGS FLAGS ; CLEAR [NTERRUPT [ND[CATm FLAG LJIRI( MO,INTIIIIX BANZ LOOPB ; ; ; ; ADOS LOAD ARO WHH THE PI'IIl/'iJl1 tIJI1BER OF LOOPS EXPECTED IlETWEEN [NTERRUPTS. LOOPB IS 6 CYCLES LIHl. AWAH NEXT INTERRI.I'T, COONHNG LOO'S WHH MO ; AUX REGISTER NOT ZERO YET. LOOP , AUX REGISTER ZERG. INTERRUPTS TOO , INFREQUENT CALL RSTF[L ; PUT CODEC INTERRUPT FAILLIlE RESlLT 00 ; STACK Vl -...l MO,ITa1P SUB INTlFT ITErif' BLZ COCERR l.ACI< ; CALL RESET F[LTER[NG ROUHNE TO CLEAR ; ~ ALL ACClII.LATooS AND SET UP FILTER ; READY Foo THE NEXT BLOCK. CALL RSDTI'F ; REIN[T[ALllE THE OTMF CODE 5T1100E,8 HEIJ' ; ACKIDUOOE THE illITE IIUCH CAlro TI£ ; SELFTEST BY IIl[T[NG OOT STATUS LAC OUT ITErif' I1SOOFF ITErif' lTEIJ',STAPRT LAC SUB Cti',3 Cti' ADDS CTL320 HEIJ' lTErIf',CTLPRT ; CLEAR ALL NON-CODEC [NTERRUPTS SO THAT , IV('( SNU OUS FSX 00 FSR [NTERRI.I'TS ; GENERATED BY SUB-STAIIDARD HARDWARE WN'T ; HAN) UP TIij SYSTEH. ; CLEAR ALL LATCHED NON-CODEC INTERRUPTS EINT PI'IIN PRGEND SAl! ; RESTmE TEST I100E BH. LAC SACH SACL OOT COCFAI ; O[SABLE [NTERRUPTS. ; 00 A WIIRI1 RESET TO RE[N[T[AUZE TI£ ; PROCESSOO ; RETR[EVE TEST RESlLT FRO/1 STACK SOODE 1l£,7 SOOOE RESlLT GOTINT WRESET ADO SACL AND SACL ; NEXT INTERRUPT HAS OCCURRED .set l.ACI< PUSH .set POP ; [F MO REACI£S 0 THEN CODEC ERRoo. Il£, [NTFLG FLAGS GDHNT CODEC [NTERRUPT CHECK D[NT CALL UNT[L AN [NTERRUPT COCERR LAC AND IINZ (F IHHfHHHHHfffH+HHHHHHfflfffHHH-IHHtHHHHHUIIIIIIIII.II.I LAC AND IINZ xm , PUT TEST PASS RESlL T ONTO STACK fHlfHIHHfHIH*+HHHHffHffH+HHHH-H+H*HHHHfHf ........... fHfHf I:>.. t::l PASS ,lIIord ; CHECK Fill INTERRUPTS TOO FRED\ENT .end ; [GNORE THE STACK AND RESTART. ;ENDOFI'ROOAA'II1ARKERFooCHECl ~ ::t <1> o [ ~' ;::, ::t I:>.. o ~ 'li o ~§' Craig ftarven !'lay 1988 {SC-,U-} {ColRpiler directive for corl'tct operation of Keyprused function} Const ERRORX = 1; {X cllordinde for error MS5age } ERRmV =24; {Y coordinate for error lIuSige } OFFSET =$300; {Change this if board address is not O3OOh} I'UTEBLOCK = 23; {Co I WIn address for lfJ'ite data } READIlOCK :: 66; {Co I Uln address for read data } DISP' Arrly[I •• 501 of Inte,,. =10.0.0,0,1,1,1,1,1,1,1,1,1,1,1,1,1, 2,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,0,0,0,0,0,01, {Cursor Y disph.cnent for any given rOlf position} FIRSTCQ. : Ar'ly[S•• 191 of Integer = 0,1,5,5,5,5,6,5,5,5,5,5,5,5,31,~ > 1:~ ~1 End; End, {Ca.el End; {Soft-cursor} 8 ~ ProceduN! Error..fItsSlge (MESSAGE: Errorstring); { This prceoure places a Mssage in red (blinking) at tnt norNI error Mssage location and produces a . . bleep'} Begin Gotoxy(ERR!IlX,ERRalYI, Textcolor02+BlINO, Write(IESSAGEI, Sound(uOOI, DellylSOOl, 1I10sound; Textcolllr(7); End; {Error-'Hssage} =P= Procedure Ctll_check (CELL : Eightstring ; LROW I Integer; Var un. I Integer IIIr ERRFLAG : Bool ..nl, { This procedure checks the contents or I Dew input frOlli the keyboard before before allollling it to be piSsed on to tlte relainder or tlte progru. It tests ror invalid digits, lultiple deciN} points. and trailing blanks. none of which are allowed} Vir I Integer; DIGIT..FOONll Boolti.n; POINT..FOUNIl Boolean; 1 ~ ~ ~ 'ti ~ Cl ;,. no tJ B ~ OIl § 1:1.. tJ ~ 'l:i tJ ~ g. It,in ERAflAG 1& False; DIGIT..FWiII " Fils., POINT..fOtNl " Fll .. , LCOl. 1= 0, Rtptlt LCOl. " LCOl. + I, CU. LJIOIj of 5,6,19 I CUt CElI.[LCOLl of '0','1' I DI6IT..fOtNl 1= TRtE, EI .. IItgin ERRFLAG := True; ') Error-uIHI.,llnvllid binary digit End, IElsel End, (Co"l 7,.18 I CUt CElI.(LCOLl of '0' •• '9': DIGIT...FCUI) 1& Trut; I If POINT..FWiII then Itgin EtrOr..MIH9t(~Plu1tiplt ded.' ptints I)f ERRFLAG := True; End 1If} El" POINTJOINl 1= T,ue, I If DIGIT..FIUID tlltn IItg;, Error.... sH'e("TraiJing blanks invalid 'I; EAfRAG := True; End, (lfl Else ::s Segin ERAFLAG : =True; ErrOr.M5Hgt('Inv&1id ded.1 digit '); End, Ito..} IMti I IERRFLAG' Truel " ILCOl. =81, If not DIGIT..fOtNl the. Begin &ror-lll551.ge('A nUlbtr Mst be input VI \C I, TEII',_ It,in TEttP + fi(JER; Binv-y_to_int : = 1BF; End; Procedure Outbin UHf,MJmlG = Integer); ( ibis rtcursiw procedure outputs an intt,.r IS .. binary nUllbtr of any I.ngth) Begin If _16) 1 tlltn outbintiNT div 2,1UID16-II, Textcolor(4); Nl'ite(ch,t1NT ood 2 + 48)), T.xtcolorCO); End, (Outbin) Proctdurt ZerO-ii II (VII" CELL : Eightstrin,); { This procedure repllets I"ding blinks on I ktybeard input with zeroes) VII" X: integer; Begin Fo, X " 1 to 8 do If CElI.Ul End; CIero-fill} =' , then CElI.[Xl 1= '0', Function Getreg UNRI I Byte) : Byte; ( This Function reld5 the current VIIUi of any tone d.tector regi5ter) Yo, STATUS: Integer; Segin p"tlOFFSETI 1= Rill! + 16, DeilY!!), I); True; , 1= STATUS 1= portlOFFSETl, E.d, IGot"g} Procedure Putrel nlUI I Byte ; WLlE : Byte ); ( This procecture puts a AtII v.hle into uy tone detector register) V.. STATUS : Intlger; '); Segin portUFFSETl := AfOI; Dellyl1l, STATUS ,. po,tllfFSETl, p"tlOFFSETl " IIAU£, Functio. Binll'Y_t..int 1\Ior CEll. , Eightst'ing) : Integtr, ( Tbis functi .. claverts i.ft 8 dilU U ....ry noUtr toe a ded.1 integer) \lor = If CEl.LU] 11' then TeP 1= POWER + P(IER; FQER End, (Fo,) Got...g 1= portlOFFSETl, po,tlOFFSETl 1= 16, fad, IIf) If ERRFLAG =Fl"e then 8egi. GetoxylERlORX,ERRORYI, Writ.(1 fad, (If I End, (Coll..check) ,= DellyllI, End, lE"el End, !Cutl EJIFUlj :- POII:R " 1, TEll' ,. 0, For I 8 d...to 1 do Btgin Ilteg", Dellyl1l, STATUS := portllfFSETl, End, If'ut''gJ Procedure u,d.ltt..... gi.tt.(LRIII : Integ.. I \lor ENFUIG , ... IHI), { Updi.tt register is calltd lIy tbe UHf pttlsing return afttr tRterin. 'OM ~ pl'og,..u~ u 10n9 as tht input v,lue is valid. Depending upon cursOf' position upote Hgbter alls ont of its otm procedures to conyert tht uur input bh I for.t understood by tbt tone· detector, and witts the HtII value to the tOot detector} ata into the VII' WLlE I Integer; Procedure Chute_control (CB.l. = Eightstring); { Writu the nftI velue for the control register into tM tone detector} Begin Putrtg(OfBiftlry_tG_inttCEUJ) ; End; (Change_control} Procedure Chuge..aode(CELl : EigbtstringJ; ( Writu tbe Dill value- for the lode register into the tone detector, and updltfS progl'Ul varilbl. GAIN..FACTOR uud in other cilculations) Begin Putr.gU ,Biury_h_intCCEU»; CU. 'CELl[7J 'f '0' , OONJACllR 4, 'I' I If CELl[Sl ='0' then GAIN.FAC11J1 ,= 1 Eln GAIN..FACTtR 1= 16; End (Ca.e) End, 1Ch.1If.....de> ,= ~ II> i:l ~ ;::: ~ ~ Ol ::s II> t::l § e: ~ ~ t::l ~ ~ f g' .Procedure Changt_tnV_tiH_constint (CEll : Eightstring ; Vv ERRFlAG = Boo}fl.n); ( ChKks for valid N.ngt of new envelope tiR ctnstiRt·- if wHd .rites no vt.lue to tOnt Htector, if not giv.s-error .usa.ge) \'or TBI' , RHI, Begin Ze.o_fiIHCELll, IItHCELl, YEIP,COI£I, If YElP • 0 then Begin Error-Mssage(fVilue out oE ruge "I; EARFlAG 1= TrUl; End !Ill Else Begin \W.L( I. Roundll0240II-expH/(80YElPII 1I, If (\W.L( ) 2551 or (\W.L( < II then Begin Error;..aessage('Vilu. out of range "I; EARFLAG 1-= Tru.; E,d !Ill Else Putreg(2,\W.L(I, End, lEis.) End; {Cbantt_eftY_tiae-coDstant} Procedu'e Chlngt_thre.hold. (CELl , Eightst.ing , TH ,COI£I; \W.L( ,. Ro••dIO,I280TBlPI, If IW.L( ) 63 then Begin Error..Nssage('Value out'of ER1IFLAG 1= T.ue, End {If} Else Put•.,(6, \W.L(I, End, lChonge_passband..ooidth) rln~ '); ~ ~ ~ ~ ~ ~ ;os (11 Proudur. Cbang._fl'fquency (CEll : Eightstring ; BAND ViI' TEII" R.. I, Begin Ze,._fill(CELlI, VoHeaL, TEII',COOEI, If TEll' ) 3400 then Begin ErrOr..H5sage(~vallJt ERRFLAG End (lfl Else Be"gin 1= out of range ~J; True; .= R.und(S,I924TEI'IP1 div 256, Putreg(S. Wl.UEJ; VAl..t£ := Round(8.192fT9IP) mod 256; Put,eg(8+BAND, VALLEI, 'iAl.lE' ~ t:J ~ Integer; Vir ERRFLAG Boolean); { Checks for valid range of nelll freqency - if valid converts. to. tM vahlts to. be progf'Ulled into the frequncy liS byte and LS byte registers and writes nelll Vilvts to. tO'n' detector. if not gives err-or Huage} t:J g ~ I End; eEl se} End; {Change-frequency} "l'j t:J (11 l1t <"'l g. Procedure Change_filter_select (CELL: Eightstrirlgl; { Writes the nM value for the fliter select register into the tone detector} Begih VALI£ 1= Bi ..,y_t._int(CELLI, Put'.gU5, VALI£I, End; (Change_filtf'r_selecU Begin {Update_register} Case l.1CW of S • Chlnge_cont,.I(WRlTLTABLE[SII, • Ch.ng.....d.UIUTLTABLE[611, : Change_env_tiH_constant(~ITE..TABlE[71,ERRfLAGI; 8 : Change_thresholdsIWRlTLTABl.E[Sl,'U',ERRFLAG); 9 1 Chong._thmh.ldsUIUTLTABLE[91, 'L' , ERRFLAG) , 10 • ChiOg._filt.,_I.ngthUIUTLTABLEU01,ERRFlAGI, 11 • Chlnge_pmbond...idthlWRlTLTABLEUI1,ERRFLAGI, 12 • Chlnge_thmh.1 ds (WRITLTABLE[121,'C' , ERRFLAGI , 13, ,18 , Chlnge-frequencyIWRITE..TABLE[LROW1,LRDll-I2,ERflfLAGI, 19 • Chongt-filt.,_•• lectlWRITE..TABLE[1911, End, {C"el' End; , Gotoxyt50.3); Write(~Read Re9isters~); TextcolorUO); '); Write(' Gotoxyl45,SJ, W.i t.1 'STAnJS R.,ist•• b'J, b')1 Gotoxyl45,6I, W.itel'llllE Regist•• 'll Writel' ,I); Write(~ '); Gotoxy{45.8); Write(~D1lIF Digit is '); Write(' Gotoxy(45,9); Writet'Tone .arriVi.l·tiH· oS'l, IS'}; Gotoxyt45,10); Write(~Tone dtparture tiM I); Write(' Gotoxy{45,lU; Write{~Current tiM is .'); Write(' oS'I, GotoxyI4S,13), W.it.I's.nd I si,..1 1••• 1 'I; Write(~ 111'1, Gotoxyl45,14J, W.it.I'Band 2 sign.1 1••• 1 '); Write(' 111'1, Gotoxy(45,15); Write(,Band 3 signal level 'I; WriteC' 111'1, Gotoxy(45,16); WriteC'Blnd 4 Signal 1ev.1 '); Writet' 111'11 Gotoxy(45.17); "rite('Band 5 signal level I); Writt(~ 111'1, Gotoxyl45,181, Writ. I 'Band 6 si,..1 1,..1 'l; .Writetf 111'1, I); Write(' Gotoxyl45,19I, Writel'Tot.1 .igllll 1••,1 III'J, Textcolor(4); Update..rtad-viJUt; IIUTLTAIl.E[51 ,. '00000000', IRITLTAIl.E[61 ,. '00100000', IR!TLTAIl.E[7J ,. ' 1.00', IRITLTAIl.El81 ,. ' 100', IRITLTAIl.E[91 ,. ' 50', IRITLTAIl.E[lOI ,. ' 250', IRITLTAIl.EIIIl , . ' ·400', IRITLTAIl.EII21 ,. ' 100', ~ ~ ~ 'ti ~ ~ ;,. ~ t:l g !:;,." Oq ;::, ;,. ;::,.. t:l ~ '"t-i i§o IIUTE..TABLE[131 := ' 500', IIRITE..TABLE[141 := ' 1000', IIRITE..TABLE[151 := ' 1500', IIRITE..TABLE[161 :=' 2000', IIRITE..TABLEI171 :=' 2500', IIUTE..TABLE[181 := ' 3000', IIRITE..TABLE[!91 :. '00111111', For I := 5 to 19 do begin GotoxyllllOCK+1,I), W,iteIIollITLTABLE£lJ), Updl te_l'eg i 5tel' ( I1 ERRFL.AG) ; End; {For} RllII :. 5, Got.xyIBLOCK+I,RllII) , TEII'..I:El.L := IoIIITE_TABLEIRllII1, SofLcursor (1); End; {Inith,l is.e_tone_detector} Procedure Cursol'_up; { Moves current cursor location and soft cursor up on screen. Vertical displactHnt depends upon current location, and· is given by array DISP} Begin If not ERRFLAIJ then Begin Got.xyllllOCK+I,RllII) , Wri teIWRITE..TABLE[ROW1), RIll := ROW - DISPIRIlI+241, TEII'_CELL := IIRITE..TABLEIROW1, COL := FIRSTCOLIRllII1, GotoxyllllOCK+COL, RIll), Soft-cursorll); End Uf} End; {Cursor_up} Procedure Cursor_down; { As for cursor uP. but IROVes doun} Begin If not ERRfLAIJ then Begin GotoxylBLOCK+1,RllII), Wri telWRllE_TABLE[ROW1), RIll := ROW + DISP[ROW+261, COL := FIRSTCOLlROW1, TEI1P"CELL := W[TE..TABlE[ROW1, GotoxyllllOCK+COl.,RIlI) , Soft_cursorf 1); End, Uf} End; (Cursor_down) Procedure Cursor_left; ~ IN { "oves current cursor location and soft cursor to left on screen. Cursor rolins witbin value windOlll for eacb parueter, giwn by FIRSTC(L lrrlY} Begin If COL ) FIRSTCOLIRIlIl tben Begin Gotoxy(BLOCK+COL,RCl" ; Soft_cursor (O); COL := COL - I, GotoxylBlOCK+COl.,RllII), Soft_cursorll); End; {If} End; {Cursor_left> Procedure Cursor_right; { Moves current cursor loeation and soft cursor to right on screen. Cursor relNins IIIthin value window «(oluM S)} Begin If COL <8 then Begin GotoxyIBlOCK+COL, RIll), SofLcursorWJ; COL := COL + I, GotoxylBLOCK+COL,ROWI; Soft_cursor (1); End, Uf) End; {Cursor_right} Procedure Dati_entry; { Tbis procedure takes a keyboard DUMrie entry into the teMporary string. and Iloves tne soft cursor to tne right if neceSSlty} Begin GotoxyIBLOCK+COL, R()Ij), StfLcursorIO); WriteICl!ll), TEIW..I:El.L[COLl : =CI!ll, If COL <8 then COL := COL +1, GotoxyllllOCK+COl.,RllII), Soft-cursor (1); End; {Dati_entry} Procedure NewJ ine; ( This procedure terlinates da.ti. entry for a particular value, inputs the value to the cell check procedure, loves the soft cursor dOIllfl. and loads the hlDporary string lIIitn the present dita of the nell! parutter) Begin Gotoxy(BLOCK+COl.,ROW), SofLcursorIO); Ce 11_checklTEII'_CELL, R()Ij,COL, ERRFLAIJ) , If not ERRFLAIJ then Begin IIRnE-YABLEIROWl : =TEll'_CELL, Updi.h~_register (RIll, ERRFLAGJ; If ERRFLAIJ then COL := FIRSTCOLIROWl Else Stgin RlW := R()Ij + DISP[ROW+26J, COL := F1RSTCOLIR()IjJ, TEII'-CElL := WRlTE..TABLEtRlllll, ~ Endj (EIsel Endj Ufl GotoxylBUJCl(+ IlII,4); q5=QII,S); 1 1 The syst.. p.I_lol is gl... by % 1 1 1 1 1 IKlzH2 + IC2Iz + K3l1bllZ + b2) • Iz - IlIz - .IIZH2 - allZ +02) EqUltln, coefficionts .f 'Ifferont _ .. , It get foo. lioeor _ti .... t ... ·_ feI_t.p. 0111 .01 .. for KI, 1C2, K3 OR' " is. I.i:&ti.. of _ .f the p.I •••f the controller. ""'rt. X D - [bl o o b2 bl b2 ~I o o ~. So So no ') X tho .t.,. ') I colc.lot• . -••f ...,1 •• f....;.aloti.. I do lillUlltion plotlyl titl.I'Politi.. Stop Re.,....') xl ....WTl. i •• ...,Its') yl ....WPo.iti.. 10 radiu') Vi. ,..10 ,.[,1 .....iKto.. ste_ .... IIbic.,.. _ttl ,.1.' 'I c1 ••......,...s c1udt. 1•..., ...05 ,.... ,--, ,.1, I. ....i ...t.r .f ..tI.. pu.. ..tIT, 'Enter t ... 141C1.tion of yOII" poltl' input('IAput location of polt 11 ') pi.... , ilPut('I.put loCltiln .f p.lt 21 ') p2=u'; capdtoadool tod This p••_ .._i,._ 0 PID c..t ••n....1o. pol. p l _ t hdlalqHl. Dosi... p.l. locoti••_ ..... -t. lie i.,.t. Tho PlD il c _ ilto di.cret. foro •• iRg t..,...ldal _I.tloo. Eat.....i ... ,.Ie locoti .._ i. tilt next .tep. lIIil ....... 11.lot.. 0 eIOH' I • ., .,.ta Ulilll a PlD controller. lilt PID uottoll ...... Nt....1...... ing e1uslcol tedmi ..... and tNt ~... ilto diKrttt ftrtI ull., I'tCtIRlUI ......oxI_ti ... o 1 DI- [ q2+1...1 0 q3t01-02 _I q4+o2 b2 q5 ~2 -I 1...1 01-02 02 I; 0 0 -I 1...1 ~I o 0 b2 01-02 02 I; q2+111 q3+al-02 q4+o2 0 -I 0 bl q5 b2 1-01 01-02 02 I; % D2= [ bl b2 0 0 ~ D3= [ bl b2 0 0 bl b2 0 D4= [ bl 0 bl b2 '"ti ~ i:! ~ ~ b2 0 0 5" ~ tj I:> ;:s 1:1.. t:l ~ I:l ~ ~ .... I:l ("') (;) ;:s ~ 1-01 d-.2 0 0 bl b2 q2+l-d q3+i1-.2 q4+t2 q5 l, 02 l, I ;:s ~ -I q2+1-o1 q3+i1-.2 q4+t2 q5 I "'cIotlDI, dl=d.IIDIl, d2=cIoIID2I, d3=cIotlD3 I, d4=cIoIID4), KI=dlld K2=d2/d K3=d3/d ,=d4/d e.d Progra 5 I il cloud loop citidbelt controller. If tilt plint tn.nsftl' function is Tbis file silulates X X X I % Gil) =AlB and control1tr function is given by X HIl) X =C/D I %. then ttt. clo5fd loop rupons. is given by I I GlllHlll rc I I I • GlllHlll rc'BD I ggg=1 lII1ile ggFI utraRS dbnld.. • .. I=[pO pI p2l, cIo.I=[qO ql q2l, cOIIpdtn=denl; procnUFflUII; procden=den; ~ nu.s=coov(lu.l,ftUII); den5=convtdenl , den), §: So ~ ~ t.i N C) ~ i:! ~ %aultiply both nllM...torJ X.ultiply both ftAOIIiM.torJ input("specify tile tiM in secs over _ich you _t to 5H tM sttpl 'J t=us; o-t/T, u=ontstn,1); c1osrtUPg*nua5; C] oIHn=g+R.s+den5; y=dl si.felo""., closden, uJ; pI oily) I Enl.r oddilio..l cl0.ed loop "in I Colc.I.I. dt...inato. of clo..d 10.,. .y.l.. t Do clo..d loop .i..l.li .. title('Position Step Response') xlmU"TiM in • of supJ.s') yllbtH'Position it radiln') grid pi.USt UI 1 Calculate nuMer of supl.5 t. aH si..,llti .. input('input I loop gainl '} g=t.ns; e.d ::j Cil1 !lObI' transfer fUnction !All _ I po.... I... NuMrator of the controller denolini.tor of controller co.pnUFflull; ~ ~ lCttp doing 1.11 -..J 00 ~ I 1 1 1 1 1 1 1 1 1 1 1 1 1 gO 1 .Q.. This file io,l.o15 de,ign of a _ t c••t ••ll ••• The f ... of tilt contr.ll •• is gi".. by tilt f.ll ..iog eqUlti •• -I pO + pltz G 1,)db 1 1 1 qO + qltz -I -2 -3 then tt.. fol1011111ing procedure CIII be used to design = II(I + bl + b2) pi = IlIpO p2=a2OpO I:> qO. I ql = -'lopO q2 =-b2ipO end "" §: -3 + q3tz •••••••• qntz I X 1 1 Tbis progra fiauldes -. i. deadbeat controller GI,) = AlB X % 1 lOci controller fUnction is given by % th.A X 1 X HI,) =c/D the c10std loop N5POltSf is giYfA Glz)Hlz) 1 + GI,)Hlz) ggg=1 .hile 99FI lotru! pi did•• ...I=[KI K2 K3l; RI-n •• l; de.I,..lyIRII; coapnuFnull; cOlpden=denl.; den5=conv(dent,den); So So "" ~ ~ o ~ ~ ~ N:+BD 2. Cill progru to cl.lcallte IOtor trtnsff'r funetio. X Cill progr.. to calculi.tf' controlltr 91in5 X nUMratol' of PIO controner % polts of the PID controller X ca.lculate clen.inahr ~ 3s. by N: prOCAUFRlJI; ~ PIO controller using t.-.pezoidll approxi.Uen If tht plant transf.r fUnction is I:> ~ I. techniq... X % I -. pl~...nt Ind .. polt X DO + bltz + b2f, + b3tz •••••••• b••' G 1,)= - - - - - - - - - - - - -1 -2 -3 -n P .0 + al*! + IJIZ + I3tz ........ anlz pO tl -2 + qlo, -n -3 + p3tz •••••••• pnt, If tilt plant lran,f.. f••cti •• is Ii... by ~ ti ;:s I:>.. -2 + p2tz -I 1 1 ~ s Progro 7 "'.,.... 6 procden=den; nUll5=coftv(nu.l,RUI); input('specify the t:sans; n=tlT; inputC'input g=ans; lA)Jlts(Jl 2 U, tiH '% ttultiply nuaerators X ftultiply deftotlinators in stes over lIfltitb you WlDt to 5H tbt stepl "} . I I Calcula.te RUliber of suples to ... si.ulation loop glin:') X Ent.r lOY additioni,1 loop ga.in %Nullbf'r of sup1f's to 5H silUlatioR X naerator of closed loop 5yStfll transfer function closden=gtnu.s+den5 X denolindor of c1osf'd loop l)'Stu t ....nsfer function y=dlsil(c1osDuI 2 closden 2 u); 1 do discrete sillUldion clOslIUFg*nu.5 pl.tty) titJe('Position Step Response") xlibel('Tiae in I of suples / ) ylibeJ(~Position in Nldh,n') grid pause e.d AppendixE PIO Rect~n~ular • t .I.t 1 eo Controller 'PIO Contr'o11er'" PID .def "fhlS r'outl.ne lmplernents a. PID controller "RV • !!Jet EO .set .$et ... E1 E2 1<:1 K2 • !!oet set • set "7 JJN • $et U1 .set • set .S~t • set ~ B B .word .wor'O 1000 8 9 eUd . 0 lnltiallze memory 1 GOp set program memory pOinter to 4h load coeffcients into dat.a. memor-y 4 K1 :; K2 '" K3 sel f lnput 0 IN IN LAC SACH '-AC SUB SACL PID set DP po 1 nter 0,255 ZAC L.ARP SACL BANZ LACK T8LR LACK Pr'o(:ess c.oefflClent Kl cOoS!ffic ient K2 coefficient K3 0 LDPK SOVM LARK II ** O~JtplJt output RS- processing begins here t 5632 -7839 2206 TBLR EINT ..* 1 dest l!;.r' ... ACK lsr 0) 1n1 TBLR * preV10IJS 10 Processor lOltlallzatlon .word *Hut samp 1 Eo Prevlous error samp 1 e 01 dest error sampl e goi110 constant ga,ln c:onstant gaul constant out put to l~ontr-ol1er 2 K3 * * inplJt from AID , Latest errOr- 1 3 4 5 u2 reference value " - ; walt for lnter-rupts sampl e x(rd rea.d r-efer-ence command lnput rea.d input position signa.l on upper- 13 bit$ RV,PA2 XN, PAO XN,13 XN RV XN EO subtract from refer-ence to give error PIC routJ,ne u(n) LAC LT MPY U2 E2 K3 MPY E1 KZ LTD EO i"'Ipy APAC SACH OU'" DMOV DMOV UN,4 UN, PAl U1 UN '-TD K1 ; ; ~ Transfer lJ(n-2) to accun'Jl.(lator load T reglster with oldest sOlmple e(n-2) Preg = K3*e (0-2') ACC u(n-2) + K3*e(n-2), Treg = .(n-1) Pr-eg = K2'»f! (n-1) ACe = u(n-2) + K3*e(o-2) + K2*e(n-l) P .... g = K1*e(n) ACC=u(n-2) + K3*e(n-2) + K2*e(n-1) + Kl*e(n) shIft out 4 sign bbits \IIf"lte to D/A - two"'s complement for-m = tra.nsfer u(n-l) ---> u(n-2) tr-a.nsf zzold.el Controller •t "'PIO Control 1.... '" J.t l.eo PH) .dE!f " * RV XN EO El .set • :set 0 • !:tee :2 refer-'.nce va.lue input from AID • La.test er;f'or sample f Pr + K2*e(n-1) + Kl*e(n) =-to.l~4!' to memory .and shift out 4 sign bit!> in two"s c(lmpl ement form write to D/A transfer uCn-l ) ---;> uCn-2) yen) transfer ---> uen-i) - wait for next interrupt Implementation of PID and Deadbeat Controllers with the TMS320 Family 'Deaubeat Controller· ... .t.l.t:'IO.' • d~f 'lV 'r< EO E1 E::2 PO P1 ';'"t"ll~ ,·o ... tJ.n~ .. :>et 0 ...",,,,t .. $wt .. set .. set .. set .. set .. set P2 tOll .l'Oet Q2 .. Sli!>t UN OBEAT • $et 1 .; , 7 8 9 ,, 10 II 12 .. s,1I\'t .. !:iiet *~ Processor :lot , , 4 .5 ,J2 B B .OJor-4 -13215 .word -13815 * loop LDPK SOVI"'I LARK ZAC L.ARP SA(:L . , ~ coeff 1e lE-ot coefficiE-nt coeftll:lent coeftlc lent Loefflcient , set 0 PO P1 P2 Q1 Q2 .1566 = -.3129 = .1564 = -.4218 = = -.4216 DP pOlnter 0,255 0 lnit la' ize memory LACK TBLR LACK TeLR 4 PO set program memory pointer to 4h loa.d coetfcients into data. memory set progra.m memory pointer to 5h LACK 6 TeLR L.ACK TBLR LACK TeLR P2 EIIliT B * RS- pr-ocesslng bl!gins her-a *loop BANZ * * * value lnput from AID Latest erro"Jr sam~d e Prevlous error sa.mple oldest \tr-ror sample 9 ... 10 con$tant galn constant gain constant galo constant gain consta.nt out put to controller prevlous output oldest output .l.n~tJallzatlon lrnt .word 5181 • word -10253 .word 5125 In.l.t O-eadbeat controller , r·efer-ance 2 3 U1 reset llfl.:olemeots a 5 P1 set progra.m memory pointer to i>h 7 set program memor-y pointer to 7h Gil 8 set progra.m memor-y pointer to 8h Q2 $el f enable 1 nt.rr-upt S Wli.it for interrupt Process lnput sa.mple e(n) = r - x(n) Implementation of PID and Deadbeat Controllers with the ,TMS320 Family 581 *LH IN IN LAC SACH LAC SuB SACL * • F < LF >. An example for a file containing an impulse, emulating a 12-bit, two's-complement AID, is shown in Figure 2 .. 588 TMS320 Algorithm Debugging Techniques IMPULSE tlllllllllill 7FFO 0000 0000 0000 0000 0000 0000 0000 ----. h (n) ----. • • • • 0000 0016 FFEA 0024 FFDC 004A FFB6 012E FED5 • • • • FFEA Figure 2. Input Text Editor File Note: HEX values in this report are represented in Q15 format. In Q15 format, -1 = 8000h for both a 12- and 16-bit field, + 1 = 7FFOh for a 12-bit field and 7FFFh for a 16-bit field. For further information on Qn notation, see Section 5.5.5 on page 5-33 of Reference [1]. The file shown in Figure 2 can easily be generated with a text editor and produces a near-ideal impulse response. This is seldom achieved with analog systems. However, what if you wanted to inject a more complex signal, such as several sine waves and/or random noise? Here, the generation of the input file can become a monumental tasI,c One method of file generation, presented here, uses Lotus 1-2-3, a software package found on most pes. Because Lotus 1-2-3 is a spreadsheet calculator, you can use a column to denote the input sequence, X(O), X(I), X(3) etc. Adjacent columns can be set up to calculate the desired x(N) values. An example of a spread sheet, which calculates three sine waves with a predetermined noise signal added in, is shown in Figure 3. TMS320 Algorithm Debugging Techniques 589 (@IF«F6*32768» 1,(F6*32768),(2AI6+(F6*32768»» @SIN«2*@PI*B$3/$A$3)*$A6) @SUM(B6 ... H6)/$F$1 (@RAND-0.5)*$E$3 A 1 2 3 B Sample Rate 8000 C D E Fl 1200 F2 1800 Noise .25 G 4 5 6 7 8 9 0 1 2 3 0 0.453990 0.809016 0.987688 0 0 0.035786 0.809016 0.987688 -0.08909 0.951056 0.309016 0.203457 0.309016 -0.89100 0.111678 0.035786 0.978563 0.899604 0.176390 778 29313 27242 6268 Figure 3. Spread Sheet Calculation of Three Sine Waves with Added Noise Signal This spreadsheet approach allows you to specify a wide range of input conditions. You can add columns by copying previous column data and can extend the length of the array by copying rows. If you are going to use Lotus's random number generator for adding noise to your signal, you should note the following: • Lotus's random number function generates uniform numbers or noise. • Lotus appends an existing ftle when the print-to-ftle option is used. • Each time you recalculate the spreadsheet with a random function, a new random seed is used, which will generate a new random array. You can use this last feature to your advantage by writing to a ftle, recalculating the spreadsheet, then writing again. This sequence permits large input ftles with uniquely different ftle segments. You must exercise caution, however, to insure that all frequencies end at a zero crossing; if they don't, unwanted discontinuities will be introduced. The end result of the above process is a column of decimal numbers scaled between -1 and + 1. Using the Lotus graph utility, you can plot one or several full cycles of the wave form. When you get the desired results, you must convert the column data to a Qn HEX value of the form in the note that follows Figure 2. You can use the command structure noted in Figure 4. 590 TMS320 Algorithm Debugging Techniques @CHOOSE«@INT(H6»,"0","I", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "e", "0", "E", "P", "0") ·r------(@IF«F6*32768)1,(F6*32768),(2 16+(F6*32768»» «J6-(@INT(J6»*$1$4)--...., «(l6-(@INT(l6»)*$I$4)/$1$4 ....--«H6-(@INT(H6j»*$H$4/$I$4 (G6/$H$4) I J K 16 778 29313 27242 6268 0.189951 7.156503 6.659761 1.530270 3.039231 2.504061 10.41218 8.484329 0.627702 8.064987 6.594986 7.749269 10.04324 1.039797 9.519785 11.98831 030A 7281 6A69 187B Figure 4. Lotus Command Structure Saving the Lotus 1-2-3 File as an ASCn Text File You can save a spreadsheet range as an ASCII file by using the Lotus PRINT utility. If you select the FILE option under PRINT, with the left column margin set to zero, Lotus will write the columns to a ftle with the required < CR > < LF > ending. Once this is written out, you must edit out the blank lines between pages so that the ftle content is continuous. You must also ensure that the data in the ftle is fully left-justified and starts at the top of the ftle (no blank lines). You can do this by editing the file with a text editor. Running Your Program with Data Logging After completion of the preceding steps, you can execute your program with data logging enabled. Name the input file INPUT.DAT, and the output file OUTPUT.DAT. Make certain the created LOTUS file is in the correct directory and is referenced by the correct file name; the DOS file name is the same as the data log file name." Since each development tool has a unique procedure for enabling data logging, it is assumed that you know how to initialize file I/O. The data logging feature of the TMS320C25 SWDS is documented on page 3-29 of Reference [2], and the TMS32OC30 Simulator on page 3-14 of Reference [3]. TMS320 Algorithm Debugging Techniques 591 When your program is executed, the disk drive light will start to blink. With the TMS320C25 SWOS, each disk access is equal to 64 samples being written and/or read, while on the TMS320 simulators, there is one disk access for each sample. To control the number of samples written to and/or read from the flle, you can either 1. Manually count the number of times the drive light flashes, 2. In the case of the TMS32OC25 SWDS, use program control techniques, such as break points with count values (see page 4-108 of Reference [2], or 3. In the case of the TMS32OC30 simulator, use the LOOP command (see page 5-103 of Reference [3]. When the above process is finished, there will be a new fIle in the working directory named OUTPUT.OAT (the name previously given to your flle). This flle contains a listing of N ASCn HEX character strings in which each line represents one output time sample, y(n). In the case of the first- and second-generation development tools, the flle st~cture is identical to the input flle structure: four HEX values represent a 16-bit field in which the sign bit is left-justified. However, the TMS32OC30 Simulator outputs, and also requires for i~P'1t, a form similar to the HEX syntax used in the C programming language. This is a 10-character HEX field with Ox as the first two characters. The impQlse value showfl in Figure 2 would be written as Ox7FFOOOOO for the TMS32OC30 Simulator. YOQ cap. generate an input flle form, using Lotus 1-2-3, by simply adding two coluinns: a colm containing the Ox prefix placed just before the calculated four-digit HEX field, and a colw:p.n containing 0000 just after it. Plotting the Output Data Several software programs can easily read and plot the output flle as a continuous time sigru» or frequency domain; Mat Lab, OAPiSP, ILS, Math Cad, and Hypersignal. For further information on any of these products, contact the companies shown in Appendix A. This report shows how Hyperceptions' Hypersignal package is used to debug DSP algorithms. The Hypersignal program can acquire and display all types of TMS320 flles. This permits viewing numerical flle data (input and output) in both time and frequency representation. HypeFs~gnal offers an extensive list of DSP utilities, such as • Waveform display/edit FFT generation • FIR and fiR fllter construction and code generation (assembly and C) • ~onvolution LPC autocorrelation • ReCursive flltering for fiR fllter types TMS320 Algorithm Debugging Techniques • Generation of user-defined difference equations (which can generate files for use as input to any of the TMS320 development tools) • Digital Oscilloscope Hypersignal has several other functions for analyzing data files and filters in the frequency domain with utilities for creating or displaying • Filter/file magnitude display (both log or linear) • Filter phase display • 3-D and 2-D frequency vs time vs amplitude-spectrogram display • Inverse FFT function • Filter pole-zero plot (both in sand z domains) • Power spectrum generation Hypersignal's powerful functions permit the evaluation of DSP tasks. For a first time user, they can prove to be extremely helpful in establishing a base line knowledge of DSP. Algorithms of High Complexity Packages such as Hyperception's make DSP algorithm development manageable, even with N second-order cascaded sections. In Figure 3, there was one second-order section. If anything were to go wrong, it would do so within this section. How would data logging help if you have several cascade sections? This can be answered by drawing an analogy between debugging a fourth-order analog system, which uses op-amps, and the equivalent DSP system implemented with four cascaded second-order IIR sections. INPUT NODE 1 NODE 2 OUTPUT NODE 3 r----------->--L.._ x(t) : I I y(t) I I I I. ___________________________________ - - - - - - - - - - - , Figure 5. Four Op-Amp Block Diagram U sing traditional debugging techniques, i.e., an oscilloscope and function generator, you can examine the output versus the input on a stage-by-stage basis, correcting or adjusting each stage one-at-a-time. This process starts at node 1 and continues through to the output. When the system yields a satisfactory response for a given input condition . TMS320 Algorithm Debugging Techniques 593 (not clipping, and amplifying at expected levels), use a spectrum analyzer to verify total frequency response. If the frequency response was not as expected, you can then examine each stage individually and adjust pole-zero placement to obtain the desired response. INPUT NODE 1 NODE 2 NODE3 OUTPUT IIR SECTION IIR SECTION IIR SECTION IIR SECTION H(n)l H(nh H(nh H(n)4 x(n) t IN XN,PAO t INPUT.DAT t HYPERSIGNAL A ! ! ! OUT NODE1 ,PA2 ! ! ! NODE1.DAT NODE2.DAT HYPERSIGNAL HYPERSIGNAL A ! ! OUT NODE2,PA3 OUT NODE3,PA4 A NODE3.DAT ~ HYPERSIGNAL A 1-'"'- y(n) ! OUTYN,PA1 ~ OUTPUT.DAT ! HYPERSIGNAL A ~E1~E3~e3~E1E£]e3 TIME FREO. TIME FREO. TIME FREO. TIME FREO. TIME FREO. Figure 6. Four Second-Order IIR Structures Figure 6 shows the same system as Figure 5 but uses four secon9-order IIR structures (a direct form II realization). When you use straight line code, it is a simple task to write a time sample to the DOS fIle by adding an OUT instruction. You can examine the feedback and/or feed forward signal within the IIR section as well. In addition to the obvious benefits of probing literally anywhere within the algorithm or system, there are some not-so-obvious benefits. The Advantages of Data Logging: 1. You can assume any sample frequency. Sample frequency in a hardwarebased DSP system is a function of the AID, the D/A, and the clock cycle of the DSP. With data logging, you can arbitrarily assign any frequency to the data samples within the fIles and can further assume any operating frequency for the DSP. It is therefore possible to specify devices with speeds in excess of any presently available speed if your algorithm so requires. 594 TMS320 Algorithm Debugging Techniques 2. You can specify any input condition. If you are doing a modem design, you can use a real-time data sampler to acquire a REAL signal to use as an input file. It is also possible to use a numerically generated input signal supplied by Lotus or any other software system/utility such as Hypersignal, HLL programs, math packages, etc. 3. You can probe your system without having to observe any location restrictions. In hardware systems, you are restricted to available pins. With nsp code, an OUT instruction can be put anywhere. 4. You must use use a scope probe with analog systems, thus adding resistance and capacitance to the signal being examined. Data logging is a perfect observation utility, since it places no load on the signal. 5. You can examine the input and output signals with any level of desired granularity. If you intend to use a 12-bit A/D, you can examine the signal at 16 bits, then truncate the data to 12 bits and compare results. If you can get by with 10 or even 8 bits of granularity, you will reduce system cost. 6. You can print your results using plotting packages such as Hypersignal. Results can be printed for both frequency and time, thus providing a greater level of documentation. 7. You can archive input and output files as part of your total documentation package. 8. You can't get burned; there are no soldering irons involved. Conclusion DSP-based systems using data logging techniques demonstrate improved quality and shorter time to market. Using the TMS320 simulators and SWDS products in conjunction with graphic/data acquisition software packages, you can write and debug a large portion of an algorithm long before silicon or target platforms are available. References [1] First-Generation User's Guide (literature number SPRU013B), Texas Instruments, 1989. [2] TMS320 Family Simulator User's Guide (literature number SPRU009B), Texas Instruments, 1988. [3] The TMS320C30 Simulator User's Guide (literature number SPRUOI7), Texas Instruments, 1988. TMS320 A 19orithm Debugging Techniques 595 Appendix A Software Package Sources DADiSP DSP Development Corp One Kendall Square, Cambridge, MA 02139 (617) 577-1133 Hypersignal Hyperception 9550 Skillman-LBl25 Dallas, TX 75243 (214) 343-8525 ILS STI Signal Technology Inc 5951 Encina Road, Goleta, CA 93117 (805) 683-3771 Lotus 1-2-3 Lotus Development Group 55 Wheeler St. Cambridge, MA 02138 (617) 492-7171 Math CAD MathSoft One Kendall Sq., Cambridge, MA 021.39 (617) 577-1017 MATLAB The Math Works Inc South Natick, MA 01760 (508) 653-1415 596 TMS320 Algorithm Debugging Techniques TMS320 Bibliography Since the TMS32010 was disclosed in 1982, the TMS320 family has received an ever-increasing amount of recognition. The number of outside parties contributing to the extensive development support offered by Texas Instruments is rapidly growing. Many technical articles are being written about TMS320 applications in the field of digital signal processing. The following articles and papers have been published since 1982 regarding the Texas Instruments TMS320 Digital Signal Processors. Readers who are interested in gaining further information about these processors and their applications may obtain copies of these articles/papers from their local or university library. The articles are broken down into 12 different application categories. Articles in each catego. ry are in reverse chronological order (most recent first). Articles having the same publication date are shown in alphabetical order by authors name. The application categories are: 1) General Purpose DSP 2) Graphics/Imaging 3) Instrumentation 4) Voice/Speech 5) Control 6) Military 7) Telecommunications 8) Automotive 9) Consumer 10) Industrial 11) Medical 12) Development Support General Purpose DSP 1) R. Chassaing, "A Senior Project Course in Digital Signal Processing with the TMS320," IEEE Transactions on Education, USA, Volume 32, Number 2, pages 139-145, May 1989. 2) P.E. Papamichalis, C.S. Burrus, "Conversion of Digit-Reversed to Bit-Reversed Order in FFT Algorithms," Proceedings of ICASSP 89, USA, pages 984-987, May 1989. 3) P.E. Papamichalis, "Application, Progress and Trends in Digital Signal Processing," Proceedings ofMikroelektronik Conference, Baden-Baden, March 1989. 4) R. Chassaing, "Adaptive Filtering with the TMS320C25 Digital Signal Processor," Proceedings of 1989 ASEE Conference, USA, pages 215-217, 1989. 5) P.E. Papamichalis, R. Simar, Jr., "The TMS320C30 Floating-Point Digital Signal Processor," IEEE Micro Magazine, USA, pages 13-29, December 1988. 6) K. Rogers, "The Real-Time Thing (Digital Signal Controller)," Electronic Engineering Times, USA, Number 506, page 85, October 1988. 7) P.E. Papamichalis, "Impact of DSP Devices on Fast Algorithms," Procee.dings of the 1988 IEEE DSP Workshop, USA, September 1989. Digital Signal Processing Applications with the TMS320 Family, Vol. 2 597 8) 9) 10) 11) 12) 13) 14) 15) 16) 17) 18) 19) 20) 21) 22) 23) 24) 598 G. Umamaheswari, C. Eswaran, A Jhunjhunwala, "Signal Processing with a Dual-Bank Memory," Microprocessor Microsystems, Great Britain, Volume 12, Number 4, pages 206-210, May 1988. G. Castellini, P. Luigi, E. Liani, L. Pierucci, F. Pirri, S. Rocchi, "A Multiprocessor Structure Based on Commercial DSP," Proceedings of ICASSP 88, USA, Volume V, page 2096, April 1988. M.R. Civanlar, R.A Nobakht, "Optimal Pulse Shape Design Using Projections onto Convex Sets;" Proceedings of ICASSP 88, USA, Volume D, p. 1874, April 1988.. LJ. Eriksson, M.C. Allie, C.D. Bremigan, R.A Greiner, "Active Noise Control Using Adaptive Digital Signal Processing," Proceedings ofICASSP 88, USA, Volume A, page 2594, April 1988. G. Mirchandani, D.D. Ogden, "Experiments in Partitioning and Scheduling Signal Processing Algorithms for Parallel Processing," Proceedings ofICASSP 88, USA, Volume D, page 1690, April 1988. P. Papamichalis, "FFf Implementation on the TMS320C30," Proceedings of ICASSP 88, USA, Volume D, page 1399, April 1988. AC. Rotger-Mora, "An N-Dimensional SIMD Ring Architecture for Implementing Very Large Order Adaptive Digital Filters," Proceedings of ICASSP 88, USA, Volume V, page 2140, April 1988. J. Santos, J. Parera, M. Veiga, "A Hypercube Multiprocessor for Digital Signal ProcessingAlgorithm Research," Proceedings ofICASSP 88, USA, Volume D, page 1698, April 1988. R. Simar, A Davis, "The Application of High-Level Languages to Single-Chip Digital Signal Processors," ProceedingsofICASSP88, USA, VolumeD,page 1678,April1988. K. Bala, "Running on Embedded Power. (Dedicated 32-Bit Microprocessors Used in New Microcontrollers)(Technology Trends: Microprocessors and Peripherals)," Electronic Engineering Times, USA, Number 478, page 34, March 1988. J. Cooper, "DSP Chip Speeds VME Transfer," ESD: Electronic Systems Design, USA, Volume 18, Number 3, pages 47,48,50,51, March 1988. L. Vieira de Sa, F. Perdigao, "A Microprocessing System for the TMS32020," Microprocessing Microprogramming, Netherlands, Volume 23, Number 1-5, pages 221-225, March 1988. G. Wade, "Offset FFT and Its Implementation on the TMS320C25 Processor," Microprocessing Microsystems, Great Britain, Volume 12, Number 2, pages 76-82, March 1988. R. Chassaing, "Digital Broadband Noise Synthesis by Multirate Filtering Using the TMS320C25," Proceedings of 1988 ASEE Conference, USA, pages 394-397,1988. R. Chassaing, "A Senior Project Course on Applications in Digital Signal Processing with the TMS320," Proceedings of1988ASEE Conference, USA, pages 354-359,1988. L.N. Bohs, R.C. Barr, "Real-Time Adaptive Sampling with the Fan Method," Proceedings of the Ninth Annual Conference of the IEEE Engineering in Medicine and Biology Society, USA, Volume 4, pages 1850-1851, November 1987. T. Kimura, Y. Inabe, T. Hayashi, K. Uchimura, K. Hamazato, "Dual-Chip SLIC Using VLSI Technology," Conference Record of GLOBECOM Tokyo '87, Volume 3, pages 1766-1770, November 1987. ' Digital Signal Processing Applications with the TMS320 Family, Vol. 2 25) W.S. Gass, R.T. Tarr~nt, T. Richard, B.I. Pawate, M. Gammel, P.K. Rajasekaran, R.H. Wiggins, C.D. Covington, "Multiple Digital Signal Processor Environment for Intelligent Signal Processing," Proceedings of the IEEE, USA, Volume 75, Number 9, pages 1246-1259, September 1987. 26) L. Johnson, R. Simar, Jr., "A High Speed Floating Point DSP," Conference Record of MIDCON/87, USA, pages 396-399, September 1987. 27) K.S. Lin, G.A. Frantz, R. Simar, Jr., "TheTMS320 Family of Digital Signal Processors," Proceedings of the IEEE, USA, Volume 75, Number 9, pages 1143-1159, September 1987. 28) S.L. Martin, "Wave of Advances Carry DSPs To New Horizons. (Digital Signal Processing)," Computer Design, USA, Volume 26, Number 17, pages 69-82, September 1987. 29) C. Murphy, A. Coats, J. Conway, P. Colditz, P. Rolfe, "Doppler Ultrasound Signal Analysis Based on the TMS320 Signal Processor," 27thAnnuai Scientific Meeting oftheBiological Engineering Society, Great Britain, Volume 10, Number 2, pages 127-129, September 1987. 30) G.S. Kang, L.J. Fransen, "Experimentation With An Adaptive Noise-Cancellation Filter," IEEE Transactions on Circuits and Systems, USA, Volume CAS-34, Number 7, pages 753-758, July 1987. 31) R. Chassaing, "Applications in Digital Signal Processing with the TMS320 Digital Signal Processor in an Undergraduate Laboratory," Proceedings ofthe 1987ASEEAnnual Conference, USA, Volume 3, pages 1320-1324, June 1987. 32) D. W. Horning, "An Undergraduate Digital Signal Processing Laboratory," Proceedings of the 1987 ASEE Annual Conference, USA, Volume 3, pages 1015-1020, June 1987. 33) D. Locke, "Digitising In The Gigahertz Range," lEE Colloguium on Advanced AID Conversion Techniques, Great Britain, Digest Number 48,10/1-4, April 1987. 34) S. Orui, M. Ara, Y. Orino, E. Sazuki, H. Makino, "Realization of IIR Filter using the TMS320," Resident Reports of Kogakuin University, Japan, Number 62, pages 195-204, April 1987. 35) R. Simar, T. Leigh, P. Koeppen, J. Leach, J. Potts, D. Blalock, "A 40 MFLOPS Digital Signal Processor: The First Supercomputer on a Chip," Proceedings of ICASSP 87, USA, Catalog Number 87CH2396-0, Volume 1, pages 535-538, April 1987. 36) R. Simar, "TMS320: Texas Instruments Family of Digital Signal Processors," Proceedings of SPEECH TECH 87, USA, pages 42-47, April 1987. 37) G.Y. Tang, B.K. Lien, "A Multiple Microprocessor System For General DSP Operation," Proceedings of ICASSP 87, USA, Catalog Number 87CH2396-0, Volume 2, pages 1047-1050, April 1987. 38) L. Vieira de Sa, "Second MicroProcessor Enhances TMS32020 System," EDN: Electronic Design News, USA, Volume 32, Number 9, pages 230-232, April 1987. 39) T.J. Moir, T.G. Vishwanath, D.R. Campbell, "Real-Time Self-Tuning Deconvolution Filter and Smoother," InternationaLJournal ofControl, Great Britain, Volume 45, Number 3, pages 969-985, March 1987 40) R. Simar, M. Hames,"CMOS DSP Packs Punch of a Supercomputer," EDN: Electronic Design News, USA, Volume 35, Number 7, pages 103-106, March 1987. Digital Signal Processing Applications with the TMS320 Family, Vol. 2 599 I 41) S. Sridharan, "On Improving the Performance of Digital Filters Designed Using the TMS32010 Signal Processor," Journal ofElectrical and Electronic Engineers ofAustralia, Australia, Volume 7, Number 1, pages 80-82, March 1987. 42) R. McCammon, "Software Routine Probes TMS32010 Code," EDN: ElectronicDesign News, USA, Volume 32, Number4, pages 200,202, February 1987. 43) J. Prado, R. Alcantara, "A Fast Square-Rooting Algorithm Using ADigital Signal Processor," Proceedings ofIEEE, USA, Volume 75, Number 2, pages 262-264, February 1987. 44) T.G. Vishwanath, D.R. CamppbeIl, TJ. Moir, "Real-Time Implementation Using a TMS32010 Microprocessor," IEEE Transactions on Industrial Electronics, USA, Volume lE-34, Number 1, pages 115-118, February 1987. 45) R Chassaing, "Applications in Digital Signal Processing with the TMS320 Digital Signal Processor in an Undergraduate Laboratory," Proceedings of1987ASEE Conference, USA, pages 1320-1324, 1987. 46) R.M. Sovacool, "EPROM Enhances TMS32020 Mu C's Memory," EDN: Electronic Design News, USA, Volume 32, Number 1, page 231,1987. 47) F. Kocsis, F. Marx, "Fast DFT Modules For The TMS32010 Digital Signal Processor," Meres and Automation, Hungary, Volume 35, Number 1, pages 6-11,1987. 48) Y.V.V.S. Murty, w.J. Smolinski, "Digital Filters for Power System Relaying," International Journal of Energy Systems, USA, Volume 7, Number 3, pages 125-129, 1987. 49) S. Wang, "The TMS32010 High Speed Processor and Its Applications," Mini-Micro Systems, China, Volume 8, Number 3, pages 24-32, 1987. 50) G.A. Frantz, KS. Lin, J.B. Reimer, J. Bradley, "The Texas Instruments TMS320C25 Digital Signal Microcomputer," IEEE Microelectronics, USA, Volume 6, Number 6, pages 10-28, December 1986. 51) P. Renard, "ND Converters: The Advantage of a Mi~ture of Techniques," Mesures, France, Volume 51, Number 16, pages 80-81, December 1986. 52) M. Ara, E. Suzuki, "Design of Real Time Filter Using DSP," Resident Reports ofKogakuin University, Japan, Number 61, pages 115-127 October 1986. 53) 1. Reidy, "Connection of a 12-Bit ND Converter to Fast DSPs," Electronik, Germany, Volume 35, Number 22, pages 132-134, October 1986. 54) G.R. Steber, "Implementation of Adaptive Filters on the TMS32010 DSP Microcomputer," Proceedings of IECON 86, Catalog Number 86CH2334-1, Volume 2, pages 653-656, September/October 1986. 55) D. Collins, M.A. Rahman, "Digital Filter Design Using The TMS320Digitai Signal Processor," Proceedings ofEUSIPCO-86, Volume 1pages 163-166, September 1986. 56)R. Simar, Jr., J.B. Reimer, "The TMS320C25: A 100 ns CMOS VLSI Digital Signal Processor," 1986 Workshop on Applications of Signal Processing to A udio andAcoustics, September 1986. 57) J. Dudas, A. Stipkovits, E. Simonyi, "On The recursive Momentary Discrete Fourier Transform," Proceedings ofEUSIPCO-86, Volume 1, pages 303-306, September 1986. 58) E. Feder, "Digital Signal Processor - General Purpose or Dedicated? ," Electronics Industry, France, Number 111, pages 74-82, September 1986. 59) K Herberger, "The Use of Signal Processors For Simulating Data Circuits," Proceedings of EUSIPCO-86, Volume 2, pages 1109-1112, September 1986. 600 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 60) K. Kassapoglou, P. Hulliger, "Implementation of Recursive Least Squares Identification Algorithm on The TMS320," Proceedings of EUSIPCO-86, Volume 2, pages 1263-1266, September 1986. 61) G. Lucioni, "General Processor Application; CAD Tool For Filter Design," Proceedings of Ell.SIPCO-86, Volume 2, pages 1335-1338, September 1986. 62) R. Schapery, "A lO-MIP Digital Signal Processor From Texas Instruments," Conference Record of Midcon 86, USA, 1/2/1-11, September 1986. 63) "DSP Microprocessors," In! Elettronica, Italy, Volume 14, Number 7-8, pages 21-28, 64) R.L. Barnes, S.H. Ardalan, "Multiprocessor Architecture For Implementing Adaptive Digital Filters," Conference Record ofICC-86, Catalog Number 86CH2314-3, Volume 1, pages 180-185, June 1986. 65) AD.E. Brown, "EPROMS Simplify TMS32010 Memory System," EDN: Electronic Design News, USA, Volume 31, Number 13, page 230, June 1986. .66) T. Kolehamainen, T. Saramaki, M. Renfors, Y. Neuvo, "Signal Processor Implementation of Computationally Efficient FIR Filter Structures-Theory and Practice," 2ndNordic Symposium on VLSI in Computers and Communications, 10 pages, June 1986. 67) T.G. Marshall Jr.,"Transform Methods For Developing Parallel Algorithms For Cyclic-Block Signal Processing," Conference Record of ICC-86, Catalog Number 86CH2314-3, Volume 1, pages 288-294, June 1986. 68) S. Abiko, M. Hashizume, Y. Matsushita, K. Shinozaki, T. Takamizawa, C. Erskine, S. Magar, "Architecture and Applications of a 100-ns CMOS VLSI Digital Signal Proces'sor," Proceedings ofICASSP 86, USA, Catalog Number 86CH2243-4, Volume 1, pages 393-396., April 1986. 69) T.P. Barnwell, "Algorithm Development and Multiprocessing Issues for DSP Chips," Proceedings of Speech Technology 86, April 1986. 70) W. Gass, "TMS32020 - The Quick and Easy Solt,ltion to DSP Problems," Proceedings of Speech Technology 86, April 1986. 71) M. Hashizume, S. Abiko, Y. Matsushita, K. Shinozaki,T. Takamizawa, S. Magar, J. Reimer, "A 100-ns CMOS VLSI Digital Signal Processor Using Double Level Metal Structure," Semiconductor Group 1986 Technical Meeting, April 1986. 72) R.E. Morley, AM. Engebretson, and J.G. Trotta, "A Multiprocessor Digital Signal Processing System for Real-Time Audio Applications," IEEE Transactions on Acoustics, Speech and Signal Processing, USA, Volume ASSP-34, Number 2, April 1986. 73) S.G. Smith, A Fitzgerald, P.B. Denyer, D. Renshaw, N.P. Wooten, R. Creasey, "A Comparison of Micro-DSP And Silicon Compiler Implementations of a Polyphase-Network Filter Bank," Proceedings ofICASSP 86, USA, Catalog Number 86CH2243-4, Volume 3, pages 2207-2210, April 1986. 74) J. Reimer, M. Hames, "Next Generation CMOS Chip Stakes High-Performance Claim on 10-MIPS DSP Operations," Electronic Design, USA, Volume 34, Number 8, pages 141-146, April 1986. 75) w.w. Smith, "Playing to Win: Product Development with the TMS320 Chip," Speech Technology Magazine, March/April 1986. 76) D. Essig, C. Erskine, E. Caudel, and S. Magar, "A Second-Generation Digital Signal Processor," IEEE Journal of Solid-State Circuits, USA, Volume SC-21, Number 1, pages 86-91, February 1986. Digital Signal Processing Applications with the TMS320 Family, Vol. 2 601 77) W.K Anakwa, T.L. Stewart, "TMS320 Microprocessor-Based System For Signal Processing," Proceedings of the ISMM International Symposium, pages 64-65, February 1986. 78) M. Omenzetter, "Universal Signal Processors Offers High Data Throughput," Electronik, Germany, Volume 35, Number 4, pages 71-77, February 1986. 79) P.P. Regamey, "Matched Filtering Using a Sigrral· Microprocessor TMS320," Mitt. AGEN,Switzeriand, Number 42, pages 31-35, February 1986. 80) "TI Set To Show 2nd-Generation DSP," Electronics, USA, pages 23-24, February 3, 1986. 81) "TI Preps CMOS Versions of Signal-Processor Chips," Electronics Engineering Times, USA, page 6, February 3,1986: 82) D. Wilson, "Digital Signal Processing Moves on Chip," Digital Design, USA, Volume 16, Number 2, pages 33-34, February 1986. 83) "TI Chip Heads for Fast Lane of Digital Signal Processing," Electronics, USA, page 9, January 27, 1986. 84) R.D. Campbell and S.R. McGeoch, "The TMS32010 Digital Signal Processor-An Educational Viewpoint," InternationalJournalfor ElectricalEngineering Education, Great Britain, Volume 23, Number 1, pages 21-31, January 1986. 85) P. Eckelman, "The Cascadable Signal Processor For Digital Signal Processing," Electronics Industry, Germany, Volume 17, Number 10, pages 26-27,1986. 86) R. Cook, "Digital Signal Processors," High Technology, USA, Volume 5, ~umber 10, pages 25-30, October 1985. 87) C.P. Howard, "A High-Level Approach to Digital Processing Design," Proceedings of MILCOMP/85, USA, October 1985. . . 88) H.E. Lee, "Versatile Data-Acquisition System Based on the Commodore C-64/C-128 Microcomputer," Proceedings of the Symposium ofNortheastern Accelerator Personnel, USA, Volume 57, Number 5, pages 983-985, October 1985. 89) N.K Riedel, D.A. McAninch, C. Fisher, and N.B. Goldstein, "A Signal Processing Implementation for an IBM PC-Based Workstation," IEEE Micro, USA, Volume 5, Number 5, pages 52-67, October 1985. 90) KE. Marrin, ~'VLSI and Software Move DSP Into Mainstream," Computer Design, USA, Volume 24, Number 9, pages 69-72, September 1985. 91) "Signal Processor ICs: Highly Integrated ICs Making DSP More Attractive," Electronics Engineering Times, USA, pages 37-38, September 2, 1985. 92) KE. Marrin, "VLSI and Software Move DSP Techniques into Mainstream," Computer Design, USA, September 1985. 93) "High-Speed Four-Channel Input Board," Electronics Weekly, USA, Number 1277, p. 31, July 24, 1985. 94) "4-ChanneIAnalog-Input Board Puts Signal-Processing on VMF Bus," EDN: Electronic Design News, USA, Volume 30, Number 17, page 74, July 1985. 95) R.H. Cushman, "Third-Generation DSPs Put Advanced Functions On-Chip," EDN: Electronic Design News, USA, July 1985. 96) W.w. Smith, Jr., "Agile Development System, Running on PCs, Builds TMS320-Based FIR Filter," Electronic Design, USA, Volume 33, Number 13, pages 129-138, June 6, 1985. 602 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 97) 98) 99) 100) 101) 102) 103) 104) 105) 106) 107) 108) 109) 110) 111) 112) 113) 114) S. Magar, SJ. Robertson, and W. Gass, "Interface Arrangement Suits Digital Processor to Multiprocessing," Electronic Design, USA, Volume 33, Number 5, pages 189-198, March 7, 1985. G. Kropp, "Signal Processor Offers Multiprocessor Capability," Elektronik, Germany, Volume 34, Number 6, pages 53-58, March 1985. S. Magar, D. Essig, E. Caudel, S. Marshall and R. Peters, "An NMOS Digital Signal Processor with Multiprocessing Capability," Digest ofIEEE International Solid-State Circuits Conference, USA, February 1985. "TI 'Shiva' Chip Outlined," Electronics Engineering Times, USA, page 15, February 18, 1985. S. Magar, E. Caudel, D. Essig, and C. Erskine, "Digital Signal Processor Borrows from P to Step up Performance, Electronic Design, USA, Volume 33, Number 4, pages 175-184, February 21,1985. C. Erskine, S. Magar, E. Caudel, D. Essig, and A. Levinspuhl, "A Second-Generation Digital Signal Processor TMS32020: Architecture and Applications," Traitement de Signal, France, Volume 2, Number 1, pages 79-83, January-March 19~5. S. Baker, "TI 'Shiva' Chip Outlined," Electronic Engineering Times, USA, Number 317, page 15, February 1985. S. Baker, "Silicon Bits," Electronic Engineering Times, USA, Number 316, page 42, February 1985. H. Bryce, "Board Arrives For Digital Signal Processing on the VMEbus," Electronic Design, USA, Volume 33, Number 2, page 266,1985. K. Marrin, "VME-Compatible DSP System Incorporates TMS320 Chip," EDN: Electronic Design News, USA, Volume 30, Number 2, page 122, January 1985. C. Erskine and S. Magar, "Architecture and Applications of A Second-Generation Digital Signal Processor," Proceedings of IEEE International Conference on Acoustics, Speech, and Signal Processing, USA, 1985. D.P. Morgan and H.E Silverman, "An Investigation into the Efficiency of a Parallel TMS320 Architecture: DFf and Speech Filterbank Applications," Proceedings of IEEE International Conference on Acoustics, Speech, and Signal Processing, USA, Volume 4, pages 1601-1604, 1985. P. Harold, "VME Bus Meeting Sparks Change in Standard, New Products," EDN: Electronic Design News, USA, Volume 29, Number 26, page 18, December 1984. W. Loges, "A Code Generator Sets up the Automatic Controller Program for the TMS320," Elektronik, Germany, Volume 33, Number 22, pages 154-158, November 1984. H. Volkers, "Fast Fourier Transforms with the TMS320 as Coprocessor," Elektronik, Germany, Volume 33, Number 23, pages 109-112, November 1984. Keun-Ho Ryoo, "On the Recent Digital Signal Processors," Journal of South Korean Institute of Electrical Engineering, South Korea, Volume 33, Number 9, pages 540-549, September 1984. D. Wilson, "Editor's Comment," Digital Design, USA, Volume 14, Number 9, page 14, September 1984. "Signal Processors Will Squeeze Into One Chip, Says TI's French," Electronics, USA, Volume 57, Number 9, pages 14,20, May 1984. Digital Signal Processing Applications with the TMS320 Family, Vol. 2 603 115) S. Mehrgardt, "32-BitProcessor Produces Analog Signals," Elektronik, Germany, Volume 33, Number 7, pages 77-82, April 1984. 116) S. Magar, "Signal Processing Chips Invite Design Comparisons," Computer Design, USA, Volume 23, Number 4, pages 179-186, April 1984. 117) S. Mehrgardt, "General-Purpose Processor System for Digital Signal Processing," Elektronik, Germany, Volume 33, Number 3, pages 49-53, February 1984. 118) T. Durham, "Chips: Familiarity Breeds Approval," Computing, Great Britain, page 26, January 1984. 119) J. Bradley and P. Ehlig, "Applications of the TMS32010 Digital Signal Porcessor and Their Tradeoffs," Midcon/84 Electronic Show and Convention, USA, 1984. 120) J. Bradley and P. Ehlig, "Tradeoffs in the Use ofthe TMS32010 as a Digital Signal Processing Element," Wescon/84 Conference Record, USA, 1984. 121) E. Fernandez, "Comparison and Evaluation of 32-Bit Microprocessors," Mini/Micro Southeast Computer Conference and Exhibition, USA, 1984. 122) D. Garcia, "Multiprocessing with the TMS3201O," Wescon/84 Conference Record, USA,1984. 123) S. Magar, "Architecture and Applications ofa Programmable Monolithic Digital Signal Processor - A Tutorial Review," Proceedings of IEEE International Symposium on Circuits and Systems, USA, 1984. 124) D. Quarmby (Editor), "Signal Processor Chips," Granada, England 1984. 125) R. Steves, "A Signal Processor with Distributed Control and Multidimensional Scalability," Proceedings ofIEEE N ationalAerospace and Electronics Conference, USA, 1984. 126) V. Vagarshakyan and L. Gustin, "On A Single Class of Continuous Systems - A Solution to the Problem on the Diagnosis of Output Signal Characteristics Recognition Pro- . cedures," IZV. AKAD. NAUK ARM. SSR, SER. TEKH. NAUK, USSR, Volume 37, Number 3, pages 22-27, 1984. 127) J. So, "TMS320 - A Step Forward in Digital Signal Processing," Microprocessors and Microsystems, Great Britain, Volume 7, Number 10, pages 451-460, December 1983. 128) J. Elder and S. Magar, "Single-Chip Approach to Digital Signal Processing," Wescon/83 Electronic Show and Convention, USA, November 1983. 129) M. Malcangi, "VLSI Technology for Signal Processing. III," Elettronica Oggi, Italy, Number 11, pages 129-138, November 1983. 130) P. Strzelcki, "Digital Filtering," Systems International, Great Britain, Volume 11, Number 11, pages 116-117, November 1983. 131) W. Loges, "Digital Controls Using Signal Processors," Elektronik, Germany, Volume ' 32, Number 19, pages 51-54, September 1983. 132) "TI's Voice Chip Makes Debut," Computerworld, USA, Volume 17, Number 15, page 91, April 1983. 133) L. Adams, "TMS320 Family 16/32-Bit Digital Signal Processor, An Architecture for Breaking Performance Barriers," Mini/Micro West 1983 Computer Conference and Exhibition, USA, 1983. 134) R. Blasco, "Floating-Point Digital Signal Processing Using a Fixed-Point Processor," Southcon/83 Electronics Show and Convention, USA, 1983. 604 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 135) R. Dratch, "A Practical Approach to Digital Signal Processing Using an Innovative Digital Microcomputer in Advanced Applications," Electro '83 Electronics Show and Convention, USA, 1983. 136) C. Erskine, "New VLSI Co-Processors Increase System Throughput," Mini/Micro Midwest Conference Record, USA, 1983. 137) L. Kaplan, "Flexible Single Chip Solution Paves Way for Low Cost DSP," Northcon/83 Electronics Show and Convention, USA, 1983. 138) L. Kaplan, "The TMS32010: A New Approach to Digital Signal Processing," Electro '83 Electronics Show and Convention, USA, 1983. 139) S.Mehrgardt, "Signal Processing with a Fast Microcomputer System," Proceedings ofEUSIPCO-83 Second European Signal Processing Conference, Netherlands, 1983. 140) L. Morris, "A Tale of Two Architectures: TI TMS 320 SPC VS. DEC Micro/J-11," Proceedings ofIEEE International Conference on Acoustics, Speech and Signal Processing, USA, 1983. 141). L. Pagnucco and D. Garcia, "A 16/32 Bit Architecture for Signal Processing," Mini/ Micro West 1983 Computer Conference and Exhibition, USA, 1983. 142) J. Potts, "A Versatile High Performance Digital Signal Processor," Ohmcon/83 Conference Record, USA, 1983. 143) J. Potts, "New 16/32-Bit Microcomputer Offers 200-ns Performance," Northcon/83 Electronics Show and Convention, USA, 1983. 144) R. Simar, "Performance of Harvard Architecture in TMS320," Mini/Micro West 1983 Computer Conference and Exhibition, USA, 1983. 145) K. McDonough, E. Caudel, S. Magar, and A. Leigh, "Microcomputer with 32-Bit Arithmetic Does High-Precision Number Crunching," Electronics, USA, Volume 55, Number 4, pages 105-110, February 1982. 146) K. McDonough and S. Magar, "A Single Chip Microcomputer Architecture Optimized for Signal Processing," Electro/82 Conference Record, USA, 1982. 147) L. Kaplan, "Signal Processing with the TMS320 Family," Midcon/82 Conference Record, USA, 1982. 148) S. Magar, "Trends in Digital Signal Processing Architectures," Wescon/82 Conference Record, USA, 1982. Graphics/Imaging 1) J.A. Lindberg, "Color Cell Compression Shrinks NTSC Images," ESD: Electronic Systems Design Magazine, USA, Volume 17, Number 10, pages 91-96, October 1987 2) S. Ganesan, "A Digitial Signal Processing Microprocessor Based Workstation For Myoelectric Signals," Fifth International Conference on System Engineering, USA, Catalog Number 87CH2480-2, pages 427-438, September 1987. 3) JU. Pokovny, O. Skoloud, "Digitisation of a Video Signal From a Television For a Microcomputer," Sdelovaci Tech., Czechoslovakia, Volume 35, Number 6, pages 207-211, June 1987. 4) M.E. Bukaty, "A Vehicle Identification System For Surveillance Applications," Topical Meeting on Machine Vision. Technical Digest Series, USA, Volume 12, pages 106-109, March 1987. Digital Signal Processing Applications with the TMS320 Family, Vol. 2 605 5) 6) 7) 8) 9) 10) 11) 12) 13) 14) 15) KN. Ngan, AA Kassim, H.S. Singh,"Parallel Image-Processing System Based on THe TMS32010 Digital Signal Processor," lEE Proceedings in Electronics, Great Britain, Volume 134, Number 2, pages 119-124, (March 1987. KN. Ngan, AA Kassim, H. Singh, "A TMS3201O-Based Fast Parallel Vison Processor," Proceedings ofthe International Workshop on IndustrialApplications ofMachine Vision and Machine Intelligence, Catalog Number 87TH0166-9, pages 156-161, February 1987. . P. Bellamah, "Hardware-Software Increases Video Storage Capacity," PC Week, USA, Volume 4, Number 4, page 15, January 271987. J.M. Younse, "Motion Detection Using the Statistical Properties ofa Video Image," Proceedings of SPIE International Society of Optical Engineering, USA, Volume 697, pages 233-243, August 1986. T. Gehrels, B.G. Marsden, RS. McMillan, J.V. Scotti, "Astrometry With a Scanning CCD," Astronomy Journal, USA, Volume 91, Number 5, pages 1242-1248, May 1986. S. Srinivasan, AK Jain, T.M. Chin, "Cosine Transform Block Codec For I~ages Using TMS32010," IEEE International Symposium on Circuits and Systems, USA, Catalog Number 86CH2255-8, Volume 1, pages 299-302, May 1986. D.M. Holburn and J.D. Sommerville, "A High-Speed Image Processing System Using the TMS32010," Software and Microsystems, Great Britain, Volume 4, Number 5-6, pages 102-108, October-December 1985. C. D. Crowell and R Simar, "Digital Signal Processor Boosts Speed of Graphics Display Systems," Electronic Design, USA, Volume 33, Number 7, pages 205-209, March 1985. J. Reimer and A Lovrich, "Graphics with the TMS32020," WESCON/85 Conference Record, USA, 1985. H. Megal and A Heiman, "Image Coding System - A Single Processor Implementation," MILCOM/85 IEEE Military Communications Conference Record, USA, 1985. G. Gaillat, "The CAPITAN Parallel Processor: 600 MIPS for Use in Real Time Imagery," Traitement de Signal, France, Volume 1, Number 1, pages 19-30, October-December 1984. Instrumentation 1) G.R. Halsall, D.R. Burton, M.J. Lalor, C.A Hobson, "A Novel Real-Time Opto-Electronic Profilometer Using FFT Processing," Proceedings of ICASSP 89, USA, pages 1634-1637, May 1989. 2) A.J. Pratt, RE. Gander, B.R Brandell, "Real-Time Median Frequency Estimator," Proceedings oftheNinthAnnual Conference ofthe IEEE Engineering in Medicine and Biology Society, USA, Volume 4, pages 1840-1841, November 1987. 3) D.Y. Cheng, A Gersho, "A Fast Codebook Search Algorithm For Nearest-Neighbor Pattern Matching," Proceedings of ICASSP 86, USA, Catalog Number 86CH2243-4, Vol 1, pages 265-268, April 1986. 4) Y. Chikada, M. Ishiguro, H. Hirabayashi, M. Morimoto, K Morita, T. Kanazawa, H. Iwashita, K Nakazima, S. Ishikawa, T. Takahashi, K Handa, T.Kazuga, S. Okumura, T. Miyazawa, K Miura, S. Nagasawa, "A Very Fast FFT Spectrum Analyzer For Radio 606 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 Astronomy," Proceedings ofICASSP 86, USA, Catalog Number 86CH2243-4, Volume 4, pages 2907-2910, April 1986. 5) R.C. Wittenberg, "Four Microprocessors Power Multifunction Analyzer," Electronic Engineering Times, USA, Number 306, page 30, November 1984. 6) D. Lee, T. Moran, and R. Crane, "Practical Considerations for Estimating Flaw Sizes from Ultrasonic Data," MaterialsEvaluation, Volume 42, Number 9, pages 1150-1158, August 1984. 7) S. Magar, R. Hester, and R. Simpson, "Signal-Processing c Builds FFT-Based Spectrum Analyzer," Electronic Design, USA, Volume 30, Number 17, pages 149-154, August 1982. Voice/Speech 1) A. Aktas, H. Hoge, "Multi-DSP and VQ-ASIC Based Acoustic Front-End for Real-Time Speech Processing Tasks," Proceedings of EUROSPEECH 89, pages 586-589, September 1989. 2) D. Bergmann, D. Boillon, F. Bonifacio, R. Breitschadel, "Experimental Speech Input/ Output System," Proceedings of ICASSP 89, USA, pages 1138-1141, May 1989. 3) J. DellaMorte, P.E. Papamichalis, "Full-Duplex Real-Time Implementation of the FED-STD-1015 LPC-lOe Standard V.52 on the TMS320C25," Proceedings of SPEECH TECH 89, pages 218-221, May 1989. 4) B.1. Pawate, G.R. Doddington, "Implementation of a Hidden Markov Model-Based Layered Grammar Recognizer," Proceedings ofICASSP 89, USA, pages 801-804, May 1989. 5) P.E. Papamichalis, "High Quality Speech Coding: Some Recent Algorithms," Proceedings of SPEECH TECH 89, pages 329-333, May 1989. 6) J.e. Ventura, "Digital Audio Gain Control for Hearing Aids," Proceedings of ICASSP 89, USA, pages 2049-2052, May 1989. 7) N. Matsui, H. Ohasi, "DSP-Based Adaptive Control of a Brushless Motor," IEEE Industry Application Society Annual Meeting; USA, October 1988. 8) A. Albarello, R. Breitschaedel, A. Ciaramella, E. Lenormand, "Implementation of an Acoustic Front-End For Speech Recognition," CSELT Technical Report, Italy, Volume 16, Number 5, pages 455-459, August 1988. 9) D. Curl, "Voice Over Data Means More For Your Money," Communications, Great Britain, Volume 5, Number 8, pages 27-29, August 1988. 10) H. Hanselman, H. Henrichfreise, H. Hostmann, A. Schwarte, "Hardware/Software Environment for DSP-Based Multivariable Control," 12th. IMACS World Congress, July 1988. 11) J.B. Attili, M. Savic, J.P. Campbell, Jr., "A TMS32020-Based Real Time Text-Independent, Automatic Speaker Verification System," Proceedings ofICASSP 88, USA, Volume S, page 599,April1988. 12) D. Chase, A. Gersho, "Real-Time VQ Codebook Generation Hardware For Speech Pro. cessing," Proceedings of ICASSP 88, USA, April 1988. 13) T. Kohonen, K. Torkkola, M. Shozaki, J. Kangas, O. Venta, "Phonetic Typewriter for Finnish and Japanese," Proceedings of ICASSP 88, USA, Volume S, page 607, April 1988. Digital Signal Processing Applications with the TMS320 Family, Vol. 2 14) I. Lecomte, M. Lever, L. Lelievre, M. Delprat, A Tassy, "Medium Band Radio Communications," Proceedings of ICASSP 88, USA, April 1988. 15) J.B. Reimer, KS. Lin, "TMS320 Digital Signal Processors in Speech Applications," Proceedings of SPEECH TECH '88, April 1988. 16) M. Smmendorfer, D. Kopp, H. Hackbarth, "A High-Performance Multiprocessor System for Speech Processing Applications," Proceedings ofICASSP 88, USA, Volume V, page 2108, April 1988. 17) P. Vary, K Hellwig, R. Hoffmann, RJ. Sluyter, C. Garland, M. Russo, "Speech Codec for the European Mobile Radio System," Proceedings ofICASSP 88, USA, Volume S, page 227, April 1988. . 18) A Hunt, "A Speaker-Independent Telephone Speech Recognition System: The VCS TeleRec," Speech Technology, USA, Volume 4, Number 2, pages 80-82, March-April 1988. 19) R.A Sukkar, J.L. LoCicero, J. W. Picone, "Design and Implementation of a Robust Pitch Detector Based on a Parallel Processing Technique," IEEE Journal of Selected A reas of Communications, USA, Volume 6, Number 2, pages 441-451, February 1988. 20) AZ. Baraniecki, "Digital Coding of Speech Algorithms and Architecture," Proceedings of IECON '87, November 1987. 21) G.R. Steber, "Audio Frequency DSP Laboratory on a Chip-TMS32010," Proceedings of IECON '87, Volume 2, pages 1047-1051, November 1987. 22) S.H. Kim, KR. Hong, H.B. Han, W.H. Hong, "Implementation of Real Time Adaptive Lattice Predictor on Digital Signal Processor," Proceedings ofTENCON 87, South Korea, Volume 3, pages 1131-1135, August 1987. 23) J.B. Reimer, M.L. McMahan, W.W. Anderson, "Speech Recognition For a Low Cost System Using a DSP," Digest of Technical Papers for 1987 International Conference on Consumer Electronics, June 1987. 24) A Ciaramella, G. Venuti, "Vector Quantization Firmware For an Acoustical Front-End Using the TMS32020," Proceedings of ICASSP 87, USA, Catalog Number 87CH2396-0, Volume 4, pages 1895-1898, April 1987. 25) G.A Frantz, KS. Lin, "A Low Cost Speech System Using the TMS320CI7," Proceedings of SPEECH TECH '87, pages 25-29, April 1987. 26) Z. Gorzynski, "Realtime Multitasking Speech Application on the TMS320," Microprocessors andMicrosystems, Great Britain, Volume 11, Number 3, pages 149-156, April 1987. 27) P. Papamichalis, D. Lively, "Implementation of the DOD Standard LPC-1O/52E on the TMS320C25," Proceedings of SPEECH TECH '87, pages 201-204, April 1987. 28) B.I.Pawate, M.L.McMahan, R.H. Wiggins, G.R. Doddington, P.K Rajasekaran, "Connected Word Processor on a Multiprocessor System," Proceedings ofICASSP 87, USA, Catalog Number 87CH2396-0, Volume 2, pages 1151-1154, April 1987. 29) S. Roucos, A Wilgus, W. Russell, "A Segment Vocoder Algorithm For Real-Time Implementation," Proceedings of ICASSP 87, USA, Catalog Number 87CH2396-0, Volume 4, pages 1949-1952, April 1987. 30) H. Yeh, "Adaptive Noise Cancellation For Speech With a TMS32020," Proceedings of ICASSP 87, USA, Catalog Number 87CH2396-0, Volume 2, pages 1171-1174, April 1987. 608 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 31) R. Conover, D. Gustafson, "VLSI Architecture For Cepstrum Calculations," 1987 IEEE Region 5 Conference, USA, Catalog Number 87CH2383-8, pages 63-64, March 1987. 32) K. Field, A Derr, L. Cosell, C. Henry, M. Kasner, {Tiao, "ASingle Board MultrateAPC Speech Coding Terminal," Proceedings of ICASSP 87, USA, Catalog Number 87CH2396-0, Volume 2, pages 960-963, April 1987. 33) H. Brehm, W. Stammler, "Description and Generation of Sperically Invariant Speech-Model Signals," Signal Processing, Netherlands, Volume 12, Number 2, pages 119-141, March 1987. 34) AZ. Baraniecki, "Digital Coding of Speech Algorithms and Architectures," Proceedings of IECON '87, Volume 2, pages 977-984, 1987. 35) B. Flocon, P. Lockwood, J. Sap, L. Sauter, "MARIPA: Speaker Independent Recognition of Speech on IBM-PC," Eighth International Conference on Pattern Recognition, Catalog Number 86CH2342-4, pages 893-895, October i986. 36) M.T. Reilly, "A Hybridized Linear Prediction Code Speech Synthesizer," Conference Records for MILCOM 86, USA, Catalog Number 86CH2323-4, Volume 2, 32.511-5, October 1986. 37) K. Torkkola, H. Riittinen, T. Kohonen, "Microprocessor-Based Word Recognizer For a Large Vocabulary," Eighth International Conference on Speech Recognition Proceedings, Catalog Number 86CH2342-4, pages 814-816, October 1986. 38) C.H. Lee, D.Y. Cheng, D.A Russo et ai, "An Integrated Voice-Controlled Voice Messaging System," Proceedings of Speech Technology 86, April 1986. 39) Kun-Shan Lin and G.A Frantz, "A Survey of Available Speech Hardware for Computer Systems," Proceedings of Speech Technology 86, April 1986. 40) L.R. Morris, "Software Engineering for an IBM PCrrI-SPEECH Realtime Digital Speech Spectrogram Production System," Proceedings ofSpeech Technology 86, April 1986. 41) K. Torkkola, H. Riittinen, "A Microprocessor-Based Recognition System For Large Vocabularies," Proceedings ofICASSP 86, USA, Catalog Number 86CH2243-4, Volume 1, pages 333-337, April 1986.1) 42) Z. Gorzynski, "Real Time Software Engineering on the TMS320: Application in a Pitch Detector Implementation," International Conference on Speech Input/Output; Techniques and Applications, Conference Publication Number 258, pages 270-275, March 1986. 43) S. Ganesan, M.O. Ahmad, "A Real Time Speech Signal Processor," Proceedings ofthe ISMM Internal Symposium, pages 46-49, February 1986. 44) L. Gutcho, "DECtalk-a Year Later," Speech Technology, Volume 3, Number 1, pages 98-102, August-September 1985. 45) B. Bryden, H.R. Hassanein, "Implementation of a Hybrid Pitch-Excited/Multipulse Vocoder for Cost-Effective Mobile Communications," Proceedings ofSpeech Technology 85, April 1985. 46) M. McMahan, "A Complete Speech Application Development Environment," Proceedings of SPEECH TECH 85, pages 293-295, April 1985. 47) H. Hassanein and B. Bryden, "Implementation of the Gold-Rabiner Pitch Detector in a Real Time Environment Using an Improved Voicing Detector," Proceedings ofIEEE International Conference on Acoustics, Speech and Signal Processing, USA, 1985. Digital Signal Processing Applications with the TMS320 Family, Vol. 2 609 48) K. Lin and G. Frantz, "Speech Applications with a General Purpose Digital Signal Processor," IEEE Region 5 Conference Record, usA, March 1985. 49) K. Lin and G. Frantz, "Speech Applications Created by a Microcomputer," IEEE Potentials, USA, December 1985. 50) M. Malcangi, "Programmable VLSI's for Vocal Signals," Electronica Oggi, Italy, Number 10, pages 103-113, October 1984. 51) V. Kroneck, "Conversing with the Computer," Elektrotechnik, Germany, Volume 66, Number 20, pages 16-18, October 1984. 52) P.K. Rajasekaran and G.R. Doddington, "Real-Time Factoring of the Linear Prediction Polynomial of Speech Signals," Digital Signal Processing -1984: Proceedings of the International Conference, pages 405-410, September 1984. 53) M. Hutchins and L. Dusek, "Advanced ICs Spawn Practical Speech Recognition," Computer Design, USA, Volume 23, Number 5, pages 133-139, May 1984. 54) E. Catier, "Listening Cards or Speech Recognition," Electronique Industrielle, France, Number 67, pages 72-76, March 1984. 55) O. Ericsson, "Special Processor Did Not Meet Requirements - Built Own Synthesizer," ElteknikAktuell Elektronik, Sweden, Number 3, pages 32-36, February 1984. 56) H. Strube, "Synthesis Part of a 'Log Area Ratio' Vocoder Implemented on a Signal-ProcessingMicrocomputer," IEEE Transactions on Acoustics; Speech and Signal Processing, USA, Volume ASSP-32, Number 1, pages 183-185, February 1984. 57) B. Bryden and H. Hassanein, "Implementation of Full Duplex 2.4 Kbps LPC Vocoder on a Single TMS320 Microprocessor Chip," Proceedings ofIEEE International Conference on Acoustics, Speech and Signal Processing, USA, 1984. 58) M. Dankberg, R. lItis, D. Saxton, and P. Wilson, "Implementation of the RELP Vocoder Using the TMS320," Proceedings of IEEE International Conference on Acoustics, Speech and Signal Processing, USA, 1984. 59) A. Holck and W. Anderson, "A Single-Processor LPC Vocoder," Proceedings ofIEEE International Conference on AcoustiCs, Speech and Signal Processing, USA, 1984. 60) N. Morgan, "Talking Chips," McGraw-Hill, 1984. 61) A. Kumarkanchan, "Microprocessors Provide Speech to Instruments," Journal ofInstitute ofElectronic and TelecommunicationEngineers, India, Volume 29, Number 12, December 1983. 62) L. Dusek, T. Schalk, and M. McMahan, "Voice Recognition Joins Speech on Programmable Board," Electronics, USA, Volume 56, Number 8, pages 128-132, April 1983. 63) J .R. Lineback, "Voice Recognition Listens For Its Cue," Electronics, USA, Volume 56, Number 1, page 110, January 1983. 64) D. Daly and L. Bergeron, CiA Programmable Voice Digitizer Using the TI TMS320 Microcomputer," Proceedings ofIEEE International Conference onAcoustics, Speech and Signal Processing, USA, 1983. 65) W. Gass, "The TMS32010 Provides Speech I/O for the Personal Computer," Mini/Micro Northeast Electronics Show and Convention, USA, 1983. 66) A. Holck, "Low-Cost Speech Processing with TMS32010," Midcon/83 Conference Record, USA, 1983. 610 Digital Signal Processing Applicalions with the TMS320 Family, Vol. 2 67) H. Strube, R. Wilhelms, and P. Meyer, "Towards Quasiarticulatory Speech Synthesis in Real Time," Proceedings ofEUSIPCO-83 Second European Signal Processing Conference, Netherlands, 1983. 68) T. Schalk and M. McMahan, "Firmware-Programmable lAc Aid Speech Recognition," Electronic Design, Volume 30, Number 15, pages 143-147, July 1982. Control 1) 2) 3) 4) 5) 6) 7) 8) 9) 10) 11) 12) 13) 14) 15) 16) I. Ahmed, "16-Bit DSP Microcontroller Fits Motion Control System Application," PCIM, October 1988; D. Bursky, "Merged Resources Solve Control Headaches," Electronic Design, USA, pp 157-159, October 1988. 1. Ahmed, "Implementation of Self Tuning Regulators with TMS320 Family of Digital Signal Processors," MOTORCON '88, pages 248-262, September 1988. D. Dunnion, M. Stropoli, "Design a Hard-Disk Controller with DSP Techniques," Electronic Design, USA, pages 117-121, September 1988. R. van der Kruk, J. Scannell, "Motion Controller Employs DSP Technology," PCIM, September 1988. S.w. Yates, R.D. Williams, "A Fault Tolerant Multiprocessor Controller For Magnetic Bearings," IEEE Micro, USA, Volume 8, Number 4, page 6, August 1988. I. Garate, R.A Carrasco, AL. Bowden, "An Integrated Digital Controller For Brushless AC Motors Using a DSP Microprocessor," Third International Conference on Power Electronics and Variable-Speed Drive, Conference Publication Number 291, Conference Publication Number 291, pages 249-252, July 1988. J.M. Corliss, R. Neubert, "DSP Keeps Keep Disk Drive on Track," Computer Design, USA, pages 60-65, June 1988. Y. V. V.S. Murty, W.J. Smolinski, S. Sivakumar, "Design of a Digital Protection Scheme For PoWer Transformers Using Optimal State Observers," lEE Proc. C, Generation Transmission, Distribution, Great Britain, Volume 135, Number 3, pages 224--230, May 1988. R.D. Jackson, D.S. Wijesundera, "Direct Digital Control ofInduction Motor Currents," lEE Colloquim on 'Microcomputer Instrumentation and Control Systems in Power Electronics, Great Britain, Digest Number 61,1/1-3, April 1988. A Lovrich, G. Troullinos, R. Chirayil, "An All Digital Automatic Gain Control," Proceedings of ICASSP 88, USA, Volume D, page 1734, April 1988. K. Bala, "Running on Imbedded Power," Electronics Engineering Times, USA, March 1988. I. Ahmed, S. Meshkat, "Using DSPs in Control," Control Engineering, February 1988. M. Babb (Editor), "Solving Control Problems With Specialized Processors," Control Engineering, February 1988. S. Meshkat, "High-Level Motion Control Programming Using DSPs," Control Engineering, February 1988. S. Meshkat, I. Ahmed, "Using DSPs in AC Induction Motor Drives," ControlEngineering, February 1988. Digital Signal Processing Applications with the TMS320 Family, Vol. 2 611 17) J. Tan, N. Kyriakopoulos, "Implemmention of a Tracking Kalman Filter on a Digital Signal Processor," IEEE Transactions oJIndustrialElectronics, USA, Volume 35, Number 1, pages 126-134, February 1988. 18) H. Hanselman, "LQG-Control of a Highly Resonant Disc Drive Head Positioning ACe tuator," IEEE Transactions on Industrial Electronics, USA, Volume 35, Number 1, pages 100-104, February 1988. 19) 1. Ahmed, "DSP Architectures for Digital Control Systems," SATECH 1988,1988. 20) S. Meskat, "Advanced Motion Control Systems," Intertec Communications - Ventura, CA.,1988. 21) I. Ahmed, S. Lundquist, "DSPs Tame Adaptive Control," Machine Design, USA, Volume 59, Number 28, pages 125-129, November 1987. 22) B.K. Bose, P.M. Szczesny, "A Microcomputer-Based Control and Simulation of an Advanced IPM Synchronous Machine Drive System For Electric Vehicle Propulsion," Proceedings of IECON '87, Volume 1, pages 454-463, November 1987. 23) Y. Dote, M. Shinojima, R.G. Hoft, "Digital Signal Processor (DSP)-Based Novel Variable Structure Control For Robotic Manipulator," Proceedings ofIECON '87, Volume 1, pages 175-179, November 1987. 24) J.P. Pratt, S. Gruber, "A Real-Time Digital Simulation of Synchronous Machines: Stability Consiferations and Implementation," IEEE Transactions on Industrial Electronics, USA, Volume 1E-34, Number 4, pages 483-493, November 1987. 25) I. Ahmed, "Deadbeat Controllers and Observers with the TMS320," MOTORCON '87, pages 22-33, September 1987. 26) I. Ahmed, S. Lindquist, "Digital Signal Processors: Simplifying High-Performance Control," Machine Design, September 1987. 27) R.D. Ciskowski, C.H. Liu, H.H. Ottesen, S.U.. Rahman, "System Identification: An Experimental Verification," IBM Journal ofResearch Developments, Volume 31, Number 5, pages 571-584, September 1987. 28) J.A. Taufiq, RJ. Chance, CJ. Goodman, "On-Line Implementation of Optimised PWM Schemes For Traction Inverter Drives," International Conference of 'Electric Railway Systems For a New Century, Conference Publication Number 279, September 1987. 29) Y. Dote, M. Shinojima, H. Yoshimura, "Microprocessor-Based Novel Variable Structure Control For Robot Manipulator," Proceedings of the 10th. IFAC World Congress, July 1987. 30) H. Hanselmann, A. Schwarte, "Generation of Fast Target Processor Code From High Level Controller Descriptions," Presented at 10th. IFAC World Congress, July 1987. 31) E. Debourse, "Emergence ofDSPs in Machine-Tool Axes Control Systems: Application of Distributed Interpolation Concepts," Proceedings of the International Workshop on IndustrialAutomation, February 1987. 32) C. Chen, "The Mathematical Model and Computer Simulation of an LCI Drive," Electrical Machinery Power Systems, USA, Volume 13, Number 3, pages 195-206, 1987. 33) R.D. Ciskowski, C.H. Liu, H.H. Ottesen, S.U. Rahman, "System Identification: An Experimental Verification," IBM Journal Research Development, USA, September 1987. 34) H. Hanselmann, "Implementation of Digital Controllers - A Survey," Automatica, Volume 23, Number 1, pages 7-32, 1987. 612 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 35) H. Henrichfreise, W. Moritz, H. Siemensmeyer, "Control of a Light, Elastic Manipulation Device," Conference on Applied Motion Control, 1987. 36) M.e. Stich, "Digital Servo Algorithm For Disk Actuator Control," Conference on Applied Motion Control, pages 35-41, 1987. 37) T. Takeshita, K. Kameda, H. Ohashi, N. Matsui, "Digital Signal Processor Based High Speed Current Control of Brushless Motor," Electronic Engineering, Japan, USA, Volume 106, Number 6, pages 42-49, November-December 1986. 38) R. Lessmeier, W. Schumacher, W. Leonard, "Microprocessor-Controlled AC-Servo Drives With Synchronous or Induction Motors: Which is Preferable?," IEEE Transactions On Industry Applications, USA, September/October 1986. 39) R. Alcantara, J. Prado, C Guegen, "Fixed-Point Implementation of the Fast Kalman Algorithm: Using the TMS32010 Microprocessor," Proceedings of EUSIPCO-86, Volume 2, pages 1335-1338, September 1986. 40) B. Nowrouzian, M.H. Hamza, "DC Motor Control Using a Switched-Capacitor Circuit," Proceedings of the lASTED International Symposium on High Technology in the Power Industry, pages 352-356, August 1986. 41) N. Matsui, T. Takeshita, "Digital Signal Processor-Based Controllers For Motors," SICE, July 1986. 42) H. Hanselmann, "Using Digital Signal Processors For Control," Proceedings ofEICON, 1986. 43) H. Hanselman, W. Moritz, "High Banwidth Control of the Head Positioning Mechanism in a Winchester Disc Drive," Proceedings of IECON, pages 864-869, 1986. 44) R. Cushman, "Easy-to-Use DSP Converter ICs Simplify Industrial-Control Tasks," Electronic Design, USA, Volume 29, Number 17, pages 218-228, August 1984. 45) W. Loges, "Signal Processor as High-Speed Digital Controller," Elektronik Industrie, Germany, Volume 15, Number 5, pages 30-32,1984. 46) W. Loges, "Higher-Order Control Systems with Signal ProcessorTMS320," Elektronik, Germany, Volume 32, Number 25, pages 53-55, December 1983. Military 1) V. Lazzari, Quacchia, M. Sereno, E. Turco, "Implementation of a 16 Kbit/s Split Band-Adaptive Predictive Codec For Digital Mobile Radio Systems," CSELTTechnical Reports, Italy, Volume 16, Number 5, pages 443-447, August 1988. 2) P. Papamichalis, J. Reimer, "Implementation ofthe Data Encryption Standard Using the TMS3201O," Digital Signal Processing Applications, 1986. Telecommunications 1) S. Casale, R. Russo, G.e. Bellina, "Optimai Architectural Solution Using DSP Processors for the Implementation of an ADPCM Transcoder," Proceedings of GLOBECOM '89, pages 1267-1273, November 1989. 2) A. Lovrich and J.B. Reimer, "A Multi-Rate Transcoder," Transactions on Consumer Electronics, USA, November 1989. 3) J.L. Dixon, V.K. Varma, N.R. Sollenberger, D.W. Lin, "Single DSP Implementation of a 16 Kbps Sub-Band Speech Coder for Portable Communications," Proceedings of ICASSP 89, USA, pages 184-187, May 1989. Digital Signal Processing Applications with the TMS320 Family, Vol. 2 613 614 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 Index A AID converter 96 ADADC84 97 ADDACI00 102 address bus 36 decoding 67 space 55 addressing modes 40 benchmarks 27, 47 block diagram TMS320C17 194 TMS320C25 33 c CCITT standards 334 CEPT 432 asynchronous devices 169 codec AID, D/A conversions 275 DTMF application 430 interface TMS320C17/E17 197 TMS320C2x 92 TMS370COI0 205 TCM2916 479 TCM2917 342,437,464 asynchronous/synchronous conversion 269 control applications 27 automatic gain control (see AGC) coprocessor port (TMS320CI7) 480 auxiliary register file 35 crystal oscillator 89 AGC 233, 254, 285, 393 architecture 15 TMS320C17/E17 193 TMS320C25 33 TMS320Cx 55 Harvard 15 cycle, instruction 16 B baud alignment 262 D baud energy detector 394 D/A converter 102 Bell 212A/Y.22 223, 333, 354 data bus 36 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 615 demodulator structure equations 278 frame sync m~de bit 36 differential phase shift keying (see DPSK) FSK transmission 336 DMA 24, 36, 43 FSMbit 36 DPSK 226 G DSP characteristics 13,31 DTMF 425 history 427 specification 440 TMS320C17 use with 430 graphics processing 27,47 dual-tone multifrequency (see DTMF) H hardware gain control 398 Harvard architecture 15 E Hilbert transformers 283 external interfaces 24 hold mode 159 external memory 61 I F ICC (see Supply Current) family, TMS320 processors 4, 13 first generation (TMS320C1x) 17, 434 second generation (TMS320C2x) 19 third generation (TMS320C3x) 22 filter adaptive 232 antialiasing 104 bandpass (tone receiver) 442 bandpass, SCl1005 342 FIR 13, 46, 246, 250, 444 loop 265 lowpass 104 phase delay filter coefficients 363 smoothing 102 split band 397 filtering 13, 26, 45, 102 initialization of processor 112, 116, 120 instruction cycle 16 instruction set 25, 37 instrumentation applications 27 interrupt 113, 448-460 RINT 117 TMS320C17 119 K knowledge-based systems 191 L FIR filter 13, 46, 246,250, 444 loopback test (UART) 181 fractional number representation 405 low-pass filter 104-105,231 616 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 M memory CY7C169-25 SRAM 76 external, interface 61 global 43 interface 80 MT5C6408-20 SRAM 86 read timing 62, 72, 75, 78 TBP30L165 62 TMS27C292 68 TMS27C64-15 85 TMS27C64-20 74 TMS310C17 interface 192 TMS320C25 34, TMS320C25-50 TMS370C010 EEPROM 191 wait states selection 56, 85 two 59,74 zero 57,83 write timing 62, 78 WS57C64F-12 70 memory map modem receiver tasks 266 TMS320C25 34 modem 300 bps example 333 analog front end 397 automatic gain control 391 carrier 235 carrier recovery 257 CCITT Standards 334 demodulator 233 encoder 230 errors 273, 400 FSK modulator 353 FSK transmission 336 functional blocks 224 hardware 242 hardware gain control 398 Hilbert transformers 283 implement using DSP 223 receiver 231 spectral response 335 splitband 335 status register use 349 transmission 229, 391 multiplier 16, 35 N numeric processing 27 p PAL 20LB 437 P16LB 217 parallel instructions 41 performance 15 period register 36 peripherals 24 NO converter 96, 102 combo-codec 92 interface 92 pipelining 15, 24 power (envelope) detector 432,442 powerdown mode 159 Q quadrature amplitude modulation (QAM) 391 Digital Signal Processing Applications with the TMS320 Family, Vol. 2 617 R read/write memory timings 79; 87 Ready timing 56 inverter 155 frequency correspondence 158, 160 variation w/loading 159 variation w/temperature 163 synchronous/asynchronous conversion 269 real time processing 13,31 receive (UART) 175 T reference documents 8 repeat counter 36 time registers 36, 470 RESET 87 timer interrupt rate 171 register 36 TMS320C2x 101 s TLC32040 (analog interface) 107 sample rates 14 TMS320C17 overview 196 scrambler 230 TMS320C25 overview 33 security 476 TMS370COlO controller 191, 199 serial port 36 AIC interface 115 codec interface 92, 195 TMS320C17 119,195 TMS320C2x 92 TMS1742 microcomputer 242, 268 tone (phone) detector 430 transmit (UART) 173 smoothing filter 102 software development tools 26, 44 split-band filtering 397 u DART 169, 339 SRAM 76,86 start bit 170 supply current (ICc) considerations 155 618 w wait states (see memory) Digital Signal Processing Applications with the TMS320 Family, Vol. 2 ~ TEXAS INSTRUMENTS Printed in U.S.A ., March 1990 SPRA016
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.3 Linearized : No XMP Toolkit : Adobe XMP Core 4.2.1-c041 52.342996, 2008/05/07-21:37:19 Create Date : 2017:07:26 18:04:24-08:00 Modify Date : 2017:07:26 19:07:29-07:00 Metadata Date : 2017:07:26 19:07:29-07:00 Producer : Adobe Acrobat 9.0 Paper Capture Plug-in Format : application/pdf Document ID : uuid:20ff0b54-fade-7444-bfd2-fc2e99bdc2cf Instance ID : uuid:d8c8880c-3eb4-e64e-9a6b-132249ff3dc4 Page Layout : SinglePage Page Mode : UseNone Page Count : 628EXIF Metadata provided by EXIF.tools