Texas Instruments TMS320C2XX manuel d'utilisation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587

Aller à la page of

Un bon manuel d’utilisation

Les règles imposent au revendeur l'obligation de fournir à l'acheteur, avec des marchandises, le manuel d’utilisation Texas Instruments TMS320C2XX. Le manque du manuel d’utilisation ou les informations incorrectes fournies au consommateur sont à la base d'une plainte pour non-conformité du dispositif avec le contrat. Conformément à la loi, l’inclusion du manuel d’utilisation sous une forme autre que le papier est autorisée, ce qui est souvent utilisé récemment, en incluant la forme graphique ou électronique du manuel Texas Instruments TMS320C2XX ou les vidéos d'instruction pour les utilisateurs. La condition est son caractère lisible et compréhensible.

Qu'est ce que le manuel d’utilisation?

Le mot vient du latin "Instructio", à savoir organiser. Ainsi, le manuel d’utilisation Texas Instruments TMS320C2XX décrit les étapes de la procédure. Le but du manuel d’utilisation est d’instruire, de faciliter le démarrage, l'utilisation de l'équipement ou l'exécution des actions spécifiques. Le manuel d’utilisation est une collection d'informations sur l'objet/service, une indice.

Malheureusement, peu d'utilisateurs prennent le temps de lire le manuel d’utilisation, et un bon manuel permet non seulement d’apprendre à connaître un certain nombre de fonctionnalités supplémentaires du dispositif acheté, mais aussi éviter la majorité des défaillances.

Donc, ce qui devrait contenir le manuel parfait?

Tout d'abord, le manuel d’utilisation Texas Instruments TMS320C2XX devrait contenir:
- informations sur les caractéristiques techniques du dispositif Texas Instruments TMS320C2XX
- nom du fabricant et année de fabrication Texas Instruments TMS320C2XX
- instructions d'utilisation, de réglage et d’entretien de l'équipement Texas Instruments TMS320C2XX
- signes de sécurité et attestations confirmant la conformité avec les normes pertinentes

Pourquoi nous ne lisons pas les manuels d’utilisation?

Habituellement, cela est dû au manque de temps et de certitude quant à la fonctionnalité spécifique de l'équipement acheté. Malheureusement, la connexion et le démarrage Texas Instruments TMS320C2XX ne suffisent pas. Le manuel d’utilisation contient un certain nombre de lignes directrices concernant les fonctionnalités spécifiques, la sécurité, les méthodes d'entretien (même les moyens qui doivent être utilisés), les défauts possibles Texas Instruments TMS320C2XX et les moyens de résoudre des problèmes communs lors de l'utilisation. Enfin, le manuel contient les coordonnées du service Texas Instruments en l'absence de l'efficacité des solutions proposées. Actuellement, les manuels d’utilisation sous la forme d'animations intéressantes et de vidéos pédagogiques qui sont meilleurs que la brochure, sont très populaires. Ce type de manuel permet à l'utilisateur de voir toute la vidéo d'instruction sans sauter les spécifications et les descriptions techniques compliquées Texas Instruments TMS320C2XX, comme c’est le cas pour la version papier.

Pourquoi lire le manuel d’utilisation?

Tout d'abord, il contient la réponse sur la structure, les possibilités du dispositif Texas Instruments TMS320C2XX, l'utilisation de divers accessoires et une gamme d'informations pour profiter pleinement de toutes les fonctionnalités et commodités.

Après un achat réussi de l’équipement/dispositif, prenez un moment pour vous familiariser avec toutes les parties du manuel d'utilisation Texas Instruments TMS320C2XX. À l'heure actuelle, ils sont soigneusement préparés et traduits pour qu'ils soient non seulement compréhensibles pour les utilisateurs, mais pour qu’ils remplissent leur fonction de base de l'information et d’aide.

Table des matières du manuel d’utilisation

  • Page 1

    TMS320C2xx User ’ s Guide Literature Number: SPRU127B Manufacturing Part Number: D412008-9761 revision A January 1997 Printed on Recycled Paper[...]

  • Page 2

    IMPORT ANT NOTICE T exas Instruments (TI) reserves the right to make changes to its products or to discontinue any semiconductor product or service without notice, and advises its customers to obtain the latest version of relevant information to verify , before placing orders, that the information being relied on is current. TI warrants performance[...]

  • Page 3

    How to Use This Manual iii Preface Read This First About This Manual This user ’s guide describes the architecture, hardware, assembly language instructions, and general operation of the TMS320C2xx digital signal processors (DSPs). This manual can also be used as a reference guide for developing hardware and/or software applications. In this docu[...]

  • Page 4

    How to Use This Manual iv For this information: Look here: Addressing modes (for addressing data memory) Chapter 6, Addressing Modes Assembly language instructions Chapter 7, Assembly Language Instructions Assembly language instructions of TMS320C1x, ’C2x, ’C2xx, and ’C5x compared Appendix B, TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison [...]

  • Page 5

    Notational Conventions/Information About Cautions v Read This First Notational Conventions This document uses the following conventions: Program listings and program examples are shown in a special typeface . Here is a segment of a program listing: OUTPUT LDP #6 ;select data page 6 BLDD #300, 20h ;move data at address 300h to 320h RET In syntax des[...]

  • Page 6

    Related Documentation From T exas Instruments vi Related Documentation From T exas Instruments This subsection describes related TI  documents that can be ordered by calling the T exas Instruments Literature Response Center at (800) 477–8924. When ordering, please identify the document by its title and literature number . The following data sh[...]

  • Page 7

    Related Documentation From T exas Instruments vii Read This First TMS320C2xx Simulator Getting Started (literature number SPRU137) describes how to install the TMS320C2xx simulator and the C source debugger for the ’C2xx. The installation for MS-DOS  , PC-DOS  , SunOS  , Solaris  , and HP-UX  systems is covered. TMS320C2xx Emulator[...]

  • Page 8

    Related Articles viii Related Articles “A Greener World Through DSP Controllers”, Panos Papamichalis, DSP & Multimedia T echnology , September 1994. “A Single-Chip Multiprocessor DSP for Image Processing—TMS320C80”, Dr . Ing. Dung T u, Industrie Elektronik , Germany , March 1995. “Application Guide with DSP Leading-Edge T echnology?[...]

  • Page 9

    Related Articles ix Read This First “Fixed or Floating? A Pointed Question in DSPs”, Jim Larimer and Daniel Chen, EDN , August 3, 1995. “Function-Focused Chipsets: Up the DSP Integration Core”, Panos Papamichalis, DSP & Multimedia T echnology , March/April 1995. “GSM: Standard, Strategien und Systemchips”, Edgar Auslander , Elektron[...]

  • Page 10

    T rademarks x Trademarks TI, 320 Hotline On-line, XDS510, XDS510PP , XDS510WS, and XDS51 1 are trademarks of T exas Instruments Incorporated. HP-UX is a trademark of Hewlett-Packard Company . Intel is a trademark of Intel Corporation. MS-DOS and Windows are registered trademarks of Microsoft Corporation. PA L  is a registered trademark of Advanc[...]

  • Page 11

    If Y ou Need Assistance xi Read This First If Y ou Need Assistance. . . World-W ide Web Sites TI Online http://www .ti.com Semiconductor Product Information Center (PIC) http://www .ti.com/sc/docs/pic/home.htm DSP Solutions http://www .ti.com/dsps 320 Hotline On-line http://www .ti.com/sc/docs/dsps/support.html North America, South America, Central[...]

  • Page 12

    Contents xiii Contents 1 Introduction 1-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Summarizes the features of the TMS320 family of products and presents typical applications. Describes the TMS320C2xx DSP and lists its key features. 1.1 TMS320 Family 1-2[...]

  • Page 13

    Contents xiv 3 Central Processing Unit 3-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Describes the TMS320C2xx CPU. Includes information about the central arithmetic logic unit, the accumulator , the shifters, the multiplier , and the auxiliary register arithmetic unit. Conclu[...]

  • Page 14

    Contents xv Contents 5 Program Control 5-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Describes the TMS320C2xx hardware and software features used in controlling program flow , including program-address generation logic and interrupts. Also describes the reset op[...]

  • Page 15

    Contents xvi 6.3 Indirect Addressing Mode 6-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.1 Current Auxiliary Register 6-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.2 Indirect Addressing Options 6-9 . . . . . . . . . . . . . . . . . . .[...]

  • Page 16

    Contents xvii Contents 9 Synchronous Serial Port 9-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Describes the operation and control of the TMS320C2xx on-chip synchronous serial port. 9.1 Overview of the Synchronous Serial Port 9-2 . . . . . . . . . . . . . . . . . . . . . . . . [...]

  • Page 17

    Contents xviii 10.3 Controlling and Resetting the Port 10-7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.3.1 Asynchronous Serial Port Control Register (ASPCR) 10-7 . . . . . . . . . . . . . . . . . . . . 10.3.2 I/O Status Register (IOSR) 10-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]

  • Page 18

    Contents xix Contents D Submitting ROM Codes to TI D-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Explains the process for submitting custom program code to TI for designing masks for the on-chip ROM on a TMS320 DSP . E Design Considerations for Using XDS510 Emulator E-1 . . . . . . . .[...]

  • Page 19

    Figures xx Figures 1–1 TMS320 Family 1-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–1 Overall Block Diagram of the ’C2xx 2-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–2 Bus Structure Block Diagram 2-4 . . [...]

  • Page 20

    Figures xxi Contents 5–5 INT2/INT3 Request Flow Chart 5-18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5–6 Maskable Interrupt Operation Flow Chart 5-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5–7 ’C2xx Interrupt Flag Register (IFR) — Data-Memory Ad[...]

  • Page 21

    Figures xxii 1 1–2 ’C209 Interrupt Flag Register (IFR) — Data-Memory Address 0006h 1 1-12 . . . . . . . . . . . . . . . 1 1–3 ’C209 Interrupt Mask Register (IMR) — Data-Memory Address 0004h 1 1-13 . . . . . . . . . . . . . 1 1–4 ’C209 T imer Control Register (TCR) — I/O Address FFFCh 1 1-15 . . . . . . . . . . . . . . . . . . . . [...]

  • Page 22

    T ables xxiii Contents T ables 1–1 T ypical Applications for TMS320 DSPs 1-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–2 ’C2xx Generation Summary 1-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–1 Program and Data Memory on the TMS320C[...]

  • Page 23

    T ables xxiv 9–1 SSP Interface Pins 9-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9–2 Run and Emulation Modes 9-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9–3 Controlling T ransmit Interrupt Generation[...]

  • Page 24

    Examples xxv Contents Examples 4–1 An Interrupt Service Routine Supporting INT1 and HOLD 4-28 . . . . . . . . . . . . . . . . . . . . . . . . . 6–1 RPT Instruction Using Short-Immediate Addressing 6-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–2 ADD Instruction Using Long-Immediate Addressing 6-2 . . . . . . . . . . . . .[...]

  • Page 25

    Notes, Cautions, and Warnings xxvi Cautions Obtain the Proper T iming Information 4-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Do Not Write to T est/Emulation Addresses 4-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Obtain the Proper T im[...]

  • Page 26

    1-1 Introduction Introduction The TMS320C2xx (’C2xx) is one of several fixed-point generations of DSPs in the TMS320 family . The ’C2xx is source-code compatible with the TMS320C2x. Much of the code written for the ’C2x can be reassembled to run on a ’C2xx device. In addition, the ’C2xx generation is upward compatible with the ’C5x gene[...]

  • Page 27

    TMS320 Family 1-2 1.1 TMS320 Family The TMS320 family consists of fixed-point, floating-point, and multiprocessor digital signal processors (DSPs). TMS320 DSPs have an architecture de- signed specifically for real-time signal processing. The following characteris- tics make this family the ideal choice for a wide range of processing applica- tions:[...]

  • Page 28

    TMS320 Family 1-3 Introduction Figure 1–1. TMS320 Family Performance[...]

  • Page 29

    TMS320 Family 1-4 1.1.2 T ypical Applications for the TMS320 Family T able 1–1 lists some typical applications for the TMS320 family of DSPs. The TMS320 DSPs offer adaptable approaches to traditional signal-processing problems such as filtering and vocoding. They also support complex applications that often require multiple operations to be perfo[...]

  • Page 30

    TMS320C2xx Generation 1-5 Introduction 1.2 TMS320C2xx Generation T exas Instruments uses static CMOS integrated-circuit technology to fabricate the TMS320C2xx DSPs. The architectural design of the ’C2xx is based on that of the ’C5x. The operational flexibility and speed of the ’C2xx and ’C5x are a result of an advanced, modified Harvard arc[...]

  • Page 31

    Key Features of the TMS320C2xx 1-6 1.3 Key Features of the TMS320C2xx Key features on the various ’C2xx devices are: Speed: 50-, 35-, or 25-ns execution time of a single-cycle instruction 20, 28.5, or 40 MIPS Code compatibility with other TMS320 fixed-point devices: Source-code compatible with all ’C1x and ’C2x devices Upward compatible with [...]

  • Page 32

    Key Features of the TMS320C2xx 1-7 Introduction Instruction set: Single-instruction repeat operation Single-cycle multiply/accumulate instructions Memory block move instructions for better program/data management Indexed-addressing capability Bit-reversed indexed-addressing capability for radix-2 FFT s On-chip peripherals: Software-programmable tim[...]

  • Page 33

    2-1 Architectural Overview Architectural Overview This chapter provides an overview of the architectural structure and compo- nents of the ’C2xx. The ’C2xx DSPs use an advanced, modified Harvard archi- tecture that maximizes processing power by maintaining separate bus struc- tures for program memory and data memory . The three main components [...]

  • Page 34

    2-2 Figure 2–1. Overall Block Diagram of the ’C2xx Program control PRDB PRDB DRDB DRDB DWEB DRAB DW AB PA B DWEB Stack 8 × 16 MUX MST ACK PA R NP AR MUX PC ROM/flash SARAM DARAM B0 DARAM B1, B2 ST0 IMR IFR GREG ST1 MUX Input shifter Multiplier 16 × 16 TREG MUX PREG Product shifter Accumulator Output shifter Auxiliary registers 8 × 16 CALU AR[...]

  • Page 35

    ’C2xx Bus Structure 2-3 Architectural Overview 2.1 ’C2xx Bus Structure Figure 2–2 shows a block diagram of the ’C2xx bus structure. The ’C2xx inter- nal architecture is built around six 16-bit buses: P AB. The program address bus provides addresses for both reads from and writes to program memory . DRAB. The data-read address bus provides[...]

  • Page 36

    ’C2xx Bus Structure 2-4 Figure 2–2. Bus Structure Block Diagram B0 DARAM ROM/ flash SARAM B1, B2 DARAM Memory mapped registers PA B DRAB DW AB PRDB DRDB DWEB Control bus External signals Memory control MUL TI_DSP CLOCK/PLL Interrupts JT AG/TEST Central processing unit (CPU) Auxiliary registers registers Status ARAU CALU Accumulator Multiplier P[...]

  • Page 37

    Central Processing Unit 2-5 Architectural Overview 2.2 Central Processing Unit The CPU is the same on all the ’C2xx devices. The ’C2xx CPU contains: A 32-bit central arithmetic logic unit (CALU) A 32-bit accumulator Input and output data-scaling shifters for the CALU A 16-bit × 16-bit multiplier A product-scaling shifter Data-address generatio[...]

  • Page 38

    Central Processing Unit 2-6 2.2.3 Multiplier The on-chip multiplier performs 16-bit × 16-bit 2s-complement multiplication with a 32-bit result. In conjunction with the multiplier , the ’C2xx uses the 16-bit temporary register (TREG) and the 32-bit product register (PREG). The TREG always supplies one of the values to be multiplied. The PREG rece[...]

  • Page 39

    Memory and I/O Spaces 2-7 Architectural Overview 2.3 Memory and I/O Spaces The ’C2xx memory is organized into four individually selectable spaces: pro- gram, local data, global data, and I/O. These spaces form an address range of 224K words. All ’C2xx devices include 288 words of dual-access RAM (DARAM) for data memory and 256 words of data/pro[...]

  • Page 40

    Memory and I/O Spaces 2-8 CPU reads data on the third cycle and writes data on the fourth cycle. However , DARAM allows the CPU to write and read in one cycle; the CPU writes to DARAM on the master phase of the cycle and reads from DARAM on the slave phase. For example, suppose two instructions, A and B, store the accumulator value to DARAM and loa[...]

  • Page 41

    Memory and I/O Spaces 2-9 Architectural Overview 2.3.4 Flash Memory Some of the ’C2xx devices feature on-chip blocks of flash memory , which is electronically erasable and programmable, and non-volatile. Each block of flash memory will have a set of control registers that allow for erasing, pro- gramming, and testing of that block. The flash memo[...]

  • Page 42

    Program Control 2-10 2.4 Program Control Several features provide program control: The program controller of the CPU decodes instructions, manages the pipeline, stores the status of operations, and decodes conditional opera- tions. Elements involved in program control are the program counter , the status registers, the stack, and the address-genera[...]

  • Page 43

    On-Chip Peripherals 2-1 1 Architectural Overview 2.5 On-Chip Peripherals All the ’C2xx devices have the same CPU, but different on-chip peripherals are connected to their CPUs. The on-chip peripherals featured on the ’C2xx de- vices are: Clock generator (an oscillator and a phase lock loop circuit) CLK register for turning the CLKOUT1 pin on an[...]

  • Page 44

    On-Chip Peripherals 2-12 2.5.5 General-Purpose I/O Pins The ’C2xx has pins that provide general-purpose input or output signals. All ’C2xx devices have a general-purpose input pin, BIO , and a general-purpose output pin, XF . Except for the ’C209, the ’C2xx devices also have pins IO0, IO1, IO2, and IO3, which are connected to corresponding [...]

  • Page 45

    Scanning-Logic Circuitry 2-13 Architectural Overview 2.6 Scanning-Logic Circuitry The ’C2xx has JT AG scanning-logic circuitry that is compatible with IEEE Standard 1 149.1. This circuitry is used for emulation and testing purposes only . The serial scan path is used to test pin-to-pin continuity as well as to per- form operational tests on the o[...]

  • Page 46

    3-1 Central Processing Unit This chapter describes the main components of the central processing unit (CPU). First, this chapter describes three fundamental sections of the CPU (see Figure 3–1): Input scaling section Multiplication section Central arithmetic logic section The chapter then describes the auxiliary register arithmetic unit (ARAU), w[...]

  • Page 47

    3-2 Figure 3–1. Block Diagram of the Input Scaling, Central Arithmetic Logic, and Multiplication Sections of the CPU 32 Input shifter (32 bits) 16 32 Output shifter (32 bits) 32 C Accumulator CALU 32 32 MUX 32 16 MUX MUX 16 16 PREG Multiplier 16 × 16 16 Data write bus (DWEB) Data read bus (DRDB) TREG 16 16 Program read bus (PRDB) 16 16 1 1 Produ[...]

  • Page 48

    Input Scaling Section 3-3 Central Processing Unit 3.1 Input Scaling Section A 32-bit input data-scaling shifter (input shifter) aligns a 16-bit value coming from memory to the 32-bit CALU. This data alignment is necessary for data- scaling arithmetic as well as aligning masks for logical operations. The input shifter operates as part of the data pa[...]

  • Page 49

    Input Scaling Section 3-4 Shift count . The shifter can left-shift a 16-bit value by 0 to 16 bits. The size of the shift (or the shift count) is obtained from one of two sources: A constant embedded in the instruction word. Putting the shift count in the instruction word allows you to use specific data-scaling or alignment op- erations customized f[...]

  • Page 50

    Multiplication Section 3-5 Central Processing Unit 3.2 Multiplication Section The ’C2xx uses a 16-bit × 16-bit hardware multiplier that can produce a signed or unsigned 32-bit product in a single machine cycle. As shown in Figure 3–5, the multiplication section consists of: The 16-bit temporary register (TREG), which holds one of the multipli-[...]

  • Page 51

    Multiplication Section 3-6 Inputs . The multiplier accepts two 16-bit inputs: One input is always from the 16-bit temporary register (TREG). The TREG is loaded before the multiplication with a data-value from the data read bus (DRDB). The other input is one of the following: A data-memory value from the data read bus (DRDB). A program memory value [...]

  • Page 52

    Multiplication Section 3-7 Central Processing Unit T able 3–1. Product Shift Modes for the Product-Scaling Shifter PM Shift Comments 00 no shift Product sent to CALU or data write bus (DWEB) with no shift 01 left 1 Removes the extra sign bit generated in a 2s-complement multiply to produce a Q31 product † 10 left 4 Removes the extra four sign b[...]

  • Page 53

    Central Arithmetic Logic Section 3-8 3.3 Central Arithmetic Logic Section Figure 3–6 shows the main components of the central arithmetic logic section, which are: The central arithmetic logic unit (CALU), which implements a wide range of arithmetic and logic functions. The 32-bit accumulator (ACC), which receives the output of the CALU and is cap[...]

  • Page 54

    Central Arithmetic Logic Section 3-9 Central Processing Unit 3.3.1 Central Arithmetic Logic Unit (CALU) The central arithmetic logic unit (CALU), implements a wide range of arithme- tic and logic functions, most of which execute in a single clock cycle. These functions can be grouped into four categories: 16-bit addition 16-bit subtraction Boolean [...]

  • Page 55

    Central Arithmetic Logic Section 3-10 Status bits . Four status bits are associated with the accumulator: Carry bit (C). C (bit 9 of status register ST1) is affected during: Additions to and subtractions from the accumulator: C = 0 When the result of a subtraction generates a borrow . When the result of an addition does not generate a carry . (Ex- [...]

  • Page 56

    Central Arithmetic Logic Section 3-1 1 Central Processing Unit 3.3.3 Output Data-Scaling Shifter The output data-scaling shifter (output shifter) has a 32-bit input connected to the 32-bit output of the accumulator and a 16-bit output connected to the data bus. The shifter copies all 32-bits of the accumulator and then performs a left shift on its [...]

  • Page 57

    Auxiliary Register Arithmetic Unit (ARAU) 3-12 3.4 Auxiliary Register Arithmetic Unit (ARAU) The CPU also contains the auxiliary register arithmetic unit (ARAU), an arith- metic unit independent of the central arithmetic logic unit (CALU). The main function of the ARAU is to perform arithmetic operations on eight auxiliary reg- isters (AR7 through [...]

  • Page 58

    Auxiliary Register Arithmetic Unit (ARAU) 3-13 Central Processing Unit The eight auxiliary registers (AR7–AR0) provide flexible and powerful indirect addressing. Any location in the 64K data memory space can be accessed us- ing a 16-bit address contained in an auxiliary register . For the details of indirect addressing, see Section 6.3 on page 6-[...]

  • Page 59

    Auxiliary Register Arithmetic Unit (ARAU) 3-14 execute phase of the pipeline. For information on the operation of the pipeline, see Section 5.2 on page 5-7. In addition to using the auxiliary registers to reference data-memory address- es, you can use them for other purposes. For example, you can: Use the auxiliary registers to support conditional [...]

  • Page 60

    Status Registers ST0 and ST1 3-15 Central Processing Unit 3.5 Status Registers ST0 and ST1 The ’C2xx has two status registers, ST0 and ST1, which contain status and control bits. These registers can be stored into and loaded from data memory , thus allowing the status of the machine to be saved and restored for subrou- tines. The LST (load status[...]

  • Page 61

    Status Registers ST0 and ST1 3-16 T able 3–2. Bit Fields of Status Registers ST0 and ST1 Name Description ARB Auxiliary register pointer buffer . Whenever the auxiliary register pointer (ARP) is loaded, the pre- vious ARP value is copied to the ARB, except during an LST (load status register) instruction. When the ARB is loaded by an LST instruct[...]

  • Page 62

    Status Registers ST0 and ST1 3-17 Central Processing Unit T able 3–2. Bit Fields of Status Registers ST0 and ST1 (Continued) Name Description OVM Overflow mode bit. OVM determines how overflows in the CALU are handled. The SETC and CLRC instructions set and clear this bit, respectively . An LST instruction can also be used to modify OVM. OVM = 0 [...]

  • Page 63

    4-1 Memory and I/O Spaces Memory and I/O Spaces This chapter describes the ’C2xx memory configuration options and the ad- dress maps of the individual ’C2xx devices. It also illustrates typical ways of interfacing the ’C2xx with external memory and external input/output (I/O) devices. Each ’C2xx device has a 16-bit address line that accesse[...]

  • Page 64

    Overview of the Memory and I/O Spaces 4-2 4.1 Overview of the Memory and I/O Spaces The ’C2xx address map is organized into four individually selectable spaces: Program memory (64K words) contains the instructions to be executed, as well as data used during program execution. Local data memory (64K words) holds data used by the instructions. Glob[...]

  • Page 65

    Overview of the Memory and I/O Spaces 4-3 Memory and I/O Spaces 4.1.1 Pins for Interfacing to External Memory and I/O Spaces The pins for interfacing to external memory and I/O space, described in T able 4–1, are of four main types: External buses. Sixteen signals (A15–A0) are available for passing an address from the ’C2xx to another device.[...]

  • Page 66

    Overview of the Memory and I/O Spaces 4-4 T able 4–1. Pins for Interfacing With External Memory and I/O Spaces (Continued) Description Pin(s) Read/write signals R/W Read/write pin. This pin indicates the direction of transfer between the ’C2xx and external program, data, or I/O space. RD Read select pin. The ’C2xx asserts RD to request a read[...]

  • Page 67

    Program Memory 4-5 Memory and I/O Spaces 4.2 Program Memory Program-memory space holds the code for applications; it can also hold table information and constant operands. The program-memory space addresses up to 64K 16-bit words. Every ’C2xx device contains a DARAM block B0 that can be configured as program memory or data memory . Other on-chip [...]

  • Page 68

    Program Memory 4-6 Figure 4–1. Interface With External Program Memory A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A1 1 A12 D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D1 1 D12 D13 D14 D15 PS RD WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A1 1 A12 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A1 1 A12 D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 WE RD CE WE RD CE 8K 8 RAM 8K 8 RAM ?[...]

  • Page 69

    Local Data Memory 4-7 Memory and I/O Spaces 4.3 Local Data Memory The local data-memory space addresses up to 64K 16-bit words. Every ’C2xx device has three on-chip DARAM blocks: B0, B1, and B2. Block B0 has 256 words that are configurable as either data locations or program locations. Blocks B1 (256 words) and B2 (32 words) have a total of 288 w[...]

  • Page 70

    Local Data Memory 4-8 4.3.1 Data Page 0 Address Map T able 4–2 shows the address map of data page 0 (addresses 0000h–007Fh). Note the following: Three memory-mapped registers can be accessed with zero wait states: Interrupt mask register (IMR) Global memory allocation register (GREG) Interrupt flag register (IFR) The test/emulation reserved are[...]

  • Page 71

    Local Data Memory 4-9 Memory and I/O Spaces 4.3.2 Interfacing With External Local Data Memory While the ’C2xx is accessing the on-chip local data-memory blocks, the exter- nal memory signals DS and STRB are in high impedance. The external buses are active only when the ’C2xx is accessing locations within the address ranges mapped to external me[...]

  • Page 72

    Local Data Memory 4-10 Figure 4–3. Interface With External Local Data Memory A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A1 1 A12 D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D1 1 D12 D13 D14 D15 DS RD WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A1 1 A12 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A1 1 A12 D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 WE RD CE WE RD CE 8K 8 RAM 8K [...]

  • Page 73

    Global Data Memory 4-1 1 Memory and I/O Spaces 4.4 Global Data Memory Addresses in the upper 32K words (8000h–FFFFh) of local data memory can be used for global data memory . The global memory allocation register (GREG) determines the size of the global data-memory space, which is be- tween 256 and 32K words. The GREG is connected to the eight LS[...]

  • Page 74

    Global Data Memory 4-12 As an example of configuring global memory , suppose you want to designate 8K addresses as global addresses. Y ou would write the 8-bit value 1 1 100000 2 to the eight LSBs of the GREG (see Figure 4–4). This would designate ad- dresses E000h–FFFFh of data memory as global data addresses (see Figure 4–5). Figure 4–4. [...]

  • Page 75

    Global Data Memory 4-13 Memory and I/O Spaces toggled between local memory and global memory . For example, in the system of Figure 4–6, when GREG = XXXXXXXX00000000 2 (no global memory), the local data RAM is fully accessible; when GREG = XXXXXXXX10000000 2 (all global memory), the local data RAM is not accessible. Figure 4–6. Using 8000h–FF[...]

  • Page 76

    Boot Loader 4-14 4.5 Boot Loader This section applies to ’C2xx devices that have an on-chip boot loader . The boot loader is used for booting software from an 8-bit external ROM to a 16-bit external RAM at reset (see Figure 4–7). The source for your program is an ex- ternal ROM located in external global data memory . The destination for the bo[...]

  • Page 77

    Boot Loader 4-15 Memory and I/O Spaces 4.5.2 Connecting the EPROM to the Processor T o map the EPROM into the global data space at address 8000h, make the following connections between the processor and the EPROM (refer to Figure 4–8): Connect the address lines of the processor and the EPROM (see lines A14–A0 in the figure). Connect the data li[...]

  • Page 78

    Boot Loader 4-16 4.5.3 Programming the EPROM T exas Instruments fixed-point development tools provide the utilities to gener- ate the boot ROM code. (For an introduction to the procedure for generating boot loader code, see Appendix C, Program Examples .) However , should you need to do the programming, use the following procedure. Store the follow[...]

  • Page 79

    Boot Loader 4-17 Memory and I/O Spaces Figure 4–9 shows how to store a 16-bit program into the 8-bit EPROM. A sub- script h (for example, on Word1 h ) indicates the high-byte and a subscript l (for example, on Word1 l ) indicates the low byte. Figure 4–9. Storing the Program in the EPROM 16-Bit Program 8-Bit EPROM 15 8 7 0 Address 7 0 Word1 h W[...]

  • Page 80

    Boot Loader 4-18 4.5.5 Boot Loader Execution Once the EPROM has been programmed and installed, and the boot loader has been enabled, the processor automatically boots the program from EPROM at startup. If you need to reboot the processor during operation, bring the RS pin low to cause a hardware reset. When the processor executes the boot loader , [...]

  • Page 81

    Boot Loader 4-19 Memory and I/O Spaces Figure 4–10. Program Code T ransferred From 8-Bit EPROM to 16-Bit RAM 8-Bit EPROM 16-Bit RAM Address 7 0 Address 15 8 7 0 8000h Destination h = 00h 0000h Word1 h W ord1 l 8001h Destination l = 00h • Word2 h W ord2 l 8002h Length N h •• . • 8003h Length N l •• • 8004h Word1 h nnnEh • • 8005h[...]

  • Page 82

    Boot Loader 4-20 Figure 4–1 1. Interrupt V ectors T ransferred First During Boot Load 8000h 8-bit EPROM in global data memory 16-bit RAM in program memory 0000h 003Fh 8001h Destination h (00) Destination l (00) Length N h Length N l 8002h 8003h Interrupt vectors Program code Interrupt vectors Program code nnnFh nnnFh 8004h 8083h 8084h 0040h[...]

  • Page 83

    Boot Loader 4-21 Memory and I/O Spaces 4.5.6 Boot Loader Program ********************************************************************************* * TMS320C2xx Boot Loader Program * * * * This code sets up and executes boot loader code that loads program * * code from location 8000h in external global data space and transfers it * * to the destinat[...]

  • Page 84

    Boot Loader 4-22 * * Transfer code * LOOP LACC *+,8 ; Load ACC with high byte of code shifted by 8 bits SACL HBYTE ; Store high byte LACL *+,AR0 ; Load ACC with low byte of code AND #0FFH ; Mask off upper 24 bits OR HBYTE ; OR ACC with high byte to form 16-bit code word SACL CODEWORD ; Store code word LACL DEST ; Load destination address TBLW CODEW[...]

  • Page 85

    I/O Space 4-23 Memory and I/O Spaces 4.6 I/O Space The ’C2xx supports an I/O address range of 64K 16-bit words. Figure 4–12 shows the ’C2xx I/O address map. Figure 4–12. I/O Address Map for the ’C2xx FFFFh ’C2xx I/O 0000h FF00h External FEFFh reserved addresses registers and I/O-mapped FF10h FF0Fh Reserved for test/emulation On-chip spa[...]

  • Page 86

    I/O Space 4-24 The map has three main sections of addresses: Addresses 0000h–FEFFh allow access to off-chip peripherals typically used in DSP applications, such as digital-to-analog and analog-to-digital converters. Addresses FF00h–FF0Fh are mapped to on-chip I/O space. These ad- dresses are reserved for test purposes and should not be used. Ad[...]

  • Page 87

    I/O Space 4-25 Memory and I/O Spaces 4.6.1 Accessing I/O Space All I/O words (external I/O ports and on-chip I/O registers) are accessed with the IN and OUT instructions. Accesses to external parallel I/O ports are multi- plexed over the same address and data buses for program and data-memory accesses. These accesses are distinguished from external[...]

  • Page 88

    I/O Space 4-26 Figure 4–13. I/O Port Interface Circuitry A0 A1 A2 A3 D0 D1 D2 D3 D4 D5 D6 D7 IS WE 1 2 3 6 4 5 18 16 14 12 9 7 5 3 3 4 7 8 13 14 17 18 11 1 5 V A B C G1 G2A G2B Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 1A1 1A2 1A3 1A4 2A1 2A2 2A3 2A4 1G 2G Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 1Y1 1Y2 1Y3 1Y4 2Y1 2Y2 2Y3 2Y4 15 14 13 12 11 10 9 7 2 4 6 8 11 13 15 17 1 19 Port 0[...]

  • Page 89

    Direct Memory Access Using the HOLD Operation 4-27 Memory and I/O Spaces 4.7 Direct Memory Access Using the HOLD Operation The ’C2xx HOLD operation allows direct-memory access to external program, data, and I/O spaces. The process is controlled by two signals: HOLD. An external device can drive the HOLD/INT1 pin low to request control over the ex[...]

  • Page 90

    Direct Memory Access Using the HOLD Operation 4-28 Example 4–1. An Interrupt Service Routine Supporting INT1 and HOLD .mmregs ;Include c2xx memory–mapped registers. ICR .set 0FFECh ;Define interrupt control register in I/O space. ICRSHDW .set 060h ;Define ICRSHDW in scratch pad location. * Interrupt vectors * reset B main ;0 – reset , Branch [...]

  • Page 91

    Direct Memory Access Using the HOLD Operation 4-29 Memory and I/O Spaces Here are three valid methods for exiting the IDLE state, thus deasserting HOLDA and restoring the buses to normal operation: Cause a rising edge on the HOLD/INT1 pin when MODE = 0. Assert system reset at the reset pin. Assert the nonmaskable interrupt NMI at the NMI pin. If re[...]

  • Page 92

    Direct Memory Access Using the HOLD Operation 4-30 Figure 4–15. Reset Deasserted Before HOLD Deasserted RS HOLD HOLDA Direct Memory Access Using the HOLD Operation[...]

  • Page 93

    Device-Specific Information 4-31 Memory and I/O Spaces 4.8 Device-Specific Information For ’C2xx devices other than the ’C209, this section mentions the presence or absence of the boot loader and HOLD features, shows address maps, and explains the contents and configuration of the program-memory and data- memory maps. For details about the memo[...]

  • Page 94

    Device-Specific Information 4-32 Figure 4–16. ’C203 Address Map FFFFh ’C203 Program ’C203 Data FFFFh 0800h 0400h 03FFh 0300h 02FFh 0200h 01FFh 0080h 007Fh 0060h 005Fh 0000h External DARAM B1 § On-chip Reserved (CNF = 1) B0 ‡ (CNF = 0); On-chip DARAM Reserved DARAM B2 On-chip reserved addresses registers and Memory-mapped 0000h FDFFh FE00[...]

  • Page 95

    Device-Specific Information 4-33 Memory and I/O Spaces DARAM blocks B1 and B2 are fixed, but DARAM block B0 may be mapped to program space or data space, depending on the value of the CNF bit (bit 12 of status register ST1): CNF = 0. B0 is mapped to data space and is accessible at data addresses 0200h–02FFh. Note that the addressable external pro[...]

  • Page 96

    Device-Specific Information 4-34 T able 4–6. ’C203 Data-Memory Configuration Options CNF DARAM B0 (hex) DARAM B1 (hex) DARAM B2 (hex) External (hex) Reserved (hex) 0 0200–02FF 0300–03FF 0060–007F 0800–FFFF 0000–005F 0080–01FF 0400–07FF 1 – 0300–03FF 0060–007F 0800–FFFF 0000–005F 0080–02FF 0400–07FF 4.8.2 TMS320C204 A[...]

  • Page 97

    Device-Specific Information 4-35 Memory and I/O Spaces Figure 4–17. ’C204 Address Map FFFFh ’C204 Program ’C204 Data FFFFh 0800h 0400h 03FFh 0300h 02FFh 0200h 01FFh 0080h 007Fh 0060h 005Fh 0000h External DARAM B1 § On-chip Reserved (CNF = 1) B0 ‡ (CNF = 0); On-chip DARAM Reserved DARAM B2 On-chip reserved addresses registers and Memory-m[...]

  • Page 98

    Device-Specific Information 4-36 Y ou select or deselect the ROM by changing the level on the MP/MC pin at re- set: MP/MC = 0 at reset. The device is configured as a microcomputer . The on-chip ROM is enabled and is accessible at addresses 0000h–0FFFh. The device fetches the reset vector from on-chip ROM. MP/MC = 1 at reset. The device is configu[...]

  • Page 99

    Device-Specific Information 4-37 Memory and I/O Spaces T able 4–7. ’C204 Program-Memory Configuration Options MP/MC CNF ROM (hex) DARAM B0 (hex) External (hex) Reserved (hex) 0 0 0000–0FFF – 1000–FFFF – 0 1 0000–0FFF FF00–FFFF 1000–FDFF FE00–FEFF 1 0 – – 0000–FFFF – 1 1 – FF00–FFFF 0000–FDFF FE00–FEFF T able 4–[...]

  • Page 100

    5-1 Program Control This chapter discusses the processes and features involved in controlling the flow of a program on the ’C2xx. Program control involves controlling the order in which one or more blocks of instructions are executed. Normally , the flow of a program is sequential: the ’C2xx executes instructions at consecutive program-memory a[...]

  • Page 101

    Program-Address Generation 5-2 5.1 Program-Address Generation Program flow requires the processor to generate the next program address (sequential or nonsequential) while executing the current instruction. Pro- gram-address generation is illustrated in Figure 5–1 and summarized in T able 5–1. Figure 5–1. Program-Address Generation Block Diagr[...]

  • Page 102

    Program-Address Generation 5-3 Program Control T able 5–1. Program-Address Generation Summary Operation Program-Address Source Sequential operation PC (contains program address +1) Dummy cycle P AR (contains program address) Return from subroutine T op of the stack (TOS) Return from table move or block move Micro stack (MST ACK) Branch or call to[...]

  • Page 103

    Program-Address Generation 5-4 The ’C2xx can load the PC in a number of ways, to accommodate sequential and nonsequential program flow . T able 5–2 shows what is loaded to the PC according to the code operation performed. T able 5–2. Address Loading to the Program Counter Code Operation Address Loaded to the PC Sequential execution The PC is [...]

  • Page 104

    Program-Address Generation 5-5 Program Control PSHD and POPD. These instructions allow you to build a stack in data memory for the nesting of subroutines or interrupts beyond eight levels. The PSHD instruction pushes a data-memory value onto the top of the stack. The POPD instruction pops a value from the top of the stack to data memory . Whenever [...]

  • Page 105

    Program-Address Generation 5-6 Figure 5–3. A Pop Operation Before Instruction After Instruction Accumulator Accumulator or memory 82h or memory 45h location location 45h 16h 16h 7h Stack 7h Stack 33h 33h 42h 42h 56h 56h 37h 37h 61h 61h 61h 5.1.3 Micro Stack (MST ACK) The program-address generation logic uses the 16-bit-wide, 1-level-deep MST ACK [...]

  • Page 106

    Pipeline Operation 5-7 Program Control 5.2 Pipeline Operation Instruction pipelining consists of a sequence of bus operations that occur dur- ing the execution of an instruction. The ’C2xx pipeline has four independent stages: instruction-fetch, instruction-decode, operand-fetch, and instruction- execute. Because the four stages are independent, [...]

  • Page 107

    Branches, Calls, and Returns 5-8 5.3 Branches, Calls, and Returns Branches, calls, and returns break the sequential flow of instructions by trans- ferring control to another location in program memory . A branch only transfers control to the new location. A call also saves the return address (the address of the instruction following the call) to th[...]

  • Page 108

    Branches, Calls, and Returns 5-9 Program Control By the time the unconditional call instruction reaches the execute phase of the pipeline, the next two instruction words have already been fetched. These two instruction words are flushed from the pipeline so that they are not executed, the return address is stored to the stack, and then execution co[...]

  • Page 109

    Conditional Branches, Calls, and Returns 5-10 5.4 Conditional Branches, Calls, and Returns The ’C2xx provides branch, call, and return instructions that will execute only if one or more conditions are met. Y ou specify the conditions as operands of the conditional instruction. T able 5–3 lists the conditions that you can use with these instruct[...]

  • Page 110

    Conditional Branches, Calls, and Returns 5-1 1 Program Control Group 2. Y ou can select up to three conditions. Each of these conditions must be from a different category (A, B, or C); you cannot have two condi- tions from the same category . For example, you can test TC, C, and BIO at the same time, but you cannot test C and NC at the same time. T[...]

  • Page 111

    Conditional Branches, Calls, and Returns 5-12 The conditional branch instructions are BCND (branch conditionally) and BANZ (branch if currently selected auxiliary register is not equal to 0). The BANZ instruction is useful for implementing loops. 5.4.4 Conditional Calls The conditional call (CC) instruction is executed only when the specified condi[...]

  • Page 112

    Conditional Branches, Calls, and Returns 5-13 Program Control RETC, like RET , is a single-word instruction. However , because of the poten- tial PC discontinuity , it operates with the same ef fective execution time as the conditional branch (BCND) and the conditional call (CC). By the time the condi- tions of the conditional return instruction ha[...]

  • Page 113

    Repeating a Single Instruction 5-14 5.5 Repeating a Single Instruction The ’C2xx repeat (RPT) instruction allows the execution of a single instruction N + 1 times, where N is specified as an operand of the RPT instruction. When RPT is executed, the repeat counter (RPTC) is loaded with N. RPTC is then decremented every time the repeated instructio[...]

  • Page 114

    Interrupts 5-15 5.6 Interrupts Interrupts are hardware- or software-driven signals that cause the ’C2xx to suspend its current program sequence and execute a subroutine. T ypically , in- terrupts are generated by hardware devices that need to give data to or take data from the ’C2xx (for example, A/D and D/A converters and other proces- sors). [...]

  • Page 115

    Interrupts 5-16 3) Execute the interrupt service routine. Once the interrupt is acknowl- edged, the ’C2xx branches to its corresponding subroutine called an inter- rupt service routine (ISR). The ’C2xx follows the branch instruction you place at a predetermined address (the vector location) and executes the ISR you have written. 5.6.2 Interrupt[...]

  • Page 116

    Interrupts 5-17 Program Control T able 5–5. ’C2xx Interrupt Locations and Priorities (Continued) K † V ector Location Name Priority Function 10 14h INT10 – User-defined software interrupt 11 16h INT1 1 – User-defined software interrupt 12 18h INT12 – User-defined software interrupt 13 1Ah INT13 – User-defined software interrupt 14 1Ch[...]

  • Page 117

    Interrupts 5-18 5.6.3 Maskable Interrupts When a maskable interrupt is successfully requested by a hardware device or by an external pin, the corresponding flag or flags are activated. These flags are activated whether or not the interrupt is later acknowledged by the proces- sor . T wo registers on the ’C2xx contain flag bits: Interrupt flag reg[...]

  • Page 118

    Interrupts 5-19 Program Control After an interrupt request is received by the CPU, the CPU must decide wheth- er to acknowledge the request. Maskable hardware interrupts are acknowl- edged only after certain conditions are met: Priority is highest. When more than one hardware interrupt is requested at the same time, the ’C2xx services them accord[...]

  • Page 119

    Interrupts 5-20 Figure 5–6 summarizes how maskable interrupts are handled by the CPU. Figure 5–6. Maskable Interrupt Operation Flow Chart Interrupt request sent to CPU Corresponding IFR flag bit set Interrupts enabled (INTM bit = 0) ? Interrupt unmasked? Interrupt acknowledged Ye s Ye s No No INTM bit set to 1 PC saved on stack Interrupt servic[...]

  • Page 120

    Interrupts 5-21 Program Control 1 to the corresponding IFR bit. All pending interrupts can be cleared by writing the current contents of the IFR back into the IFR. Acknowledgement of a hardware request also clears the corresponding IFR bit. A device reset clears all IFR bits. Notes: 1) When an interrupt is requested by an INTR instruction, if the c[...]

  • Page 121

    Interrupts 5-22 Bit 3 RINT — Receive interrupt flag. Bit 3 is tied to the receive interrupt for the synchro- nous serial port. T o avoid double interrupts, write a 1 to this bit in the interrupt service routine. RINT = 0 Interrupt RINT is not pending. RINT = 1 Interrupt RINT is pending. Bit 2 TINT — Timer interrupt flag. Bit 2 is tied to the ti[...]

  • Page 122

    Interrupts 5-23 Program Control For ’C2xx devices other than the ’C209, Figure 5–8 shows the IMR. Descrip- tions of the bits follow the figure. For a description of the ’C209 IMR, see sub- section 1 1.3.1, ’C209 Interrupt Registers , on page 1 1-1 1. Figure 5–8. ’C2xx Interrupt Mask Register (IMR) — Data-Memory Address 0004h 15 6 5 [...]

  • Page 123

    Interrupts 5-24 Bit 0 HOLD/INT1 — HOLD/Interrupt 1 mask. This bit masks or unmasks interrupts re- quested at the HOLD /INT1 pin. HOLD/INT1 = 0 HOLD /INT1 is masked. HOLD/INT1 = 1 HOLD /INT1 is unmasked. 5.6.6 Interrupt Control Register (ICR) The 16-bit interrupt control register (ICR), located at address FFECh in I/O space, controls the function [...]

  • Page 124

    Interrupts 5-25 Program Control to mask INT3 (prevent the setting of flags FINT3 and INT2/INT3) write a 0 to MINT3. If INT2/INT3 is not set, the CPU has not received and will not acknowl- edge the interrupt request. When INT2/INT3 is set, one or both of the interrupts is pending. T o differentiate the occurrences of the two interrupts, your interru[...]

  • Page 125

    Interrupts 5-26 Figure 5–9 shows the ICR, and bit descriptions follow the figure. Figure 5–9. ’C2xx Interrupt Control Register (ICR) — I/O-Space Address FFECh 15 5 4 3 2 1 0 Reserved MODE FINT3 FINT2 MINT3 MINT2 0 R/W–0 R/W1C–0 R/W1C–0 R/W–0 R/W–0 Note: 0 = Always read as zeros; R = Read access; W = Write access; W1C = W rite 1 to[...]

  • Page 126

    Interrupts 5-27 Program Control Bit 0 MINT2 — Interrupt 2 mask. This bit masks the external interrupt INT2 or , in conjunc- tion with the INT2/INT3 bit of the IMR, unmasks INT2 . MINT2 = 0 INT2 is masked. Neither FINT2 nor bit 1 of the IFR (INT2/INT3) is set by a request on the INT2 pin. MINT2 = 1 INT3 is unmasked. Flag bits FINT2 and INT2/INT3 a[...]

  • Page 127

    Interrupts 5-28 Note: The INTR instruction does not affect IFR flags. When you use the INTR instruction to initiate an interrupt that has an associated flag bit in the IFR, the instruction neither sets nor clears the flag bit. No software write operation can set the IFR flag bits; only the appropriate hardware requests can. If a hardware request ha[...]

  • Page 128

    Interrupts 5-29 Program Control Figure 5–10. Nonmaskable Interrupt Operation Flow Chart Interrupt request sent to CPU Interrupt acknowledged TRAP instruction? Ye s No INTM bit set to 1 PC saved on stack Interrupt service routine run Return instruction restores PC Program continues 5.6.8 Interrupt Service Routines (ISRs) After an interrupt has bee[...]

  • Page 129

    Interrupts 5-30 Managing ISRs within ISRs The ’C2xx hardware stack allows you to have ISRs within ISRs. When consid- ering nesting ISRs like this, keep the following in mind: If you want the ISR be interrupted by a maskable interrupt, the ISR must unmask the interrupt by setting the appropriate IMR bit (and ICR bit, if ap- plicable) and executing[...]

  • Page 130

    Interrupts 5-31 Program Control For an external, maskable hardware interrupt, a minimum latency of eight cycles is required to synchronize the interrupt externally , recognize the inter- rupt, and branch to the interrupt vector location. On the ninth cycle, the inter- rupt vector is fetched. For a software interrupt, the minimum latency consists of[...]

  • Page 131

    Interrupts 5-32 before the return, the new return address would be added to the hardware stack, even if the stack were already full. T o allow the CPU to complete the return, interrupts are also blocked after a RET instruction until at least one instruction at the return address is executed.[...]

  • Page 132

    Reset Operation 5-33 Program Control 5.7 Reset Operation Reset (RS ) is a nonmaskable external interrupt that can be used at any time to put the ’C2xx into a known state. Reset is the highest priority interrupt; no other interrupt takes precedence over reset. Reset is typically applied after power up when the machine is in an unknown state. Becau[...]

  • Page 133

    Reset Operation 5-34 Peripherals: The timer count is set to its maximum value (FFFFh), the timer divide- down value is set to 0, and the timer starts counting down. The synchronous serial port is reset: The port emulation mode is set to immediate stop. Error and status flags are reset. Receive interrupts are set to occur when the receive buffer is [...]

  • Page 134

    Reset Operation 5-35 Program Control T able 5–6. Reset V alues of On-Chip Registers Mapped to Data Space Name Data-Memory Address Reset V alue Description IMR 0004h 0000h Interrupt mask register GREG 0005h 0000h Interrupt control register IFR 0006h 0000h Synchronous data transmit and receive register T able 5–7. Reset V alues of On-Chip Registe[...]

  • Page 135

    Power-Down Mode 5-36 5.8 Power-Down Mode The ’C2xx has a power-down mode that allows the ’C2xx core to enter a dor- mant state and use less power than during normal operation. Executing an IDLE instruction initiates power-down mode. When the IDLE instruction executes, the program counter is incremented once, and then all CPU activi- ties are ha[...]

  • Page 136

    Power-Down Mode 5-37 Program Control 5.8.2 T ermination of Power-Down During a HOLD Operation One of the necessary steps in the HOLD operation is the execution of an IDLE instruction (see Section 4.7, Direct Memory Access Using The HOLD Opera- tion , on page 4-27) . There are unique characteristics of the HOLD operation that affect how the IDLE sta[...]

  • Page 137

    6-1 Addressing Modes Addressing Modes This chapter explains the three basic memory addressing modes used by the ’C2xx instruction set. The three modes are: Immediate addressing mode Direct addressing mode Indirect addressing mode In immediate addressing, a constant to be manipulated by the instruction is supplied directly as an operand of that in[...]

  • Page 138

    Immediate Addressing Mode 6-2 6.1 Immediate Addressing Mode In immediate addressing, the instruction word contains a constant to be ma- nipulated by the instruction. The ’C2xx supports two types of immediate ad- dressing: Short-immediate addressing. Instructions that use short-immediate ad- dressing take an 8-bit, 9-bit, or 13-bit constant as an [...]

  • Page 139

    Immediate Addressing Mode 6-3 Addressing Modes Figure 6–2. T wo Words Loaded Consecutively to the Instruction Register in Example 6–2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 0 0 1 1 1 1 1 1 1 0 1 shift = 2 16-bit constant = 16 384 = 4000h First instruction word: Second instruction word: 0 1 0 0 ADD opcode for long-immediate addressing 0 0 0 0 0[...]

  • Page 140

    Direct Addressing Mode 6-4 6.2 Direct Addressing Mode In the direct addressing mode, data memory is addressed in blocks of 128 words called data pages. The entire 64K of data memory consists of 512 data pages labeled 0 through 51 1, as shown in Figure 6–3. The current data page is determined by the value in the 9-bit data page pointer (DP) in sta[...]

  • Page 141

    Direct Addressing Mode 6-5 Addressing Modes Figure 6–4. Instruction Register (IR) Contents in Direct Addressing Mode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 7 LSBs 0 8 MSBs 8 MSBs Bits 15 through 8 indicate the instruction type (for example, ADD) and also contain any information regarding a shift of the data value to be accessed by the instruction.[...]

  • Page 142

    Direct Addressing Mode 6-6 6.2.1 Using Direct Addressing Mode When you use direct addressing mode, the processor uses the DP to find the data page and uses the seven LSBs of the instruction register to find a particu- lar address on that page. Always do the following: 1) Set the data page. Load the appropriate value (from 0 to 51 1) into the DP . T[...]

  • Page 143

    Direct Addressing Mode 6-7 Addressing Modes Example 6–3. Using Direct Addressing with ADD (Shift of 0 to 15) LDP #4 ;Set data page to 4 (addresses 0200h–027Fh). ADD 9h,5 ;The contents of data address 0209h are ;left–shifted 5 bits and added to the ;contents of the accumulator. 7 LSBs from IR 16-bit data address 0209h All 9 bits from DP DP = 4[...]

  • Page 144

    Direct Addressing Mode 6-8 In Example 6–5, the ADDC instruction references a data memory address that is generated as shown following the program code. Note that if an instruction does not perform shifts, like the ADDC instruction does not, all eight MSBs of the instruction contain the opcode for the instruction type. Example 6–5. Using Direct [...]

  • Page 145

    Indirect Addressing Mode 6-9 Addressing Modes 6.3 Indirect Addressing Mode Eight auxiliary registers (AR0–AR7) provide flexible and powerful indirect ad- dressing. Any location in the 64K data memory space can be accessed using a 16-bit address contained in an auxiliary register . 6.3.1 Current Auxiliary Register T o select a specific auxiliary r[...]

  • Page 146

    Indirect Addressing Mode 6-10 ister as the data memory address and then increments or decrements the content of the current auxiliary register by the index amount. Increment or decrement by an index amount using reverse carry . The value in AR0 is the index amount. After the instruction uses the content of the current auxiliary register as the data[...]

  • Page 147

    Indirect Addressing Mode 6-1 1 Addressing Modes T able 6–1. Indirect Addressing Operands (Continued) Option Operand Example Increment by index amount, adding with reverse carry *BR0+ L T *BR0+ loads the temporary register (TREG) with the content of the data memory address referenced by the current AR and then adds the content of AR0 to the conten[...]

  • Page 148

    Indirect Addressing Mode 6-12 Example 6–6. Selecting a New Current Auxiliary Register MAR *,AR1 ;Load the ARP with 1 to make AR1 the ;current auxiliary register. LT *+,AR2 ;AR2 is the next auxiliary register. ;Load the TREG with the content of the ;address referenced by AR1, add one to ;the content of AR1, then make AR2 the ;current auxiliary reg[...]

  • Page 149

    Indirect Addressing Mode 6-13 Addressing Modes T able 6–2. Effects of the ARU Code on the Current Auxiliary Register ARU Code 6 5 4 Arithmetic Operation Performed on Current AR 0 0 0 No operation on current AR 0 0 1 current AR – 1 → current AR 0 1 0 current AR + 1 → current AR 0 1 1 Reserved 1 0 0 current AR – AR0 → current AR [reverse [...]

  • Page 150

    Indirect Addressing Mode 6-14 T able 6–3. Field Bits and Notation for Indirect Addressing Instruction Opcode Bits 15 – 8 7 6 5 4 3 2 1 0 Operand(s) Operation ← 8 MSBs → 10000 ← NAR → * No manipulation of current AR ← 8 MSBs → 10 001 ← NAR → *,AR n NAR → ARP ← 8 MSBs → 10 010 ← NAR → *– current AR – 1 → current AR[...]

  • Page 151

    Indirect Addressing Mode 6-15 Addressing Modes 6.3.5 Examples of Indirect Addressing In Example 6–7, when the ADD instruction is fetched from program memory , the instruction register is loaded with the value shown. Example 6–7. No Increment or Decrement ADD *,8 ;Add to the accumulator the content of the ;data-memory address referenced by the ;[...]

  • Page 152

    Indirect Addressing Mode 6-16 Example 6–9. Decrement by 1 ADD *–,8 ;Operates as in Example 6–7, but in ;addition, the current auxiliary register ;is decremented by one. Example 6–10. Increment by Index Amount ADD *0+,8 ;Operates as in Example 6–7, but in ;addition, the content of register AR0 ;is added to the current auxiliary ;register. [...]

  • Page 153

    Indirect Addressing Mode 6-17 Addressing Modes 6.3.6 Modifying Auxiliary Register Content The LAR, ADRK, SBRK, and MAR instructions are specialized instructions for changing the content of an auxiliary register (AR): The LAR instruction loads an AR. The ADRK instruction adds an immediate value to an AR; SBRK subtracts an immediate value. The MAR in[...]

  • Page 154

    7-1 Assembly Language Instructions Assembly Language Instructions The ’C2xx instruction set supports numerically intensive signal-processing op- erations as well as general-purpose applications such as multiprocessing and high-speed control. The ’C2xx instruction set is compatible with the ’C2x instruction set; code written for the ’C2x can[...]

  • Page 155

    Instruction Set Summary 7-2 7.1 Instruction Set Summary This section provides a summary of the instruction set in six tables (T able 7–1 to T able 7–6) according to the following functional headings: Accumulator , arithmetic, and logic instructions (see T able 7–1 on page 7-4) Auxiliary register and data page pointer instructions (see T able [...]

  • Page 156

    Instruction Set Summary 7-3 Assembly Language Instructions IAAA AAAA (One I followed by seven As) The I at the left represents a bit that reflects whether direct addressing (I = 0) or indirect ad- dressing (I = 1) is being used. When direct addressing is used, the seven As are the seven least significant bits (LSBs) of a data memory address. For in[...]

  • Page 157

    Instruction Set Summary 7-4 ZL VC ZL VC T wo 4-bit fields — each representing the following conditions: ACC = 0 Z ACC < 0 L Overflow V Carry C A conditional instruction contains two of these 4-bit fields. The 4-LSB field of the instruction is a mask field. A 1 in the corre- sponding mask bit indicates that condition is being tested. For exampl[...]

  • Page 158

    Instruction Set Summary 7-5 Assembly Language Instructions T able 7–1. Accumulator , Arithmetic, and Logic Instructions (Continued) Mnemonic Opcode Cycles Words Description AND AND ACC with data value, direct or indirect 1 1 01 10 1 1 10 IAAA AAAA AND with ACC with shift of 0 to 15, long immediate 2 2 101 1 1 1 1 1 101 1 SHFT + 1 word AND with AC[...]

  • Page 159

    Instruction Set Summary 7-6 T able 7–1. Accumulator , Arithmetic, and Logic Instructions (Continued) Mnemonic Opcode Cycles Words Description SUB Subtract from ACC with shift of 0 to 15, direct or indirect 1 1 001 1 SHFT IAAA AAAA Subtract from ACC with shift of 0 to 15, long immediate 2 2 101 1 1 1 1 1 1010 SHFT + 1 word Subtract from ACC with s[...]

  • Page 160

    Instruction Set Summary 7-7 Assembly Language Instructions T able 7–2. Auxiliary Register Instructions Mnemonic Description Words Cycles Opcode ADRK Add constant to current AR, short immediate 1 1 01 1 1 1000 IIII IIII BANZ Branch on current AR not-zero, indirect 2 4 (condition true) 2 (condition false) 01 1 1 101 1 1AAA AAAA + 1 word CMPR Compar[...]

  • Page 161

    Instruction Set Summary 7-8 T able 7–3. TREG, PREG, and Multiply Instructions (Continued) Mnemonic Opcode Cycles Words Description MAC Multiply and accumulate, direct or indirect 2 3 1010 0010 IAAA AAAA + 1 word MACD Multiply and accumulate with data move, direct or indirect 2 3 1010 001 1 IAAA AAAA + 1 word MPY Multiply TREG by data value, direc[...]

  • Page 162

    Instruction Set Summary 7-9 Assembly Language Instructions T able 7–4. Branch Instructions (Continued) M n e mo n ic Opcode Cycles Words Description CALL Call subroutine, indirect 2 4 01 1 1 1010 1AAA AAAA + 1 word CC Call conditionally 2 4 (conditions true) 2 (any condition false) 1 1 10 10TP ZL VC ZL VC + 1 word INTR Soft interrupt 1 4 101 1 1 [...]

  • Page 163

    Instruction Set Summary 7-10 T able 7–5. Control Instructions (Continued) Mnemonic Opcode Cycles Words Description POPD Pop top of stack to data memory , direct or indirect 1 1 1000 1010 IAAA AAAA PSHD Push data memory value on stack, direct or indirect 1 1 01 1 1 01 10 IAAA AAAA PUSH Push low ACC onto stack 1 1 101 1 1 1 10 001 1 1 100 RPT Repea[...]

  • Page 164

    Instruction Set Summary 7-1 1 Assembly Language Instructions T able 7–6. I/O and Memory Instructions (Continued) Mnemonic Opcode Cycles Words Description TBLR T able read, direct or indirect 1 3 1010 01 10 IAAA AAAA TBL W T able write, direct or indirect 1 3 1010 01 1 1 IAAA AAAA[...]

  • Page 165

    How T o Use the Instruction Descriptions 7-12 7.2 How T o Use the Instruction Descriptions Section 7.3 contains detailed information on the instruction set. The descrip- tion for each instruction presents the following categories of information: Syntax Operands Opcode Execution Status Bits Description Words Cycles Examples 7.2.1 Syntax Each instruc[...]

  • Page 166

    How T o Use the Instruction Descriptions 7-13 Assembly Language Instructions [, x] Operand x is optional. Example: For the syntax: ADD dma , [, shift ] you must supply dma , as in the instruction: ADD 7h and you have the option of adding a shift value, as in the instruction: ADD 7h, 5 [, x1 [, x2]] Operands x1 and x2 are optional, but you cannot in[...]

  • Page 167

    How T o Use the Instruction Descriptions 7-14 7.2.2 Operands Operands can be constants, or assembly-time expressions referring to memory , I/O ports, register addresses, pointers, shift counts, and a variety of other constants. The operands category for each instruction description de- fines the variables used for and/or within operands in the synt[...]

  • Page 168

    How T o Use the Instruction Descriptions 7-15 Assembly Language Instructions The field called dma contains the value dma , which is defined in the operands category . The contents of the fields ARU, N, and NAR are derived from the op- erands ind and n but do not directly correspond to those operands; therefore, a note directs you to the appropriate[...]

  • Page 169

    How T o Use the Instruction Descriptions 7-16 7.2.7 Words The words category specifies the number of memory words (one or two) re- quired to store the instruction. When the number of words depends on the ad- dressing mode used for an instruction, the words category specifies which ad- dressing modes require one word and which require two words. 7.2[...]

  • Page 170

    How T o Use the Instruction Descriptions 7-17 Assembly Language Instructions If an instruction requires memory operand(s), the rows in the table indicate the location(s) of the operand(s), as defined here: DARAM The operand is in internal dual-access RAM. SARAM The operand is in internal single-access RAM. External The operand is in external memory[...]

  • Page 171

    How T o Use the Instruction Descriptions 7-18 The instruction-cycle timings are based on the following assumptions: At least the next four instructions are fetched from the same memory sec- tion (internal or external) that was used to fetch the current instruction (ex- cept in the case of PC discontinuity instructions, such as B, CALL, etc.) In the[...]

  • Page 172

    How T o Use the Instruction Descriptions 7-19 Assembly Language Instructions The instruction also specifies that AR0 will be the next auxiliary register; therefore, after the instruction ARP = 0. Because no carry is generated during the addition, the carry bit (C) be- comes 0.[...]

  • Page 173

    Instruction Descriptions 7-20 7.3 Instruction Descriptions This section contains detailed information on the instruction set for the ’C2xx (For a summary of the instruction set, see Section 7.1.) The instructions are presented alphabetically , and the description for each instruction presents the following categories of information: Syntax Operan[...]

  • Page 174

    Absolute V alue of Accumulator ABS 7-21 Assembly Language Instructions Syntax ABS Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then ... |(ACC)| → ACC; 0 → C Status Bits Affected by Affects OVM C and OV This instruction is not affected by SXM Description If the contents of the[...]

  • Page 175

    ABS Absolute V alue of Accumulator 7-22 Example 1 ABS Before Instruction After Instruction ACC X 1234h ACC 0 1234h CC Example 2 ABS Before Instruction After Instruction ACC X 0FFFFFFFFh ACC 0 1h CC Example 3 ABS ;(OVM = 1) Before Instruction After Instruction ACC X 80000000h ACC 0 7FFFFFFFh CC X1 OV OV Example 4 ABS ;(OVM = 0) Before Instruction Af[...]

  • Page 176

    Add to Accumulator ADD 7-23 Assembly Language Instructions Syntax ADD dma [, shift ] Direct addressing ADD dma , 16 Direct with left shift of 16 ADD ind [, shift [, AR n ] ] Indirect addressing ADD ind , 16 [, AR n ] Indirect with left shift of 16 ADD # k Short immediate addressing ADD # lk [, shift ] Long immediate addressing Operands dma: 7 LSBs [...]

  • Page 177

    ADD Add to Accumulator 7-24 Execution Increment PC, then ... Event Addressing mode (ACC) + ( (data-memory address) 2 s hift ) → ACC Direct or indirect (ACC) + ( (data-memory address) 2 16 ) → ACC Direct or indirect (shift of 16) (ACC) + k → ACC Short immediate (ACC) + lk 2 shift → ACC Long immediate Status Bits Affected by Affects Addressin[...]

  • Page 178

    Add to Accumulator ADD 7-25 Assembly Language Instructions Cycles for a Single ADD Instruction (Using Direct and Indirect Addressing) Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 1+d 1+d 1+d 2+d+p † If the operand and the code are in the same SARAM block Cycles for a Repeat (RPT) Execution of an ADD Ins[...]

  • Page 179

    ADD Add to Accumulator 7-26 Example 3 ADD #1h ;Add short immediate Before Instruction After Instruction ACC X 2h ACC 0 03h CC Example 4 ADD #1111h,1 ;Add long immediate with shift of 1 Before Instruction After Instruction ACC X 2h ACC 0 2224h CC[...]

  • Page 180

    Add to Accumulator With Carry ADDC 7-27 Assembly Language Instructions Syntax ADDC dma Direct addressing ADDC ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– ADDC dma 1 5 1[...]

  • Page 181

    ADDC Add to Accumulator With Carry 7-28 Cycles for a Repeat (RPT) Execution of an ADDC Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 ADDC DAT300 ;(DP = 6: addresses 0300h–037Fh; ;DAT300 is a label [...]

  • Page 182

    Add to Accumulator With Sign Extension Suppressed ADDS 7-29 Assembly Language Instructions Syntax ADDS dma Direct addressing ADDS ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *B[...]

  • Page 183

    ADDS Add to Accumulator With Sign Extension Suppressed 7-30 Cycles for a Repeat (RPT) Execution of an ADDS Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 ADDS 0 ;(DP = 6: addresses 0300h–037Fh) Befo[...]

  • Page 184

    Add to Accumulator With Shift Specified by TREG ADDT 7-31 Assembly Language Instructions Syntax ADDT dma Direct addressing ADDT ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0[...]

  • Page 185

    ADDT Add to Accumulator With Shift Specified by TREG 7-32 Cycles for a Repeat (RPT) Execution of an ADDT Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 ADDT 127 ;(DP = 4: addresses 0200h–027Fh, ;SXM[...]

  • Page 186

    Add Short-Immediate V alue to Auxiliary Register ADRK 7-33 Assembly Language Instructions Syntax ADRK # k Short immediate addressing Operands k: 8-bit short immediate value ADRK # k 1 5 1 4 1 3 1 2 1 1 1 0 9876543210 0 1111000 k Execution Increment PC, then ... (current AR) + 8-bit positive constant → current AR Status Bits None Description The 8[...]

  • Page 187

    AND AND With Accumulator 7-34 Syntax AND dma Direct addressing AND ind [, AR n ] Indirect addressing AND # lk [, shift ] Long immediate addressing AND # lk , 16 Long immediate with left shift of 16 Operands dma: 7 LSBs of the data-memory address shift: Left shift value from 0 to 15 (defaults to 0) n: V alue from 0 to 7 designating the next auxiliar[...]

  • Page 188

    AND With Accumulator AND 7-35 Assembly Language Instructions Status Bits None This instruction is not affected by SXM. Description If direct or indirect addressing is used, the low word of the accumulator is ANDed with a data-memory value, and the result is placed in the low word posi- tion in the accumulator . The high word of the accumulator is z[...]

  • Page 189

    AND AND With Accumulator 7-36 Example 1 AND 16 ;(DP = 4: addresses 0200h–027Fh) Before Instruction After Instruction Data Memory Data Memory 0210h 00FFh 0210h 00FFh ACC 12345678h ACC 00000078h Example 2 AND * Before Instruction After Instruction ARP 0 ARP 0 AR0 0301h AR0 0301h Data Memory Data Memory 0301h 0FF00h 0301h 0FF00h ACC 12345678h ACC 00[...]

  • Page 190

    Add PREG to Accumulator AP AC 7-37 Assembly Language Instructions Syntax AP AC Operands None AP AC 1 5 1 4 1 3 1 2 1 1 1 0 9876543210 1 011111000000100 Execution Increment PC, then ... (ACC) + shifted (PREG) → ACC Status Bits Affected by Affects PM and OVM C and OV This instruction is not affected by SXM. Description The contents of PREG are shif[...]

  • Page 191

    AP AC Add PREG to Accumulator 7-38 Example APAC ;(PM = 01) Before Instruction After Instruction PREG 40h PREG 40h ACC X 20h ACC 0 A0h CC[...]

  • Page 192

    Branch Unconditionally B 7-39 Assembly Language Instructions Syntax B pma [, ind [, AR n ] ] Indirect addressing Operands pma: 16-bit program-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– B pma [, ind [ , AR n ]] 1 5 1 4 1 3 1 2 1 1 1 0 [...]

  • Page 193

    BACC Branch to Location Specified by Accumulator 7-40 Syntax BACC Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0 1 0 0 0 1 1 1 1 1 0 1 Execution ACC(15:0) → PC Status Bits None Description Control is passed to the 16-bit address residing in the lower half of the accumu- lator . Words 1 Cycles for a Single BACC Instruction RO[...]

  • Page 194

    Branch on Auxiliary Register Not Zero BANZ 7-41 Assembly Language Instructions Syntax BANZ pma [, ind [, AR n ] ] Indirect addressing Operands pma: 16-bit program-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– BANZ pma [, ind [ , AR n ]] [...]

  • Page 195

    BANZ Branch on Auxiliary Register Not Zero 7-42 Example 1 BANZ PGM0 ;(PGM0 labels program address 0) Before Instruction After Instruction ARP 0 ARP 0 AR0 5h AR0 4h Because the content of AR0 is not zero, the program branches to program ad- dress 0 is loaded into the program counter (PC), and the program continues executing from that location. The d[...]

  • Page 196

    Branch Conditionally BCND 7-43 Assembly Language Instructions Syntax BCND pma , cond 1 [, cond 2] [,...] Operands pma: 16-bit program-memory address cond Condition EQ ACC = 0 NEQ ACC ≠ 0 L T ACC < 0 LEQ ACC ≤ 0 GT ACC > 0 GEQ ACC ≥ 0 NC C = 0 C C = 1 NOV OV = 0 OV OV = 1 BIO BIO low NTC TC = 0 TC TC = 1 UNC Unconditionally Opcode 0 1 2 [...]

  • Page 197

    BCND Branch Conditionally 7-44 Example BCND PGM191,LEQ,C If the accumulator contents are less than or equal to zero and the carry bit is set, program address 191 is loaded into the program counter , and the program continues to execute from that location. If these conditions do not hold, execu- tion continues from location PC + 2.[...]

  • Page 198

    T est Bit BIT 7-45 Assembly Language Instructions Syntax BIT dma , bit code Direct addressing BIT ind , bit code [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address bit code: V alue from 0 to 15 indicating which bit to test (see Figure 7–1) n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of [...]

  • Page 199

    BIT T est Bit 7-46 Cycles for a Single BIT Instruction Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 1+d 1+d 1+d 2+d+p † If the operand and the code are in the same SARAM block Cycles for a Repeat (RPT) Execution of a BIT Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n[...]

  • Page 200

    T est Bit Specified by TREG BITT 7-47 Assembly Language Instructions Syntax BITT dma Direct addressing BITT ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– BITT dma 1 5 1 4[...]

  • Page 201

    BITT T est Bit Specified by TREG 7-48 Cycles for a Single BITT Instruction Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 1+d 1+d 1+d 2+d+p † If the operand and the code are in the same SARAM block Cycles for a Repeat (RPT) Execution of an BITT Instruction Program Operand ROM DARAM SARAM External DARAM n [...]

  • Page 202

    Block Move From Data Memory to Data Memory BLDD 7-49 Assembly Language Instructions Syntax General syntax: BLDD source, destination BLDD # lk , dma Direct with long immediate source BLDD # lk , ind [, AR n ] Indirect with long immediate source BLDD dma , # lk Direct with long immediate destination BLDD ind , # lk [, AR n ] Indirect with long immedi[...]

  • Page 203

    BLDD Block Move From Data Memory to Data Memory 7-50 Execution Increment PC, then ... (PC) → MST ACK lk → PC (source) → destination For indirect, modify (current AR) and (ARP) as specified (PC) + 1 → PC While (repeat counter) ≠ 0: (source) → destination For indirect, modify (current AR) and (ARP) as specified (PC) + 1 → PC (repeat cou[...]

  • Page 204

    Block Move From Data Memory to Data Memory BLDD 7-51 Assembly Language Instructions Cycles Cycles for a Single BLDD Instruction Operand ROM DARAM SARAM External Source: DARAM Destination: DARAM 3 3 3 3+2p Source: SARAM Destination: DARAM 3 3 3 3+2p Source: External Destination: DARAM 3+d src 3+d src 3+d src 3+d src +2p Source: DARAM Destination: SA[...]

  • Page 205

    BLDD Block Move From Data Memory to Data Memory 7-52 Cycles for a Repeat (RPT) Execution of a BLDD Instruction Operand ROM DARAM SARAM External Source: DARAM Destination: DARAM n+2 n+2 n+2 n+2+2p Source: SARAM Destination: DARAM n+2 n+2 n+2 n+2+2p Source: External Destination: DARAM n+2+nd src n+2+nd src n+2+nd src n+2+nd src +2p Source: DARAM Dest[...]

  • Page 206

    Block Move From Data Memory to Data Memory BLDD 7-53 Assembly Language Instructions Example 1 BLDD #300h,20h ;(DP = 6) Before Instruction After Instruction Data Memory Data Memory 300h 0h 300h 0h 320h 0Fh 320h 0h Example 2 BLDD *+,#321h,AR3 Before Instruction After Instruction ARP 2 ARP 3 AR2 301h AR2 302h Data Memory Data Memory 301h 01h 301h 01h [...]

  • Page 207

    BLPD Block Move From Program Memory to Data Memory 7-54 Syntax General syntax: BLPD source , destination BLPD # pma , dma Direct with long immediate source BLPD # pma , ind [, AR n ] Indirect with long immediate source Operands pma: 16-bit program-memory address dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxil[...]

  • Page 208

    Block Move From Program Memory to Data Memory BLPD 7-55 Assembly Language Instructions Description A word in program memory pointed to by the source is copied to data-memory space pointed to by destination . The first word of the source space is pointed to by a long-immediate value. The data-memory destination space is pointed to by a data-memory a[...]

  • Page 209

    BLPD Block Move From Program Memory to Data Memory 7-56 Cycles Cycles for a Single BLPD Instruction Operand ROM DARAM SARAM External Source: DARAM/ROM Destination: DARAM 3 3 3 3+2p code Source: SARAM Destination: DARAM 3 3 3 3+2p code Source: External Destination: DARAM 3+p src 3+p src 3+p src 3+p src +2p code Source: DARAM/ROM Destination: SARAM 3[...]

  • Page 210

    Block Move From Program Memory to Data Memory BLPD 7-57 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of a BLPD Instruction (Continued) Operand External SARAM DARAM ROM Source: SARAM Destination: SARAM n+2 2n ‡ n+2 2n ‡ n+2 2n ‡ n+4 † 2n+2 § n+2+2p code 2n+2p code ‡ Source: External Destination: SARAM n+2+np src † [...]

  • Page 211

    CALA Call Subroutine at Location Specified by Accumulator 7-58 Syntax CALA Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 1 1 0 0 0 1 1 1 1 1 0 1 Execution PC + 1 → TOS ACC(15:0) → PC Status Bits None Description The current program counter (PC) is incremented and pushed onto the top of the stack (TOS). Then, the contents of[...]

  • Page 212

    Call Unconditionally CALL 7-59 Assembly Language Instructions Syntax CALL pma [, ind [, AR n ] ] Indirect addressing Operands pma: 16-bit program-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– CALL pma [ , ind [ , AR n ]] 1 5 1 4 1 3 1 2 [...]

  • Page 213

    CC Call Conditionally 7-60 Syntax CC pma , cond Ă 1 [, cond Ă 2] [,...] Operands pma: 16-bit program-memory address cond Condition EQ ACC = 0 NEQ ACC ≠ 0 L T ACC < 0 LEQ ACC ≤ 0 GT ACC > 0 GEQ ACC ≥ 0 NC C = 0 C C = 1 NOV OV = 0 OV OV = 1 BIO BIO low NTC TC = 0 TC TC = 1 UNC Unconditionally Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15[...]

  • Page 214

    Call Conditionally CC 7-61 Assembly Language Instructions Example CC PGM191,LEQ,C If the accumulator contents are less than or equal to zero and the carry bit is set, 0BFh (191) is loaded into the program counter , and the program continues to execute from that location. If the conditions are not met, execution continues at the instruction followin[...]

  • Page 215

    CLRC Clear Control Bit 7-62 Syntax CLRC control bit Operands control bit: Select one of the following control bits: C Carry bit of status register ST1 CNF RAM configuration control bit of status register ST1 INTM Interrupt mode bit of status register ST0 OVM Overflow mode bit of status register ST0 SXM Sign-extension mode bit of status register ST1[...]

  • Page 216

    Clear Control Bit CLRC 7-63 Assembly Language Instructions Words 1 Cycles for a Single CLRC Instruction ROM DARAM SARAM External 1 1 1 1+p Cycles for a Repeat (RPT) Execution of a CLRC Instruction ROM DARAM SARAM External n n n n+p Example CLRC TC ;(TC is bit 11 of ST1) Before Instruction After Instruction ST1 x9xxh ST1 x1xxh Cycles[...]

  • Page 217

    CMPL Complement Accumulator 7-64 Syntax CMPL Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then ... (ACC) → ACC Status Bits None Description The contents of the accumulator are replaced with its logical inversion (1s complement). The carry bit is unaffected. Words 1 Cycles for a[...]

  • Page 218

    Compare Auxiliary Register With AR0 CMPR 7-65 Assembly Language Instructions Syntax CMPR CM Operands CM: V alue from 0 to 3 Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 CM 1 0 0 0 1 0 1 1 1 1 1 1 0 1 Execution Increment PC, then ... Compare (current AR) to (AR0) and place the result in the TC bit of status register ST1. Status Bits Affects TC This [...]

  • Page 219

    DMOV Data Move in Data Memory 7-66 Syntax DMOV dma Direct addressing DMOV ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– DMOV dma 1 5 1 4 1 3 1 2 1 1 1 0 9876543210 0 1110[...]

  • Page 220

    Data Move in Data Memory DMOV 7-67 Assembly Language Instructions Cycles for a Single DMOV Instruction Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 3 † 1+p External ‡ 2+2d 2+2d 2+2d 5+2d+p † If the operand and the code are in the same SARAM block ‡ If used on external memory , DMOV reads the specified memory locatio[...]

  • Page 221

    IDLE Idle Until Interrupt 7-68 Syntax IDLE Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then wait for unmasked or nonmaskable hardware interrupt. Status Bits Affected by INTM Description The IDLE instruction forces the program being executed to halt until the CPU receives a reque[...]

  • Page 222

    Input Data From Port IN 7-69 Assembly Language Instructions Syntax IN dma , PA Direct addressing IN ind , PA [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register P A: 16-bit I/O port or I/O-mapped register address ind: Select one of the following seven options: *[...]

  • Page 223

    IN Input Data From Port 7-70 Cycles for a Single IN Instruction Program Operand ROM DARAM SARAM External Destination: DARAM 2+io src 2+io src 2+io src 3+io src +2p code Destination: SARAM 2+io src 2+io src 2+io src 3+io src † 3+io src +2p code Destination: External 3+d dst +io src 3+d dst +io src 3+d dst +io src 6+d dst +io src +2p code † If th[...]

  • Page 224

    Software Interrupt INTR 7-71 Assembly Language Instructions Syntax INTR K Operands K: V alue from 0 to 31 that indicates the interrupt vector location to branch to Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 K 1 1 0 0 1 1 1 1 1 0 1 Execution (PC) + 1 → stack corresponding interrupt vector location → PC Status Bits Affects INTM This instruction[...]

  • Page 225

    LACC Load Accumulator With Shift 7-72 Syntax LACC dma [, shift ] Direct addressing LACC dma, 16 Direct with left shift of 16 LACC ind [, shift [, AR n ] ] Indirect addressing LACC ind , 16 [, AR n ] Indirect with left shift of 16 LACC # lk [, shift ] Long immediate addressing Operands dma: 7 LSBs of the data-memory address shift: Left shift value f[...]

  • Page 226

    Load Accumulator With Shift LACC 7-73 Assembly Language Instructions Execution Increment PC, then ... Event Addressing mode (data-memory address) × 2 shift → ACC Direct or indirect (data-memory address) × 2 16 → ACC Direct or indirect (shift of 16) lk × 2 shift → ACC Long immediate Status Bits Affected by SXM Description The contents of th[...]

  • Page 227

    LACC Load Accumulator With Shift 7-74 Example 1 LACC 6,4 ;(DP = 8: addresses 0400h–047Fh, ;SXM = 0) Before Instruction After Instruction Data Memory Data Memory 406h 01h 406h 01h ACC X 012345678h ACC X 10h CC Example 2 LACC *,4 ;(SXM = 0) Before Instruction After Instruction ARP 2 ARP 2 AR2 0300h AR2 0300h Data Memory Data Memory 300h 0FFh 300h 0[...]

  • Page 228

    Load Low Accumulator and Clear High Accumulator LACL 7-75 Assembly Language Instructions Syntax LACL dma Direct addressing LACL ind [, AR n ] Indirect addressing LACL # k Short immediate Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register k: 8-bit short immediate value ind: Select one of the[...]

  • Page 229

    LACL Load Low Accumulator and Clear High Accumulator 7-76 Cycles for a Single LACL Instruction (Using Direct and Indirect Addressing) Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 1+d 1+d 1+d 2+d+p † If the operand and the code are in the same SARAM block Cycles for a Repeat (RPT) Execution of an LACL In[...]

  • Page 230

    Load Low Accumulator and Clear High Accumulator LACL 7-77 Assembly Language Instructions Example 3 LACL #10h Before Instruction After Instruction ACC X 7FFFFFFFh ACC X 010h CC[...]

  • Page 231

    LACT Load Accumulator With Shift Specified by TREG 7-78 Syntax LACT dma Direct addressing LACT ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– LACT dma 1 5 1 4 1 3 1 2 1 1 [...]

  • Page 232

    Load Accumulator With Shift Specified by TREG LACT 7-79 Assembly Language Instructions Cycles for a Single LACT Instruction Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 1+d 1+d 1+d 2+d+p † If the operand and the code are in the same SARAM block Cycles for a Repeat (RPT) Execution of an LACT Instruction [...]

  • Page 233

    LAR Load Auxiliary Register 7-80 Syntax LAR AR x , dma Direct addressing LAR AR x , ind [, AR n ] Indirect addressing LAR AR x , # k Short immediate addressing LAR AR x , # lk Long immediate addressing Operands x: V alue from 0 to 7 designating the auxiliary register to be loaded dma: 7 LSBs of the data-memory address k: 8-bit short immediate value[...]

  • Page 234

    Load Auxiliary Register LAR 7-81 Assembly Language Instructions Description The contents of the specified data-memory address or an 8-bit or 16-bit con- stant are loaded into the specified auxiliary register (ARx). The specified con- stant is acted upon like an unsigned integer , regardless of the value of SXM. The LAR and SAR (store auxiliary regi[...]

  • Page 235

    LAR Load Auxiliary Register 7-82 Example 1 LAR AR0,16 ;(DP = 6: addresses 0300h–037Fh) Before Instruction After Instruction Data Memory Data Memory 310h 18h 310h 18h AR0 6h AR0 18h Example 2 LAR AR4,*– Before Instruction After Instruction ARP 4 ARP 4 Data Memory Data Memory 300h 32h 300h 32h AR4 300h AR4 32h Note: LAR in the indirect addressing[...]

  • Page 236

    Load Data Page Pointer LDP 7-83 Assembly Language Instructions Syntax LDP dma Direct addressing LDP ind [, AR n ] Indirect addressing LDP # k Short immediate addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register k: 9-bit short immediate value ind: Select one of the following seven o[...]

  • Page 237

    LDP Load Data Page Pointer 7-84 Cycles for a Single LDP Instruction (Using Direct and Indirect Addressing) Program Operand ROM DARAM SARAM External DARAM 2 2 2 2+p code SARAM 2 2 2, 3 † 2+p code External 2+d src 2+d src 2+d src 3+d src +p code † If the operand and the code are in the same SARAM block Cycles for a Repeat (RPT) Execution of an LD[...]

  • Page 238

    Load Product Register High Word LPH 7-85 Assembly Language Instructions Syntax LPH dma Direct addressing LPH ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– LPH dma 1 5 1 4[...]

  • Page 239

    LPH Load Product Register High Word 7-86 Cycles for a Repeat (RPT) Execution of an LPH Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 LPH DAT0 ;(DP = 4) Before Instruction After Instruction Data Memor[...]

  • Page 240

    Load Status Register LST 7-87 Assembly Language Instructions Syntax LST # m , dma Direct addressing LST # m , ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register m: Select one of the following: 0 Indicates that ST0 will be loaded 1 Indicates that ST1 will be[...]

  • Page 241

    LST Load Status Register 7-88 Figure 7–4. LST #1 Operation 1 5 1 4 1 3 1 21 1 1 0 9 8765 43210 ST0 ARP OV OVM 1 INTM DP ↑ ↑ ↑ 1 5 1 4 1 3 1 21 1 1 0 9 8765 43210 Data ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 1 5 1 4 1 3 1 21 1 1 0 9 8765 43210 ST1 ARB CNF TC SXM C 1 1 1 1 XF 1 1 PM Status Bits Affects ARB, ARP , OV , OVM, DP , CNF , TC, SXM,[...]

  • Page 242

    Load Status Register LST 7-89 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an LST Instruction Program Operand ROM DARAM SARAM External DARAM 2n 2n 2n 2n+p code SARAM 2n 2n 2n, 2n+1 † 2n+p code External 2n+nd src 2n+nd src 2n+nd src 2n+1+nd src +p code † If the operand and the code are in the same SARAM block Example 1 M[...]

  • Page 243

    LST Load Status Register 7-90 Example 4 LST #1,00h ;(DP = 6) ;Note that the ARB is loaded with ;the new ARP value. Before Instruction After Instruction Data Memory Data Memory 300h E1BCh 300h E1BCh ST0 0406h ST0 E406h ST1 09ECh ST1 E1FCh[...]

  • Page 244

    Load TREG LT 7-91 Assembly Language Instructions Syntax L T dma Direct addressing LT ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– LT dma 1 5 1 4 1 3 1 2 1 1 1 0 98765432[...]

  • Page 245

    LT Load TREG 7-92 Cycles for a Repeat (RPT) Execution of an L T Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 LT 24 ;(DP = 8: addresses 0400h–047Fh) Before Instruction After Instruction Data Memory[...]

  • Page 246

    Load TREG and Accumulate Previous Product LTA 7-93 Assembly Language Instructions Syntax L T A dma Direct addressing LTA ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– LTA[...]

  • Page 247

    LTA Load TREG and Accumulate Previous Product 7-94 Cycles for a Repeat (RPT) Execution of an L T A Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 LTA 36 ;(DP = 6: addresses 0300h–037Fh, ;PM =0: no s[...]

  • Page 248

    Load TREG, Accumulate Previous Product, and Move Data LT D 7-95 Assembly Language Instructions Syntax L TD dma Direct addressing LT D ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0[...]

  • Page 249

    LT D Load TREG, Accumulate Previous Product, and Move Data 7-96 Words 1 Cycles for a Single L TD Instruction Program Operand ROM DARAM SARAM External ‡ DARAM 1 1 1 1+p SARAM 1 1 1, 3 † 1+p External 2+2d 2+2d 2+2d 5+2d+p † If the operand and the code are in the same SARAM block ‡ If the L TD instruction is used with external memory , the dat[...]

  • Page 250

    Load TREG, Accumulate Previous Product, and Move Data LT D 7-97 Assembly Language Instructions Example 2 LTD *,AR3 ;(PM = 0) Before Instruction After Instruction ARP 1 ARP 3 AR1 3FEh AR1 3FEh Data Memory Data Memory 3FEh 62h 3FEh 62h Data Memory Data Memory 3FFh 0h 3FFh 62h TREG 3h TREG 62h PREG 0Fh PREG 0Fh ACC X 5h ACC 0 14h CC Note: The data mov[...]

  • Page 251

    LT P Load TREG and Store PREG in Accumulator 7-98 Syntax L TP dma Direct addressing LT P ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– LT P dma 1 5 1 4 1 3 1 2 1 1 1 0 98[...]

  • Page 252

    Load TREG and Store PREG in Accumulator LT P 7-99 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an L TP Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 LTP 36 ;(DP = 6: addresse[...]

  • Page 253

    LT S Load TREG and Subtract Previous Product 7-100 Syntax L TS dma Direct addressing LT S ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– LT S dma 1 5 1 4 1 3 1 2 1 1 1 0 9[...]

  • Page 254

    Load TREG and Subtract Previous Product LT S 7-101 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an L TS Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 LTS DAT36 ;(DP = 6: addr[...]

  • Page 255

    MAC Multiply and Accumulate 7-102 Syntax MAC pma , dma Direct addressing MAC pma , ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address pma: 16-bit program-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– MAC pm[...]

  • Page 256

    Multiply and Accumulate MAC 7-103 Assembly Language Instructions Description The MAC instruction: Adds the previous product, shifted as defined by the PM status bits, to the accumulator . The carry bit is set (C = 1) if the result of the addition gener- ates a carry and is cleared (C = 0) if it does not generate a carry . Loads the TREG with the co[...]

  • Page 257

    MAC Multiply and Accumulate 7-104 Cycles Cycles for a Single MAC Instruction Operand ROM DARAM SARAM External Operand 1: DARAM/ ROM Operand 2: DARAM 3 3 3 3+2p code Operand 1: SARAM Operand 2: DARAM 3 3 3 3+2p code Operand 1: External Operand 2: DARAM 3+p op1 3+p op1 3+p op1 3+p op1 +2p code Operand 1: DARAM/ ROM Operand 2: SARAM 3 3 3 3+2p code Op[...]

  • Page 258

    Multiply and Accumulate MAC 7-105 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an MAC Instruction (Continued) Operand External SARAM DARAM ROM Operand 1: DARAM/ ROM Operand 2: SARAM n+2 n+2 n+2 n+2+2p code Operand 1: SARAM Operand 2: SARAM n+2 2n+2 † n+2 2n+2 † n+2 2n+2 † n+2+2p code 2n+2 † Operand 1: External Opera[...]

  • Page 259

    MACD Multiply and Accumulate With Data Move 7-106 Syntax MACD pma , dma Direct addressing MACD pma , ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address pma: 16-bit program-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *B[...]

  • Page 260

    Multiply and Accumulate With Data Move MACD 7-107 Assembly Language Instructions Status Bits Affected by Affects PM and OVM C and OV Description The MACD instruction: Adds the previous product, shifted as defined by the PM status bits, to the accumulator . The carry bit is set (C = 1) if the result of the addition gener- ates a carry and is cleared[...]

  • Page 261

    MACD Multiply and Accumulate With Data Move 7-108 Cycles for a Single MACD Instruction (Continued) Operand External SARAM DARAM ROM Operand 1: External Operand 2: DARAM 3+p op1 3+p op1 3+p op1 3+p op1 +2p code Operand 1: DARAM/ ROM Operand 2: SARAM 3 3 3 3+2p code Operand 1: SARAM Operand 2: SARAM 33 3 4 † 5 ‡ 3+2p code 4+2p code † Operand 1:[...]

  • Page 262

    Multiply and Accumulate With Data Move MACD 7-109 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an MACD Instruction (Continued) Operand External SARAM DARAM ROM Operand 1: SARAM Operand 2: SARAM 2n 3n ‡ 2n 3n ‡ 2n 2n+2 † 3n ‡ 3n+2 § 2n+2p code 3n ‡ Operand 1: External Operand 2: SARAM 2n+np op1 2n+np op1 2n+np op1[...]

  • Page 263

    MACD Multiply and Accumulate With Data Move 7-1 10 Example 2 MACD 0FF00h,*,AR6 ;(PM = 0, CNF = 1) Before Instruction After Instruction ARP 5 ARP 6 AR5 308h AR5 308h Data Memory Data Memory 308h 23h 308h 23h Data Memory Data Memory 309h 18h 309h 23h Program Memory Program Memory FF00h 4h FF00h 4h TREG 45h TREG 23h PREG 458972h PREG 8Ch ACC X 723EC41[...]

  • Page 264

    Modify Auxiliary Register MAR 7-1 1 1 Assembly Language Instructions Syntax MAR dma Direct addressing MAR ind [, AR n ] Indirect addressing Operands n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– MAR dma 1 5 1 4 1 3 1 2 1 1 1 0 9876543210 1 00010110 dma[...]

  • Page 265

    MAR Modify Auxiliary Register 7-1 12 Words 1 Cycles for a Single MAR Instruction ROM DARAM SARAM External 1 1 1 1+p Cycles for a Repeat (RPT) Execution of an MAR Instruction ROM DARAM SARAM External n n n n+p Example 1 MAR *,AR1 ;Load the ARP with 1. Before Instruction After Instruction ARP 0 ARP 1 ARB 7 ARB 0 Example 2 MAR *+,AR5 ;Increment curren[...]

  • Page 266

    Multiply MPY 7-1 13 Assembly Language Instructions Syntax MPY dma Direct addressing MPY ind [, AR n ] Indirect addressing MPY # k Short immediate addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register k: 13-bit short immediate value ind: Select one of the following seven options: * *[...]

  • Page 267

    MPY Multiply 7-1 14 Cycles for a Single MPY Instruction (Using Direct and Indirect Addressing) Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 1+d 1+d 1+d 2+d+p † If the operand and the code are in the same SARAM block Cycles for a Repeat (RPT) Execution of an MPY Instruction (Using Direct and Indirect Add[...]

  • Page 268

    Multiply MPY 7-1 15 Assembly Language Instructions Example 2 MPY *,AR2 Before Instruction After Instruction ARP 1 ARP 2 AR1 40Dh AR1 40Dh Data Memory Data Memory 40Dh 7h 40Dh 7h TREG 6h TREG 6h PREG 36h PREG 2Ah Example 3 MPY #031h Before Instruction After Instruction TREG 2h TREG 2h PREG 36h PREG 62h[...]

  • Page 269

    MPY A Multiply and Accumulate Previous Product 7-1 16 Syntax MPY A dma Direct addressing MPY A ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– MPY A dma 1 5 1 4 1 3 1 2 1 1[...]

  • Page 270

    Multiply and Accumulate Previous Product MPY A 7-1 17 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an MPY A Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 MPYA DAT13 ;(DP = 6,[...]

  • Page 271

    MPYS Multiply and Subtract Previous Product 7-1 18 Syntax MPYS dma Direct addressing MPYS ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– MPYS dma 1 5 1 4 1 3 1 2 1 1 1 0 9[...]

  • Page 272

    Multiply and Subtract Previous Product MPYS 7-1 19 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an MPYS Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 MPYS DAT13 ;(DP = 6, PM [...]

  • Page 273

    MPYU Multiply Unsigned 7-120 Syntax MPYU dma Direct addressing MPYU ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– MPYU dma 1 5 1 4 1 3 1 2 1 1 1 0 9876543210 0 10101010 d[...]

  • Page 274

    Multiply Unsigned MPYU 7-121 Assembly Language Instructions Cycles for a Single MPYU Instruction Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 1+d 1+d 1+d 2+d+p † If the operand and the code are in the same SARAM block Cycles for a Repeat (RPT) Execution of an MPYU Instruction Program Operand ROM DARAM S[...]

  • Page 275

    NEG Negate Accumulator 7-122 Syntax NEG Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 0 0 0 0 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then ... (ACC) × –1 → ACC Status Bits Affected by Affects OVM C and OV Description The content of the accumulator is replaced with its arithmetic complement (2s complement). The OV bit is se[...]

  • Page 276

    Negate Accumulator NEG 7-123 Assembly Language Instructions Example 3 NEG ;(OVM = 1) Before Instruction After Instruction ACC X 080000000h ACC 0 7FFFFFFFh CC X1 OV OV[...]

  • Page 277

    NMI Nonmaskable Interrupt 7-124 Syntax NMI Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 0 0 1 0 1 0 0 1 1 1 1 1 0 1 Execution (PC) + 1 → stack 24h → PC 1 → INTM Status Bits Affects INTM This instruction is not affected by INTM. Description The NMI instruction forces the program counter to the nonmaskable interrupt vector loc[...]

  • Page 278

    No Operation NOP 7-125 Assembly Language Instructions Syntax NOP Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 Execution Increment PC Status Bits None Description No operation is performed. The NOP instruction affects only the PC. The NOP instruction is useful to create pipeline and execution delays. Wor[...]

  • Page 279

    NORM Normalize Contents of Accumulator 7-126 Syntax NORM ind Indirect addressing Operands ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– NORM ind 1 5 1 4 1 3 1 2 1 1 1 0 9876543210 1 01000001 ARU N NAR Note: ARU, N, and NAR are defined in Section 6.3, Indirect Addressing Mode (page 6-9). Execution Increment PC, th[...]

  • Page 280

    Normalize Contents of Accumulator NORM 7-127 Assembly Language Instructions Notes: For the NORM instruction, the auxiliary register operations are executed dur- ing the fourth phase of the pipeline, the execution phase. For other instruc- tions, the auxiliary register operations take place in the second phase of the pipeline, in the decode phase. T[...]

  • Page 281

    NORM Normalize Contents of Accumulator 7-128 Example 3 15-Bit Normalization: MAR *,AR1 ;Use AR1 to store the exponent. LAR AR1,#0Fh ;Initialize exponent counter. RPT #14 ;15-bit normalization specified (yielding ;a 4-bit exponent and 16-bit mantissa). NORM *– ;NORM automatically stops shifting when first ;significant magnitude bit is found, ;perf[...]

  • Page 282

    OR With Accumulator OR 7-129 Assembly Language Instructions Syntax OR dma Direct addressing OR ind [, AR n ] Indirect addressing OR # lk [, shift ] Long immediate addressing OR # lk, 16 Long immediate with left shift of 16 Operands dma: 7 LSBs of the data-memory address shift: Left shift value from 0 to 15 (defaults to 0) n: V alue from 0 to 7 desi[...]

  • Page 283

    OR OR With Accumulator 7-130 Status Bits None This instruction is not affected by SXM. Description An OR operation is performed on the contents of the accumulator and the con- tents of the addressed data-memory location or a long-immediate value. The long-immediate value may be shifted before the OR operation. The result re- mains in the accumulato[...]

  • Page 284

    OR With Accumulator OR 7-131 Assembly Language Instructions Example 1 OR DAT8 ;(DP = 8) Before Instruction After Instruction Data Memory Data Memory 408h 0F000h 408h 0F000h ACC X 100002h ACC X 10F002h CC Example 2 OR *,AR0 Before Instruction After Instruction ARP 1 ARP 0 AR1 300h AR1 300h Data Memory Data Memory 300h 1111 h 300h 1111 h ACC X 222h A[...]

  • Page 285

    OUT Output Data to Port 7-132 Syntax OUT dma , PA Direct addressing OUT ind , PA [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address P A: 16-bit I/O address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– OUT dma , PA 1 5 1 4 1 [...]

  • Page 286

    Output Data to Port OUT 7-133 Assembly Language Instructions Cycles Cycles for a Single OUT Instruction Program Operand ROM DARAM SARAM External Source: DARAM 3+io dst 3+io dst 3+io dst 5+io dst +2p code Source: SARAM 3+io dst 3+io dst 3+io dst 4+io dst † 5+io dst +2p code Source: External 3+d src +io dst 3+d src +io dst 3+d src +io dst 6+d src +[...]

  • Page 287

    PA C Load Accumulator With Product Register 7-134 Syntax P AC Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then ... shifted (PREG) → ACC Status Bits Affected by PM Description The content of PREG, shifted as specified by the PM status bits, is loaded into the accumulator . Word[...]

  • Page 288

    Pop T op of Stack to Low Accumulator POP 7-135 Assembly Language Instructions Syntax POP Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 0 0 1 1 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then ... (TOS) → ACC(15:0) 0 → ACC(31:16) Pop stack one level Status Bits None Description The content of the top of the stack (TOS) is copied[...]

  • Page 289

    POP Pop T op of Stack to Low Accumulator 7-136 Example POP Before Instruction After Instruction ACC X 82h ACC X 45h CC Stack 45h Stack 16h 16h 7h 7h 33h 33h 42h 42h 56h 56h 37h 37h 61h 61h 61h[...]

  • Page 290

    Pop T op of Stack to Data Memory POPD 7-137 Assembly Language Instructions Syntax POPD dma Direct addressing POPD ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– POPD dma 1[...]

  • Page 291

    POPD Pop T op of Stack to Data Memory 7-138 Cycles for a Repeat (RPT) Execution of a POPD Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+2 † n+p External 2n+nd 2n+nd 2n+nd 2n+2+nd+p † If the operand and the code are in the same SARAM block Example 1 POPD DAT10 ;(DP = 8) Before Instruction After Instruction D[...]

  • Page 292

    Push Data-Memory V alue Onto Stack PSHD 7-139 Assembly Language Instructions Syntax PSHD dma Direct addressing PSHD ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– PSHD dma[...]

  • Page 293

    PSHD Push Data-Memory V alue Onto Stack 7-140 Cycles for a Repeat (RPT) Execution of a PSHD Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+nd+p † If the operand and the code are in the same SARAM block Example 1 PSHD 127 ;(DP = 3: addresses 0180–01FFh) Before Instruction[...]

  • Page 294

    Push Low Accumulator Onto Stack PUSH 7-141 Assembly Language Instructions Syntax PUSH Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 1 1 1 1 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then... Push all stack locations down one level ACC(15:0) → TOS Status Bits None Description The stack values move down one level. Then, the conten[...]

  • Page 295

    RET Return From Subroutine 7-142 Syntax RET Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 Execution (TOS) → PC Pop stack one level. Status Bits None Description The contents of the top stack register are copied into the program counter . The remaining stack values are then copied up one level. RET conc[...]

  • Page 296

    Return Conditionally RETC 7-143 Assembly Language Instructions Syntax RETC cond 1 [, cond 2] [ ,... ] Operands cond Condition EQ ACC = 0 NEQ ACC ≠ 0 L T ACC < 0 LEQ ACC ≤ 0 GT ACC > 0 GEQ ACC ≥ 0 NC C = 0 CC = 1 NOV OV = 0 OV OV = 1 BIO BIO low NTC TC = 0 TC TC = 1 UNC Unconditionally ‡ Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ZL [...]

  • Page 297

    ROL Rotate Accumulator Left 7-144 Syntax ROL Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 1 1 0 0 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then ... C → ACC(0) (ACC(31)) → C (ACC(30:0)) → ACC(31:1) Status Bits Affects C This instruction is not affected by SXM. Description The ROL instruction rotates the accumulator left on[...]

  • Page 298

    Rotate Accumulator Right ROR 7-145 Assembly Language Instructions Syntax ROR Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 0 1 1 0 0 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then ... C → ACC(31) (ACC(0)) → C (ACC(31:1)) → ACC(30:0) Status Bits Affects C This instruction is not affected by SXM. Description The ROR instruction[...]

  • Page 299

    RPT Repeat Next Instruction 7-146 Syntax RPT dma Direct addressing RPT ind [, AR n ] Indirect addressing RPT # k Short immediate Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register k: 8-bit short immediate value ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0?[...]

  • Page 300

    Repeat Next Instruction RPT 7-147 Assembly Language Instructions Cycles for a Single RPT Instruction (Using Direct and Indirect Addressing) Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 1+d 1+d 1+d 2+d+p † If the operand and the code are in the same SARAM block Cycles for a Single RPT Instruction (Using [...]

  • Page 301

    SACH Store High Accumulator With Shift 7-148 Syntax SACH dma [, shift2 ] Direct addressing SACH ind [, shift2 [, AR n ] ] Indirect addressing Operands dma: 7 LSBs of the data-memory address shift2: Left shift value from 0 to 7 (defaults to 0) n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven option[...]

  • Page 302

    Store High Accumulator With Shift SACH 7-149 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an SACH Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+2 † n+p External 2n+nd 2n+nd 2n+nd 2n+2+nd+p † If the operand and the code are in the same SARAM block Example 1 SACH DAT10,1 ;(DP = 4: add[...]

  • Page 303

    SACL Store Low Accumulator With Shift 7-150 Syntax SACL dma [, shift2 ] Direct addressing SACL ind [, shift2 [, AR n ] ] Indirect addressing Operands dma: 7 LSBs of the data-memory address shift2: Left shift value from 0 to 7 (defaults to 0) n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options[...]

  • Page 304

    Store Low Accumulator With Shift SACL 7-151 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an SACL Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+2 † n+p External 2n+nd 2n+nd 2n+nd 2n+2+nd+p † If the operand and the code are in the same SARAM block. Example 1 SACL DAT11,1 ;(DP = 4: add[...]

  • Page 305

    SAR Store Auxiliary Register 7-152 Syntax SAR AR x , dma Direct addressing SAR AR x, ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address x: V alue from 0 to 7 designating the auxiliary register value to be stored n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven option[...]

  • Page 306

    Store Auxiliary Register SAR 7-153 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an SAR Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+2 † n+p External 2n+nd 2n+nd 2n+nd 2n+2+nd+p † If the operand and the code are in the same SARAM block Example 1 SAR AR0,DAT30 ;(DP = 6: addresses 030[...]

  • Page 307

    SBRK Subtract Short-Immediate V alue From Auxiliary Register 7-154 Syntax SBRK # k Short immediate addressing Operands k: 8-bit positive short immediate value SBRK # k 1 5 1 4 1 3 1 2 1 1 1 0 9876543210 0 1111100 k Execution Increment PC, then ... (current AR) – k → current AR Note that k is an 8-bit positive constant. Status Bits None Descript[...]

  • Page 308

    Set Control Bit SETC 7-155 Assembly Language Instructions Syntax SETC control bit Operands control bit: Select one of the following control bits: C Carry bit of status register ST1 CNF RAM configuration control bit of status register ST1 INTM Interrupt mode bit of status register ST0 OVM Overflow mode bit of status register ST0 SXM Sign-extension m[...]

  • Page 309

    SETC Set Control Bit 7-156 Words 1 Cycles for a Single SETC Instruction ROM DARAM SARAM External 1 1 1 1+p Cycles for a Repeat (RPT) Execution of an SETC Instruction ROM DARAM SARAM External n n n n+p Example SETC TC ;TC is bit 11 of ST1 Before Instruction After Instruction ST1 x1xxh ST1 x9xxh Cycles[...]

  • Page 310

    Shift Accumulator Left SFL 7-157 Assembly Language Instructions Syntax SFL Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 0 0 1 0 0 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then ... (ACC(31)) → C (ACC(30:0)) → ACC(31:1) 0 → ACC(0) Status Bits Affects C This instruction is not affected by SXM. Description The SFL instruction s[...]

  • Page 311

    SFR Shift Accumulator Right 7-158 Syntax SFR Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 0 1 0 0 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then ... If SXM = 0 Then 0 → ACC(31). If SXM = 1 Then (ACC(31)) → ACC(31) (ACC(31:1)) → ACC(30:0) (ACC(0)) → C Status Bits Affected by Affects SXM C Description The SFR instruction s[...]

  • Page 312

    Shift Accumulator Right SFR 7-159 Assembly Language Instructions Example 1 SFR ;(SXM = 0: no sign extension) Before Instruction After Instruction ACC X B0001234h ACC 0 5800091Ah CC Example 2 SFR ;(SXM = 1: sign extend) Before Instruction After Instruction ACC X B0001234h ACC 0 D800091Ah CC[...]

  • Page 313

    SP AC Subtract PREG From Accumulator 7-160 Syntax SP AC Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 0 1 0 0 0 0 0 0 1 1 1 1 1 0 1 Execution Increment PC, then ... (ACC) – shifted (PREG) → ACC Status Bits Affected by Affects PM and OVM C and OV This instruction is not affected by SXM. Description The content of PREG, shifted as [...]

  • Page 314

    Store High PREG SPH 7-161 Assembly Language Instructions Syntax SPH dma Direct addressing SPH ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– SPH dma 1 5 1 4 1 3 1 2 1 1 1 [...]

  • Page 315

    SPH Store High PREG 7-162 Cycles for a Repeat (RPT) Execution of an SPH Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+2 † n+p External 2n+nd 2n+nd 2n+nd 2n+2+nd+p † If the operand and the code are in the same SARAM block Example 1 SPH DAT3 ;(DP = 4: addresses 0200h–027Fh, ;PM = 0: no shift) Before Instruc[...]

  • Page 316

    Store Low PREG SPL 7-163 Assembly Language Instructions Syntax SPL dma Direct addressing SPL ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– SPL dma 1 5 1 4 1 3 1 2 1 1 1 0[...]

  • Page 317

    SPL Store Low PREG 7-164 Cycles for a Repeat (RPT) Execution of an SPL Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+2 † n+p External 2n+nd 2n+nd 2n+nd 2n+2+nd+p † If the operand and the code are in the same SARAM block Example 1 SPL DAT5 ;(DP = 4: addresses 0200h–027Fh, ;PM = 2: left shift of four) Befor[...]

  • Page 318

    Store Long-Immediate V alue to Data Memory SPLK 7-165 Assembly Language Instructions Syntax SPLK # lk , dma Direct addressing SPLK # lk , ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register lk: 16-bit long immediate value ind: Select one of the following sev[...]

  • Page 319

    SPLK Store Long-Immediate V alue to Data Memory 7-166 Example 2 SPLK #1111h,*+,AR4 Before Instruction After Instruction ARP 0 ARP 4 AR0 300h AR0 301h Data Memory Data Memory 300h 07h 300h 1111 h[...]

  • Page 320

    Set PREG Output Shift Mode SPM 7-167 Assembly Language Instructions Syntax SPM constant Operands constant: V alue from 0 to 3 that determines the product shift mode Opcode constant 0 0 0 0 0 0 1 1 1 1 1 1 0 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Execution Increment PC, then ... constant → product shift mode (PM) bits Status Bits Affects PM This [...]

  • Page 321

    SQRA Square V alue and Accumulate Previous Product 7-168 Syntax SQRA dma Direct addressing SQRA ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– SQRA dma 1 5 1 4 1 3 1 2 1 1[...]

  • Page 322

    Square V alue and Accumulate Previous Product SQRA 7-169 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an SQRA Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 SQRA DAT30 ;(DP = [...]

  • Page 323

    SQRS Square V alue and Subtract Previous Product 7-170 Syntax SQRS dma Direct addressing SQRS ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– SQRS dma 1 5 1 4 1 3 1 2 1 1 1[...]

  • Page 324

    Square V alue and Subtract Previous Product SQRS 7-171 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an SQRS Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 SQRS DAT9 ;(DP = 6: [...]

  • Page 325

    SST Store Status Register 7-172 Syntax SST # m , dma Direct addressing SST # m , ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register m: Select one of the following: 0 Indicates that ST0 will be stored 1 Indicates that ST1 will be stored ind: Select one of th[...]

  • Page 326

    Store Status Register SST 7-173 Assembly Language Instructions Status registers ST0 and ST1 are defined in Section 3.5, Status Registers ST0 and ST1 , on page 3-15. Words 1 Cycles for a Single SST Instruction Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 2+d 2+d 2+d 4+d+p † If the operand and the code ar[...]

  • Page 327

    SUB Subtract From Accumulator 7-174 Syntax SUB dma [, shift ] Direct addressing SUB dma , 16 Direct with left shift of 16 SUB ind [, shift [, AR n ] ] Indirect addressing SUB ind , 16 [, AR n ] Indirect with left shift of 16 SUB # k Short immediate SUB # lk [, shift ] Long immediate Operands dma: 7 LSBs of the data-memory address shift: Left shift [...]

  • Page 328

    Subtract From Accumulator SUB 7-175 Assembly Language Instructions Execution Increment PC, then ... Event Addressing mode (ACC) – ((data-memory address) 2 shift ) → ACC Direct or indirect (ACC) – ( (data-memory address) 2 16 ) → ACC Direct or indirect (shift of 16) (ACC) – k → ACC Short immediate (ACC) – lk 2 shift → ACC Long immedi[...]

  • Page 329

    SUB Subtract From Accumulator 7-176 Cycles for a Single SUB Instruction (Using Direct and Indirect Addressing) Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 1+d 1+d 1+d 2+d+p † If the operand and the code are in the same SARAM block. Cycles for a Repeat (RPT) Execution of an SUB Instruction (Using Direct[...]

  • Page 330

    Subtract From Accumulator SUB 7-177 Assembly Language Instructions Before Instruction After Instruction ARP 7 ARP 0 AR7 301h AR7 300h Data Memory Data Memory 301h 04h 301h 04h ACC X 09h ACC 1 01h CC Example 3 SUB #8h ;(SXM = 1: sign-extension mode) Before Instruction After Instruction ACC X 07h ACC 0 FFFFFFFFh CC Example 4 SUB #0FFFh,4 ;(Left shift[...]

  • Page 331

    SUBB Subtract From Accumulator With Borrow 7-178 Syntax SUBB dma Direct addressing SUBB ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– SUBB dma 1 5 1 4 1 3 1 2 1 1 1 0 987[...]

  • Page 332

    Subtract From Accumulator With Borrow SUBB 7-179 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an SUBB Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 SUBB DAT5 ;(DP = 8: addres[...]

  • Page 333

    SUBC Conditional Subtract 7-180 Syntax SUBC dma Direct addressing SUBC ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– SUBC dma 1 5 1 4 1 3 1 2 1 1 1 0 9876543210 0 0001010[...]

  • Page 334

    Conditional Subtract SUBC 7-181 Assembly Language Instructions SUBC af fects OV but is not affected by OVM; therefore, the accumulator does not saturate upon positive or negative overflows when executing this instruc- tion. The carry bit is affected in the normal manner during this instruction: the carry bit is cleared (C = 0) if the result of the [...]

  • Page 335

    SUBS Subtract From Accumulator With Sign Extension Suppressed 7-182 Syntax SUBS dma Direct addressing SUBS ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– SUBS dma 1 5 1 4 [...]

  • Page 336

    Subtract From Accumulator With Sign Extension Suppressed SUBS 7-183 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of an SUBS Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 SUBS DA[...]

  • Page 337

    SUBT Subtract From Accumulator With Shift Specified by TREG 7-184 Syntax SUBT dma Direct addressing SUBT ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– SUBT dma 1 5 1 4 1 [...]

  • Page 338

    Subtract From Accumulator With Shift Specified by TREG SUBT 7-185 Assembly Language Instructions Cycles for a Single SUBT Instruction Program Operand ROM DARAM SARAM External DARAM 1 1 1 1+p SARAM 1 1 1, 2 † 1+p External 1+d 1+d 1+d 2+d+p † If the operand and the code are in the same SARAM block. Cycles for a Repeat (RPT) Execution of an SUBT I[...]

  • Page 339

    TBLR T able Read 7-186 Syntax TBLR dma Direct addressing TBLR ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– TBLR dma 1 5 1 4 1 3 1 2 1 1 1 0 9876543210 1 01001100 dma TBL[...]

  • Page 340

    T able Read TBLR 7-187 Assembly Language Instructions Cycles Cycles for a Single TBLR Instruction Program Operand ROM DARAM SARAM External Source: DARAM/ROM Destination: DARAM 3 3 3 3+p code Source: SARAM Destination: DARAM 3 3 3 3+p code Source: External Destination: DARAM 3+p src 3+p src 3+p src 3+p src +p code Source: DARAM/ROM Destination: SARA[...]

  • Page 341

    TBLR T able Read 7-188 Cycles for a Repeat (RPT) Execution of a TBLR Instruction (Continued) Program Operand ROM DARAM SARAM External Source: DARAM/ROM Destination: SARAM n+2 n+2 n+2 n+4 † n+2+p code Source: SARAM Destination: SARAM n+2 2n ‡ n+2 2n ‡ n+2 2n ‡ 2n+2 § n+2+p code 2n ‡ Source: External Destination: SARAM n+2+np src n+2+np sr[...]

  • Page 342

    T able Write TBL W 7-189 Assembly Language Instructions Syntax TBL W dma Direct addressing TBL W ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– TBL W dma 1 5 1 4 1 3 1 2 1[...]

  • Page 343

    TBL W T able Write 7-190 Cycles Cycles for a Single TBL W Instruction Program Operand ROM DARAM SARAM External Source: DARAM/ROM Destination: DARAM 3 3 3 3+p code Source: SARAM Destination: DARAM 3 3 3 3+p code Source: External Destination: DARAM 3+d src 3+d src 3+d src 3+d src +p code Source: DARAM/ROM Destination: SARAM 33 3 4 † 3+p code Source[...]

  • Page 344

    T able Write TBL W 7-191 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of a TBL W Instruction (Continued) Program Operand ROM DARAM SARAM External Source: DARAM/ROM Destination: SARAM n+2 n+2 n+2 n+3 † n+2+p code Source: SARAM Destination: SARAM n+2 2n ‡ n+2 2n ‡ n+2 2n ‡ 2n+1 § n+2+p code 2n ‡ Source: External Desti[...]

  • Page 345

    TRAP Software Interrupt 7-192 Syntax TRAP Operands None Opcode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 0 0 0 1 0 1 0 0 1 1 1 1 1 0 1 Execution (PC) + 1 → stack 22h → PC Status Bits Not affected by INTM; does not affect INTM. Description The TRAP instruction is a software interrupt that transfers program control to program-memory location 22h an[...]

  • Page 346

    Exclusive OR With Accumulator XOR 7-193 Assembly Language Instructions Syntax XOR dma Direct addressing XOR ind [, AR n ] Indirect addressing XOR # lk , [, shift ] Long immediate addressing XOR # lk, 16 Long immediate with left shift of 16 Operands dma: 7 LSBs of the data-memory address shift: Left shift value from 0 to 15 (defaults to 0) n: V alue[...]

  • Page 347

    XOR Exclusive OR With Accumulator 7-194 Status Bits None Description With direct or indirect addressing, the low half of the accumulator value is exclusive ORed with the content of the addressed data memory location, and the result replaces the low half of the accumulator value; the upper half of the accumulator value is unaffected. With immediate [...]

  • Page 348

    Exclusive OR With Accumulator XOR 7-195 Assembly Language Instructions Example 1 XOR DAT127 ;(DP = 511: addresses FF80h–FFFFh) Before Instruction After Instruction Data Memory Data Memory 0FFFFh 0F0F0h 0FFFFh 0F0F0h ACC X 12345678h ACC X 1234A688h CC Example 2 XOR *+,AR0 Before Instruction After Instruction ARP 7 ARP 0 AR7 300h AR7 301h Data Memo[...]

  • Page 349

    ZALR Zero Low Accumulator and Load High Accumulator With Rounding 7-196 Syntax ZALR dma Direct addressing ZALR ind [, AR n ] Indirect addressing Operands dma: 7 LSBs of the data-memory address n: V alue from 0 to 7 designating the next auxiliary register ind: Select one of the following seven options: * *+ *– *0+ *0– *BR0+ *BR0– ZALR dma 1 5 [...]

  • Page 350

    Zero Low Accumulator and Load High Accumulator With Rounding ZALR 7-197 Assembly Language Instructions Cycles for a Repeat (RPT) Execution of a ZALR Instruction Program Operand ROM DARAM SARAM External DARAM n n n n+p SARAM n n n, n+1 † n+p External n+nd n+nd n+nd n+1+p+nd † If the operand and the code are in the same SARAM block Example 1 ZALR[...]

  • Page 351

    8-1 On-Chip Peripherals On-Chip Peripherals This chapter discusses on-chip peripherals connected to the ’C2xx CPU and their control registers. The on-chip peripherals are controlled through memory-mapped registers. The operations of the timer and the serial ports are synchronized to the processor through interrupts and interrupt polling. The ’C[...]

  • Page 352

    Control of On-Chip Peripherals 8-2 8.1 Control of On-Chip Peripherals The on-chip peripherals are controlled by accessing control registers that are mapped to on-chip I/O space. Data is also transferred to and from the peripher- als through these registers. Setting and clearing bits in these registers can en- able, disable, initialize, and dynamica[...]

  • Page 353

    Control of On-Chip Peripherals 8-3 On-Chip Peripherals T able 8–1. Peripheral Register Locations and Reset Conditions (Continued) Register Name I/O Address Register Name Effects at Reset Reset V alue Other ’C2xx ’C209 IOSR – FFF6h 18xxh I/O status register . Auto-baud alignment is disabled. Error and status flags are reset. The lower eight [...]

  • Page 354

    Clock Generator 8-4 8.2 Clock Generator The high pulse of the master clock output signal (CLKOUT1) signifies the logic phase of the device (the phase when values are changed), while the low pulse signifies the latch phase (the phase when values are latched). CLKOUT1 de- termines much of the device’s operational speed. For example: The timer clock[...]

  • Page 355

    Clock Generator 8-5 On-Chip Peripherals External Oscillator . CLKIN is the output of an external oscillator , which is connected to the CLKIN/X2 pin. The X1 pin must be left unconnected. See Figure 8–2. Figure 8–2. Using an External Oscillator ’C2xx X1 CLKIN/X2 No connection Oscillator Regardless of the method used to generate CLKOUT1, CLKOUT[...]

  • Page 356

    Clock Generator 8-6 T able 8–2. ’C2xx Input Clock Modes Clock Mode CLKOUT1 Rate DIV2 DIV1 External CLKIN Source? Internal Oscillator Internal PLL ÷ 2 CLKOUT1 = CLKIN ÷ 2 0 0 No Enabled Disabled Ye s Disabled Disabled × 1 CLKOUT1 = CLKIN × 1 0 1 Required Disabled Enabled × 2 CLKOUT1 = CLKIN × 2 1 0 Required Disabled Enabled × 4 CLKOUT1 = [...]

  • Page 357

    CLKOUT1-Pin Control (CLK) Register 8-7 On-Chip Peripherals 8.3 CLKOUT1-Pin Control (CLK) Register Y ou can use bit 0 of the CLK register to turn of f the pin for the master clock out- put signal (CLKOUT1). The CLK register is located at address FFE8h in I/O space and has the organization shown in Figure 8–3. Figure 8–3. ’C2xx CLK Register —[...]

  • Page 358

    Timer 8-8 8.4 Timer The ’C2xx features an on-chip timer with a 4-bit prescaler . This timer is a down counter that can be stopped, restarted, reset, or disabled by specific status bits. Y ou can use the timer to generate periodic CPU interrupts. Figure 8–4 shows a functional block diagram of the timer . There is a 16-bit main counter (TIM) and [...]

  • Page 359

    Timer 8-9 On-Chip Peripherals The TINT request automatically sets the TINT flag bit in the interrupt flag regis- ter (IFR). Y ou can mask or unmask the request with the interrupt mask register (IMR). If you are not using the timer , mask TINT so that it does not cause an unexpected interrupt. 8.4.1 Timer Operation Here is a typical sequence of even[...]

  • Page 360

    Timer 8-10 sor v are the TIM and PRD, respectively . Both are16-bit registers mapped to I/O space. The 4-bit TDDR (timer divide-down register) and the 4-bit PSC (prescaler counter) are contained in the timer control register (TCR) described in subsec- tion 8.4.2. The TIM (timer counter register) and the PRD (timer period register) are 16-bit regist[...]

  • Page 361

    Timer 8-1 1 On-Chip Peripherals Figure 8–5. ’C2xx Timer Control Register (TCR) — I/O-Space Address FFF8h 15 12 11 10 96 5 4 30 Reserved FREE SOFT PSC TRB TSS TDDR 0 R/W–0 R/W–0 R/W–0 R/W–0 W–0 R/W–0 Note: 0 = Always read as zeros; R = Read access; W = Write access; value following dash (–) is value after reset. Bits 15–12 Rese[...]

  • Page 362

    Timer 8-12 Bit 4 TSS — Timer stop status bit. TSS stops or starts the timer . At reset, TSS is cleared to 0 and the timer immediately starts. TSS = 0 Starts or restarts the timer . TSS = 1 Stops the timer . Bits 3–0 TDDR — T imer divide-down register . Every (TDDR + 1) CLKOUT1 cycles, the timer counter register (TIM) decrements by one. At res[...]

  • Page 363

    Timer 8-13 On-Chip Peripherals 8.4.4 Setting the T imer Interrupt Rate When the divide-down value (TDDR) is 0, you can program the timer to gener- ate an interrupt (TINT) every 2 to 65 536 cycles by programming the period register (PRD) from 0 to 65 535 (FFFFh). When TDDR is nonzero (1 to 15), the timer interrupt rate decreases. If TDDR, PRD, or bo[...]

  • Page 364

    Wait-State Generator 8-14 8.5 W ait-State Generator W ait states are necessary when you want to interface the ’C2xx with slower external logic and memory . By adding wait states, you lengthen the time the CPU waits for external memory or an external I/O port to respond when the CPU reads from or writes to that memory or port. Specifically , the C[...]

  • Page 365

    Wait-State Generator 8-15 On-Chip Peripherals state generator , see subsection 1 1.4.3 on page 1 1-16. T o avoid bus conflicts, all writes to external addresses take at least two cycles. Figure 8–6. ’C2xx Wait-State Generator Control Register (WSGR) — I/O-Space Address FFFCh 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Reserved ISWS DSWS PSUWS PSL W[...]

  • Page 366

    Wait-State Generator 8-16 T able 8–4 shows how to set the number of wait states you want for each type of off-chip memory . For example, if you write 1s to bits 0 through 5, the device will generate seven wait states for off-chip lower program memory and seven wait states for off-chip upper program memory . T able 8–4. Setting the Number of Wai[...]

  • Page 367

    General-Purpose I/O Pins 8-17 On-Chip Peripherals 8.6 General-Purpose I/O Pins The ’C2xx provides pins that can be used to supply input signals from an exter- nal device or output signals to an external device. These pins are not bound to specific uses; rather , they can provide input or output signals for a great vari- ety purposes. Y ou have ac[...]

  • Page 368

    General-Purpose I/O Pins 8-18 Figure 8–7. BIO Timing Diagram Example BIO CLKOUT1 1 CLKOUT1 cycle 8.6.2 Output Pin XF The XF pin is the external flag output pin. If you connect XF to an input pin of another processor , you can use XF as a signal to other processor . The most recent XF value is latched in the ’C2xx, and that value is indicated by[...]

  • Page 369

    9-1 Synchronous Serial Port Synchronous Serial Port The ’C2xx devices have a synchronous serial port that provides direct communication with serial devices such as codecs (coder/decoders) and serial A/D converters. The serial port may also be used for intercommunication between processors in multiprocessing applications. The synchronous serial po[...]

  • Page 370

    Overview of the Synchronous Serial Port 9-2 9.1 Overview of the Synchronous Serial Port Both receive and transmit operations of the synchronous serial port have a four-word-deep first-in, first-out (FIFO) buffer . The FIFO buf fers reduce the amount of CPU overhead inherent in servicing transmit or receive data by re- ducing the number of transmit [...]

  • Page 371

    Components and Basic Operation 9-3 Synchronous Serial Port 9.2 Components and Basic Operation The synchronous serial port has several hard-wired parts, including two FIFO buffers and six signal pins. Figure 9–1 shows how the components of the syn- chronous serial port are interconnected. Figure 9–1. Synchronous Serial Port Block Diagram SDTR tr[...]

  • Page 372

    Components and Basic Operation 9-4 Data signal. The data signal carries the actual data that is transferred in the transmit/receive operation. The data signal transmit pin (DX) of one device should be connected to the data signal receive (DR) pin on another device. T able 9–1 describes the six pins that use these signals. T able 9–1. SSP Interf[...]

  • Page 373

    Components and Basic Operation 9-5 Synchronous Serial Port Figure 9–2. 2-Way Serial Port T ransfer With External Frame Sync and External Clock TMS320C203 TLC320AD55C Analog signal A/D D/A Analog signal DR DX CLKX CLKR FSX FSR D OUT D IN SCK FS Legend: D OUT T ransmit data DR Receive data D IN Receive data DX T ransmit data SCK Clock source CLKX T[...]

  • Page 374

    Components and Basic Operation 9-6 9.2.3 Interrupts The synchronous serial port (SSP) has two hardware interrupts that let the pro- cessor know when the FIFO buffers need to be serviced: T ransmit interrupts (XINT s) cause a branch to address 000Ah in program space whenever the transmit-interrupt trigger condition is met. Set the trig- ger conditio[...]

  • Page 375

    Components and Basic Operation 9-7 Synchronous Serial Port Receiving a word through the serial port typically is done as follows: 1) Data from the DR pin is shifted, bit-by-bit (MSB first), into the receive shift register (RSR). 2) When the RSR is full, the RSR copies the data to the receive FIFO buffer . 3) The process then does one of two things,[...]

  • Page 376

    Controlling and Resetting the Port 9-8 9.3 Controlling and Resetting the Port The synchronous serial port control register (SSPCR) controls the operation of the synchronous serial port. T o configure the serial port, a total of two writes to the SSPCR are necessary: 1) Write your choices to the configuration bits and place the port in reset by writ[...]

  • Page 377

    Controlling and Resetting the Port 9-9 Synchronous Serial Port T able 9–2. Run and Emulation Modes FREE SOFT Run/Emulation Mode 0 0 Immediate stop 0 1 Stop after completion of word 1 0 Free run 1 1 Free run Note: If an option besides immediate stop is chosen for the receiver , an overflow error is possible. The default mode (selected at reset) is[...]

  • Page 378

    Controlling and Resetting the Port 9-10 Bits 9–8 FR1, FR0 — FIFO receive-interrupt bits. The values you write to FR0 and FR1 set an interrupt trigger condition based on the contents of the receive FIFO buffer . When this condition is met, a receive interrupt (RINT) is gener- ated and the data can be transferred in from the FIFO buffer using the[...]

  • Page 379

    Controlling and Resetting the Port 9-1 1 Synchronous Serial Port Bit 3 TXM — T ransmit mode. This bit determines the source device for the frame synchronization (frame sync) pulse for transmissions. It configures the transmit frame sync pin (FSX) as an output or as in input. Note that the receive frame sync pin (FSR) is always configured as an in[...]

  • Page 380

    Controlling and Resetting the Port 9-12 Bit 0 DLB — Digital loopback mode. The DLB bit can be used to put the serial port in digital loopback mode. DLB = 0 Digital loopback mode is disabled. The DR, FSR, and CLKR signals are connected to their respective device pins. DLB = 1 Digital loopback mode is enabled. DR and FSR become inter- nally connect[...]

  • Page 381

    Controlling and Resetting the Port 9-13 Synchronous Serial Port A transmit frame sync pulse marks the start of a data transmission. The syn- chronous serial port can transmit using the internal frame sync source or using an external source: T o use internal frame sync pulses , set the TXM bit in the SSPCR to 1. T o use external frame sync pulses : [...]

  • Page 382

    Controlling and Resetting the Port 9-14 1) Create interrupt service routines for XINT s and RINT s and include a branch to each service routine at the appropriate interrupt vector address: The RINT vector is fetched from address 0008h. The XINT vector is fetched from address 000Ah. 2) Select when you want interrupts to occur and set the FR0, FR1, F[...]

  • Page 383

    Managing the Contents of the FIFO Buffers 9-15 Synchronous Serial Port 9.4 Managing the Contents of the FIFO Buffers The SDTR is a read/write register (at I/O address FFF0h) that is used to send data to the transmit FIFO buffer and to extract data from the receive FIFO buffer . A word is written to the SDTR by the OUT instruction. When the transmit[...]

  • Page 384

    T ransmitter Operation 9-16 9.5 T ransmitter Operation T ransmitter operation is different in continuous and burst modes. Other differ- ences also depend on whether an internal or an external frame sync is used. 9.5.1 Burst Mode T ransmission With Internal Frame Sync (FSM = 1, TXM = 1) Use burst mode transmission with internal frame sync to transfe[...]

  • Page 385

    T ransmitter Operation 9-17 Synchronous Serial Port If the SDTR is loaded with a new word while the transmit FIFO buffer is full, the new word will be lost; the FIFO buffer will not accept any more than four words. The burst mode can be discontinued (changed to continuous mode) only by a serial-port or device reset. Changing the FSM bit during tran[...]

  • Page 386

    T ransmitter Operation 9-18 9.5.2 Burst Mode T ransmission With External Frame Sync (FSM = 1, TXM = 0) Use burst mode transmission with external frame sync to transfer short pack- ets at rates lower than maximum packet frequency while using an external frame sync generator . Place the transmitter in burst mode with external frame sync by setting th[...]

  • Page 387

    T ransmitter Operation 9-19 Synchronous Serial Port Figure 9–5. Burst Mode T ransmission With External Frame Sync FSX CLKX DX XINT A15 MSB A14 A13 A12 A1 1 A10 ... A0 B15 LSB XSR loaded from buffer XSR loaded from buffer[...]

  • Page 388

    T ransmitter Operation 9-20 9.5.3 Continuous Mode T ransmission With Internal Frame Sync (FSM = 0, TXM = 1) Use continuous mode transmission with internal frame sync to transfer long packets at maximum packet frequency while using an internal frame sync gen- erator . Place the transmitter in continuous mode with internal frame sync by setting the F[...]

  • Page 389

    T ransmitter Operation 9-21 Synchronous Serial Port If the SDTR is loaded with a new word while the transmit FIFO buffer is full, the new word will be lost; the FIFO buffer will not accept any more than four words. Continuous mode can be discontinued (changed to burst mode) only by a seri- al-port or device reset. Changing the FSM bit during transm[...]

  • Page 390

    T ransmitter Operation 9-22 9.5.4 Continuous Mode T ransmission with External Frame Sync (FSM=0, TXM=0) Use continuous mode transmission with external frame sync to transfer long packets at maximum packet frequency while using an external frame sync generator . Place the transmitter in continuous mode with external frame sync by setting the FSM bit[...]

  • Page 391

    T ransmitter Operation 9-23 Synchronous Serial Port The continuous mode can be discontinued (changed to burst mode) only by a serial-port or device reset. Changing the FSM bit during transmit or halt will not necessarily cause a switch to burst mode. Figure 9–7. Continuous Mode T ransmission With External Frame Sync B15 FSX CLKX DX XINT A15 MSB A[...]

  • Page 392

    Receiver Operation 9-24 9.6 Receiver Operation Receiver operation is different in continuous and burst modes. The receiver does not generate frame sync pulses; it always takes the frame sync pulse as an input. In selecting the proper receive mode, note that the mode for the receiver must match the mode for the transmitter . If all four words of the[...]

  • Page 393

    Receiver Operation 9-25 Synchronous Serial Port If a frame sync pulse occurs during reception, reception is restarted, and the bits that were shifted into the RSR before the pulse are lost. Figure 9–8. Burst Mode Reception CLKR FSR DR RINT A15 MSB A14 A13 A12 A1 1 A10 ... A0 B15 LSB Word loaded to buffer from RSR B14 MSB 9.6.2 Continuous Mode Rec[...]

  • Page 394

    Receiver Operation 9-26 3) The remaining bits in the word are then shifted into the RSR, one by one at the falling edge of each consecutive clock cycle. 4) After all bits have been received, if the FIFO buffer is not full, the contents of the RSR are copied to the receive FIFO buffer . If the receive FIFO buf fer does become full, an interrupt (RIN[...]

  • Page 395

    T roubleshooting 9-27 Synchronous Serial Port 9.7 T roubleshooting The synchronous serial port uses three bits for troubleshooting and testing. In addition to using these three bits, you must be able to identify special error conditions that may occur in actual transfers. Error conditions result from an unprogrammed event occurring to the serial po[...]

  • Page 396

    T roubleshooting 9-28 T able 9–6. Run and Emulation Modes FREE SOFT Run/Emulation Mode 0 0 Immediate stop 0 1 Stop after completion of word 1 0 Free run 1 1 Free run Note: If an option besides immediate stop is chosen for the receiver , an overflow error is possible. The default mode (selected at reset) is immediate stop. DLB enables or disables [...]

  • Page 397

    T roubleshooting 9-29 Synchronous Serial Port 9.7.2 Burst Mode Error Conditions The following are descriptions of errors that can occur in burst mode: Underflow . Underflow is caused if an external FSX occurs, and there are no new words in the transmit FIFO buffer . Upon receiving the FSX (gener- ally , from an external clock source), transmitter r[...]

  • Page 398

    T roubleshooting 9-30 Overflow . Overflow occurs when the RSR has new data to pass to the receive FIFO buffer but the FIFO buf fer is full. Overflow errors are fatal to a reception. For as long as the FIFO buffer is full, any incoming words will be lost. T o restart reception, make space in the buffer by reading from it (through the SDTR). Frame sy[...]

  • Page 399

    10-1 Asynchronous Serial Port Asynchronous Serial Port The ’C2xx has an asynchronous serial port that can be used to transfer data to and from other devices. The port has several important features: Full-duplex transmit and receive operations at the maximum transfer rate Data-word length of eight bits for both transmit and receive Capability for [...]

  • Page 400

    Overview of the Asynchronous Serial Port 10-2 10.1 Overview of the Asynchronous Serial Port The on-chip asynchronous serial port (ASP) provides easy serial data commu- nication between host CPUs and the ’C2xx or between two ’C2xx devices. The asynchronous mode of data communication is often referred to as UART (uni- versal asynchronous receive [...]

  • Page 401

    Components and Basic Operation 10-3 Asynchronous Serial Port 10.2 Components and Basic Operation Figure 10–1 shows the main components of the asynchronous serial port. Figure 10–1. Asynchronous Serial Port Block Diagram TXRXINT ADTR ARSR ADTR AXSR Control logic (transmit) Control logic (receive) TX Baud-rate generator Sequence control Sequence [...]

  • Page 402

    Components and Basic Operation 10-4 T able 10–1. Asynchronous Serial Port Interface Pins Pin Name Description TX Asynchronous serial port data transmit pin. T ransmits serial data from the asynchronous serial port transmit shift register (AXSR). RX Asynchronous serial port data receive pin. Receives serial data into the asynchronous serial port r[...]

  • Page 403

    Components and Basic Operation 10-5 Asynchronous Serial Port I/O status register (IOSR). Bits in the IOSR indicate detection of the in- coming baud rate, various error conditions, the status of data transfers, detection of a break on the RX pin, the status of pins IO3–IO0, and detec- tion of changes on pins IO3–IO0. The IOSR is at address FFF6h[...]

  • Page 404

    Components and Basic Operation 10-6 10.2.5 Basic Operation Figure 10–2 shows a typical serial link between a ’C2xx device and any host CPU. In this mode of communication, any 8-bit character can be transmitted or received serially by way of the transmit data pin (TX) or the receive data pin (RX), respectively . The data transmitted or received [...]

  • Page 405

    Controlling and Resetting the Port 10-7 Asynchronous Serial Port 10.3 Controlling and Resetting the Port The asynchronous serial port is programmed through three on-chip registers mapped to I/O space: the asynchronous serial port control register (ASPCR), the I/O status register (IOSR), and the baud-rate divisor register (BRD). This section describ[...]

  • Page 406

    Controlling and Resetting the Port 10-8 Bits 12–10 Reserved. Always read as 0s. Bit 9 DIM — Delta interrupt mask. DIM selects whether or not delta interrupts are asserted on the TXRXINT interrupt line. A delta interrupt is generated by a change on one of the general-purpose I/O pins (IO3, IO2, IO1, or IO0). DIM = 0 Disables delta interrupts. DI[...]

  • Page 407

    Controlling and Resetting the Port 10-9 Asynchronous Serial Port Bit 3 CIO3 — Configuration bit for IO3. CIO3 configures I/O pin 3 (IO3) as an input or as an output. CIO3 = 0 IO3 is configured as an input. This is the default value at re- set. CIO3 = 1 IO3 is configured as an output. Bit 2 CIO2 — Configuration bit for IO2. CIO2 configures I/O p[...]

  • Page 408

    Controlling and Resetting the Port 10-10 10.3.2 I/O Status Register (IOSR) The IOSR returns the status of the asynchronous serial port and of I/O pins IO0–IO3. The IOSR is a 16-bit, on-chip register mapped to address FFF6h in I/O space. Figure 10–4 shows the fields in the IOSR, and bit descriptions fol- low the figure. Figure 10–4. I/O Status[...]

  • Page 409

    Controlling and Resetting the Port 10-1 1 Asynchronous Serial Port Bit 1 1 THRE — T ransmit register (ADTR) empty indicator . THRE is set to 1 when the contents of the transmit register (ADTR) are transferred to the transmit shift register (AXSR). THRE is reset to 0 by the loading of the trans- mit register with a new character . A device reset s[...]

  • Page 410

    Controlling and Resetting the Port 10-12 Bit 7 DIO3 — Change detect bit for IO3. DIO3 indicates whether a change has occurred on the IO3 pin. A change can be detected only when IO3 is config- ured as an input by the CIO3 bit of the ASPCR (CIO3 = 0) and the serial port is enabled by the URST bit of the ASPCR (URST = 1). Writing a 1 to DIO3 clears [...]

  • Page 411

    Controlling and Resetting the Port 10-13 Asynchronous Serial Port Bit 3 IO3 — Status bit for IO3. When the IO3 pin is configured as an input (by the CIO3 bit of the ASPCR), this bit reflects the current level on the IO3 pin. IO3 = 0 The IO3 signal is low . IO3 = 1 The IO3 signal is high. Bit 2 IO2 — Status bit for IO2. When the IO2 pin is confi[...]

  • Page 412

    Controlling and Resetting the Port 10-14 T able 10–2. Common Baud Rates and the Corresponding BRD V alues BRD V alue in Hexadecimal Baud Rate CLKOUT1 = 20 MHz (50 ns) CLKOUT1 = 28.57 MHz (35 ns) CLKOUT1 = 40 MHz (25 ns) 1200 041 1 05CC 0823 2400 0208 02E6 041 1 4800 0104 0173 0208 9600 0082 00B9 0104 19200 0041 005C 0082 10.3.4 Using Automatic Ba[...]

  • Page 413

    Controlling and Resetting the Port 10-15 Asynchronous Serial Port 10.3.5 Using I/O Pins IO3, IO2, IO1, and IO0 Pins IO3, IO2, IO1, and IO0 can be individually configured as inputs or outputs and can be used as handshake control for the asynchronous serial port or as general-purpose I/O pins. They are software-controlled through the asynchro- nous s[...]

  • Page 414

    Controlling and Resetting the Port 10-16 When pins IO0–IO3 are configured as inputs When pins IO0–IO3 are configured as inputs, the eight LSBs of the IOSR allow you to monitor these four pins. Each of the IOSR bits 3–0, called IO3, IO2, IO1, and IO0, can be used to read the current logic level (high or low) of the signal at the corresponding [...]

  • Page 415

    Controlling and Resetting the Port 10-17 Asynchronous Serial Port 10.3.6 Using Interrupts The asynchronous serial port interrupt (TXRXINT) can be generated by three types of interrupts: T ransmit interrupts. A transmit interrupt is generated when the ADTR empties during transmission. This indicates that the port is ready to accept a new transmit ch[...]

  • Page 416

    Controlling and Resetting the Port 10-18 TXRXINT leads the CPU to interrupt vector location 000Ch in program memory . The branch at that location should lead to an interrupt service routine that identifies the cause of the interrupt and then acts accordingly . TXRXINT has a priority level of 9 (1 being highest). TXRXINT is a maskable interrupt and [...]

  • Page 417

    T ransmitter Operation 10-19 Asynchronous Serial Port 10.4 T ransmitter Operation The transmitter consists of an 8-bit transmit register (ADTR) and an 8-bit trans- mit shift register (AXSR). Data to be transmitted is written to the ADTR, and then the port transfers the data to the AXSR. Data written to the transmit regis- ter should be written in r[...]

  • Page 418

    Receiver Operation 10-20 10.5 Receiver Operation The receiver includes two internal 8-bit registers: the receive register (ADTR) and receive shift register (ARSR). The data received at the RX pin should have the serial form shown in Figure 10–7 (the number of stop bits required de- pends on the value of the STB bit in the ASPCR). Figure 10–7. D[...]

  • Page 419

    1 1-1 TMS320C209 All ’C2xx devices use the same central processing unit (CPU), bus structure, and instruction set, but the ’C209 has some notable differences. This chapter compares features on the ’C209 with those on other ’C2xx devices and then provides information specific to the ’C209 in the areas of memory and I/O spaces, interrupts, [...]

  • Page 420

    ’C209 V ersus Other ’C2xx Devices 1 1-2 1 1.1 ’C209 V ersus Other ’C2xx Devices This section explains the differences between the ’C209 and other ’C2xx de- vices and concludes with a table to help you find the other information in this manual that applies to the ’C209. 1 1.1.1 What Is the Same The following components and features are[...]

  • Page 421

    ’C209 V ersus Other ’C2xx Devices 1 1-3 TMS320C209 Memory and I/O Spaces: The I/O addresses of the peripheral registers are different on the ’C209. The ’C209 does not support the ’C2xx HOLD operation. Interrupts: The ’C209 has four maskable interrupt lines, none of them shared. The other devices have six interrupt lines, one shared by t[...]

  • Page 422

    ’C209 V ersus Other ’C2xx Devices 1 1-4 For information about: Look here: Interrupts Main description Chapter 5, Program Control V ector locations T able 1 1–4 (page 1 1-10) Flag and mask registers Subsection 1 1.3.1 (page 1 1-1 1) Interrupt acknowledge pin Subsection 1 1.3.2 (page 1 1-13) Memory Main description Chapter 4, Memory Address map[...]

  • Page 423

    ’C209 Memory and I/O Spaces 1 1-5 TMS320C209 1 1.2 ’C209 Memory and I/O Spaces The ’C209 does not have an on-chip boot loader and does not support the ’C2xx HOLD operation. Figure 1 1–1 shows the ’C209 address map. The on- chip program and data memory available on the ’C209 consists of: ROM (4K words, for program memory) SARAM (4K wor[...]

  • Page 424

    ’C209 Memory and I/O Spaces 1 1-6 Figure 1 1–1. ’C209 Address Maps ’C209 Program ’C209 Data FFFFh 2000h 1FFFh 1000h 0FFFh 0800h 0400h 03FFh 0300h 02FFh 0200h 01FFh 0080h 007Fh 0060h 005Fh 0000h External (local and/or global) (RAMEN = 0) External (RAMEN = 1); On-chip SARAM (RAMEN = 1) Reserved (RAMEN = 0); External DARAM B1 § On-chip Rese[...]

  • Page 425

    ’C209 Memory and I/O Spaces 1 1-7 TMS320C209 Do Not Write to Reserved Addresses T o avoid unpredictable operation of the processor , do not write to any addresses labeled Reserved. This includes any data-memory address in the range 0000h–005Fh that is not designated for an on-chip register and any I/O address in the range FF00h–FFFFh that is [...]

  • Page 426

    ’C209 Memory and I/O Spaces 1 1-8 (4K) are mapped to external data memory . Thus, a total of 8K additional addresses (4K program and 4K data) are available for external memory . DARAM blocks B1 and B2 are fixed, but DARAM block B0 may be mapped to program space or data space, depending on the value of the CNF bit (bit 12 of status register ST1): [...]

  • Page 427

    ’C209 Memory and I/O Spaces 1 1-9 TMS320C209 T able 1 1–2. ’C209 Data-Memory Configuration Options RAMEN CNF DARAM B0 (hex) DARAM B1 (hex) DARAM B2 (hex) SARAM (hex) External (hex) Reserved (hex) 0 0 0200–02FF 0300–03FF 0060–007F – 0800–FFFF 0000–005F 0080–01FF 0400–07FF 0 1 – 0300–03FF 0060–007F – 0800–FFFF 0000–0[...]

  • Page 428

    ’C209 Interrupts 1 1-10 1 1.3 ’C209 Interrupts T able 1 1–4 lists the interrupts available on the ’C209 and shows their vector locations. In addition, it shows the priority of each of the hardware interrupts. Note that a device reset can be initiated in either of two ways: by driving the RS pin low or by driving the RS pin high. The K value[...]

  • Page 429

    ’C209 Interrupts 1 1-1 1 TMS320C209 T able 1 1–4. ’C209 Interrupt Locations and Priorities (Continued) K † V ector Location Name Priority Function 15 1Eh INT15 – User-defined software interrupt 16 20h INT16 – User-defined software interrupt 17 22h TRAP – TRAP instruction vector 18 24h NMI 3 Nonmaskable interrupt 19 26h 2 Reserved 20 2[...]

  • Page 430

    ’C209 Interrupts 1 1-12 Figure 1 1–2. ’C209 Interrupt Flag Register (IFR) — Data-Memory Address 0006h 15 4 3 2 1 0 Reserved TINT INT3 INT2 INT1 0 R/W1C–0 R/W1C–0 R/W1C–0 R/W1C–0 Note: 0 = Always read as zeros; R = Read access; W1C = Write 1 to this bit to clear it to 0; value following dash (–) is value after reset. Bits 15–4 Re[...]

  • Page 431

    ’C209 Interrupts 1 1-13 TMS320C209 Figure 1 1–3. ’C209 Interrupt Mask Register (IMR) — Data-Memory Address 0004h 15 4 3 2 1 0 Reserved TINT INT3 INT2 INT1 0 R/W–0 R/W–0 R/W–0 R/W–0 Note: Note: 0 = Always read as zeros; R = Read access; W = Write access; value following dash (–) is value after reset. Bits 15–4 Reserved. Bits 15?[...]

  • Page 432

    ’C209 On-Chip Peripherals 1 1-14 1 1.4 ’C209 On-Chip Peripherals The ’C209 has these on-chip peripherals: Clock generator . The clock generator is fundamentally the same on all ’C2xx devices, including the ’C209. However , the ’C209 is limited to the two clock modes described in subsection 1 1.4.1. Timer . The timer is also fundamentall[...]

  • Page 433

    ’C209 On-Chip Peripherals 1 1-15 TMS320C209 T able 1 1–5. ’C209 Input Clock Modes Clock Mode CLKOUT1 Rate CLKMOD Oscillator PLL ÷ 2 CLKOUT1 = CLKIN ÷ 2 0 Enabled Disabled × 2 CLKOUT1 = CLKIN × 2 1 Disabled Enabled Remember the following points when configuring the clock mode: The modes cannot be configured dynamically . After you change t[...]

  • Page 434

    ’C209 On-Chip Peripherals 1 1-16 Bit 4 TSS — Timer stop status bit. TSS is a 1-bit flag that stops or starts the timer . T o stop the timer , set TSS to 1. T o start or restart the timer , set TSS to 0. At reset, TSS is cleared to 0 and the timer immediately starts. Bits 3–0 TDDR —Timer divide-down register . Every (TDDR + 1) CLKOUT1 cycles[...]

  • Page 435

    ’C209 On-Chip Peripherals 1 1-17 TMS320C209 Figure 1 1–5. ’C209 Wait-State Generator Control Register (WSGR) — I/O Address FFFFh 15–4 3 2 1 0 Reserved A VIS ISWS DSWS PSWS 0 W–1 W–1 W–1 W–1 Note: 0 = Always read as zeros; W = Write access; value following dash (–) is value after reset. Bits 15–4 Reserved. Bits 15–4 are reser[...]

  • Page 436

    A-1 Appendix A Register Summary For the status and control registers of the ’C2xx devices, this appendix summarizes: Their addresses Their reset values The functions of their bits T opic Page A.1 Addresses and Reset V alues A-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2 Register Descriptions A-4 . . . . . . . . . . [...]

  • Page 437

    Addresses and Reset V alues A-2 A.1 Addresses and Reset V alues The following tables list the ’C2xx registers, the addresses at which they can be accessed, and their reset values. Note that the registers mapped to internal I/O space on the ’C209 are at addresses different from those of other ’C2xx devices. In addition, the ’C209 wait-state [...]

  • Page 438

    Addresses and Reset V alues A-3 Register Summary T able A–3. Addresses and Reset V alues of On-Chip Registers Mapped to I/O Space (Continued) I/O Address Name Description Reset V alue Other ’C2xx ’C209 IOSR – FFF6h 18xxh I/O status register BRD – FFF7h 0001h Baud-rate divisor register TCR FFFCh FFF8h 0000h T imer control register PRD FFFD[...]

  • Page 439

    Register Descriptions A-4 A.2 Register Descriptions The following figures summarize the content of the ’C2xx status and control registers that are divided into fields. (The other registers contain no control bits; they simply hold a single 16-bit value.) Each figure in this section provides information in this way: The value shown in the register[...]

  • Page 440

    Register Descriptions A-5 Register Summary Status Register ST0 15 14 13 12 1 1 10 9 8 7 6 5 4 3 2 1 0 X X X 0 X 1 † 1 X X X X X X X X X ARP OV OVM INTM DP All unmasked interrupts enabled All unmasked interrupts disabled 0 1 Auxiliary register pointer Selects the current page (0, 1, 2, ..., 51 1) in data memory Data page pointer R/W R/W R/W Select[...]

  • Page 441

    Register Descriptions A-6 ’C2xx Interrupt Flag Register (IFR) — Except ’C209 — Data-Memory Address 0006h 15 6 5 4 3 2 1 0 0 0 0 0 0 0 0 Reserved † TXRXINT XINT RINT TINT INT2/INT3 HOLD/INT1 R/W1C Neither INT2 nor INT3 pending INT2 and/or INT3 pending 0 1 Interrupt TXRXINT not pending Interrupt TXRXINT pending 0 1 Interrupt XINT not pendin[...]

  • Page 442

    Register Descriptions A-7 Register Summary Interrupt Mask Register (IMR) — Except ’C209 — Data-Memory Address 0004h 15 6 5 4 3 2 1 0 0 0 0 0 0 0 0 Reserved † TXRXINT XINT RINT TINT INT2/INT3 HOLD/INT1 R/W INT2 and INT3 masked INT2 and INT3 unmasked 0 1 Interrupt TXRXINT masked Interrupt TXRXINT unmasked 0 1 Interrupt XINT masked Interrupt X[...]

  • Page 443

    Register Descriptions A-8 Interrupt Control Register (ICR) — I/O Address FFECh 15 5 4 3 2 1 0 0 0 0 0 0 0 Reserved † MODE FINT3 FINT2 MINT3 MINT2 INT3 request will not reach CPU. INT3 request will reach CPU. 0 1 Double-edge mode. HOLD/INT1 pin both negative- and positive-edge sensitive Single-edge mode. HOLD/INT1 pin only negative-edge sensitiv[...]

  • Page 444

    Register Descriptions A-9 Register Summary Timer Control Register (TCR) — Except ’C209 — I/O Address FFF8h 15 12 11 10 96 5 4 30 0 000000 Reserved † FREE SOFT PSC TRB TSS TDDR Start or restart timer . Stop timer . 0 0 1 1 Stop after the next decrement of the TIM (hard stop). Stop after the TIM decrements to 0 (soft stop). Free run Free run [...]

  • Page 445

    Register Descriptions A-10 Wait-State Generator Control Register (WSGR) — Except ’C209— I/O Address FFFCh 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 Reserved † ISWS DSWS PSUWS PSL WS R/W 0 0 1 1 0 0 1 1 0 wait states 1 wait state 2 wait states 3 wait states 4 wait states 5 wait states 6 wait states 7 wait states 0 0 0 0[...]

  • Page 446

    Register Descriptions A-1 1 Register Summary CLK Register — I/O Address FFE8h 15 1 0 0 0 Reserved † CLKOUT1 0 1 CLKOUT1 signal available at CLKOUT1 pin CLKOUT1 signal not available at CLKOUT1 pin R/W CLKOUT1 pin control † These reserved bits are always read as 0s. Writes have no ef fect.[...]

  • Page 447

    Register Descriptions A-12 Synchronous Serial Port Control Register (SSPCR) — I/O Address FFF1h 15 14 13 12 11 10 9 8 0 0 0 0 0 0 0 0 FREE SOFT TCOMP RFNE FT1 FT0 FR1 FR0 0 1 0 1 Immediate stop Stop after completion of word Free run Free run 0 0 1 1 0 1 T ransmit buffer empty . T ransmit buffer not empty . 0 1 Receive buffer empty . Receive buffe[...]

  • Page 448

    Register Descriptions A-13 Register Summary Asynchronous Serial Port Control Register (ASPCR) — I/O Address FFF5h 15 14 13 12 11 10 9 8 0 0 0 0 0 0 FREE SOFT URST Reserved † DIM TIM Immediate stop Process stops after character completion. Free run Free run 0 1 Port in reset Port enabled Disables transmit interrupts Enables transmit interrupts 0[...]

  • Page 449

    Register Descriptions A-14 I/O Status Register (IOSR) — I/O Address FFF6h 15 14 13 12 11 10 9 8 0 0 0 1 1 0 0 0 Reserved † ADC ‡ BI ‡ TEMT THRE ‡ FE ‡ OE ‡ DR ‡ R R/W1C R/W1C 0 1 Normal operation. CAD bit of ASPCR is 1 and A or a is received in ADTR. 0 1 Normal operation Break has been detected on RX pin. 0 1 ADTR and/or AXSR are fu[...]

  • Page 450

    B-1 Appendix A TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison This appendix contains a table that compares the TMS320C1x, TMS320C2x, TMS320C2xx, and TMS320C5x instructions alphabetically . Each table entry shows the syntax for the instruction, indicates which devices support the instruction, and describes the operation of the instruction. Sectio[...]

  • Page 451

    Using the Instruction Set Comparison T able B-2 B.1 Using the Instruction Set Comparison T able T o help you read the comparison table, this section provides an example of a table entry and a list of acronyms. B.1.1 An Example of a T able Entry In cases where more than one syntax is used, the first syntax is usually for di- rect addressing and the [...]

  • Page 452

    Using the Instruction Set Comparison T able B-3 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison B.1.2 Symbols and Acronyms Used in the T able The following table lists the instruction set symbols and acronyms used throughout this chapter: T able B–1. Symbols and Acronyms Used in the Instruction Set Summary Symbol Description Symbol Description [...]

  • Page 453

    Using the Instruction Set Comparison T able B-4 Based on the device, this is how the indirect addressing operand {ind} is interpreted: {ind} ’C1x : { * | *+ | *– } ’C2x : { * | *+ | *– | *0+| *0– | *BR0+ | *BR0– } ’C2xx : { * | *+ | *– | *0+| *0– | *BR0+ | *BR0– } ’C5x: { * | *+ | *– | *0+| *0– | *BR0+ | *BR0– } where th[...]

  • Page 454

    Enhanced Instructions B-5 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison B.2 Enhanced Instructions An enhanced instruction is a single mnemonic that performs the functions of several similar instructions. For example, the enhanced instruction ADD performs the ADD, ADDH, ADDK, and ADLK functions and replaces any of these other instructions at ass[...]

  • Page 455

    Instruction Set Comparison T able B-6 B.3 Instruction Set Comparison T able Syntax 1x 2x 2xx 5x Description ABS √ √ √ √ Absolute V alue of Accumulator If the contents of the accumulator are less than zero, replace the contents with the 2s complement of the contents. If the contents are ≥ 0, the accumulator is not affected. ADCB √ Add AC[...]

  • Page 456

    Instruction Set Comparison T able B-7 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x ADDK # k √ √ √ Add to Accumulator Short Immediate TMS320C1x devices: Add an 8-bit immediate value to the accumulator . TMS320C2x, TMS320C2xx, and TMS320C5x de- vices: Add an 8-bit immediate value, right justified, to the acc[...]

  • Page 457

    Instruction Set Comparison T able B-8 Syntax Description 5x 2xx 2x 1x AND dma AND { ind } [ , next ARP ] AND # lk [ , shift ] √ √ √ √ √ √ √ √ √ √ AND With Accumulator TMS320C1x and TMS320C2x devices: AND the con- tents of the addressed data-memory location with the 16 LSBs of the accumulator . The 16 MSBs of the accu- mulator ar[...]

  • Page 458

    Instruction Set Comparison T able B-9 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x B [ D ] pma [ , { ind } [ , next ARP ]] √ Branch Unconditionally With Optional Delay Modify the current auxiliary register and ARP as speci- fied and pass control to the designated program- memory address. If you specify a delay[...]

  • Page 459

    Instruction Set Comparison T able B-10 Syntax Description 5x 2xx 2x 1x BBNZ pma [ , { ind } [ , next ARP ]] √ √ √ Branch on Bit ≠ Zero If the TC bit = 1, branch to the specified program- memory address. TMS320C2x devices: Modify the current AR and ARP as specified. TMS320C2xx and TMS320C5x devices: If the –p port- ing switch is used, modi[...]

  • Page 460

    Instruction Set Comparison T able B-1 1 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x BGEZ pma BGEZ pma [ , { ind } [ , next ARP ]] √ √ √ √ √ Branch if Accumulator ≥ Zero If the contents of the accumulator ≥ 0, branch to the specified program-memory address. TMS320C2x devices: Modify the current AR [...]

  • Page 461

    Instruction Set Comparison T able B-12 Syntax Description 5x 2xx 2x 1x BLDD # lk, dma BLDD # lk, { ind } [ , next ARP ] BLDD dma, # lk BLDD { ind } , # lk [ , next ARP ] BLDD BMAR, dma BLDD BMAR, { ind } [ , next ARP ] BLDD dma BMAR BLDD { ind } , BMAR [ , next ARP ] √ √ √ √ √ √ √ √ √ √ √ √ Block Move From Data Memory to Dat[...]

  • Page 462

    Instruction Set Comparison T able B-13 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x BLKD dma1, dma2 BLKD dma1, { ind } [ , next ARP ] √ √ √ √ √ √ Block Move From Data Memory to Data Memory Move a block of words from one location in data mem- ory to another location in data memory . Modify the cur- re[...]

  • Page 463

    Instruction Set Comparison T able B-14 Syntax Description 5x 2xx 2x 1x BNC pma [ , { ind } [ , next ARP ]] √ √ √ Branch on No Carry If the C bit = 0, branch to the specified program- memory address. TMS320C2x devices: Modify the current AR and ARP as specified. TMS320C2xx and TMS320C5x devices: Modify the current AR and ARP as specified when [...]

  • Page 464

    Instruction Set Comparison T able B-15 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x BZ pma BZ pma [ , { ind } [ , next ARP ]] √ √ √ √ Branch if Accumulator = Zero If the contents of the accumulator = 0, branch to the specified program-memory address. TMS320C2x, TMS320C2xx and TMS320C5x de- vices: Modify [...]

  • Page 465

    Instruction Set Comparison T able B-16 Syntax Description 5x 2xx 2x 1x CC pma, cond 1 [ , cond 2 ] [, ...] √ Call Conditionally If the specified conditions are met, control is passed to the pma. Not all combinations of conditions are mean- ingful. CC [ D ] pma , cond 1 [ , cond 2 ] [, ...] √ Call Conditionally With Optional Delay If the specifi[...]

  • Page 466

    Instruction Set Comparison T able B-17 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x CNFP √ √ √ Configure Block as Program Memory Configure on-chip RAM block B0 as program memory . Block B0 is mapped into program-memory locations 65280h–65535h. TMS320C5x devices: Block B0 is mapped into data- memory locat[...]

  • Page 467

    Instruction Set Comparison T able B-18 Syntax Description 5x 2xx 2x 1x EINT √ √ √ √ Enable Interrupts Enable all interrupts; clear the INTM to 0. Maskable interrupts are enabled immediately after the EINT instruction executes. EXAR √ Exchange ACCB With ACC Exchange the contents of the ACC with the contents of the ACCB. FORT 1-bit constant[...]

  • Page 468

    Instruction Set Comparison T able B-19 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x INTR K √ √ Soft Interrupt T ransfer program control to the program-memory ad- dress specified by K (an integer from 0 to 31). This in- struction allows you to use your software to execute any interrupt service routine. The in[...]

  • Page 469

    Instruction Set Comparison T able B-20 Syntax Description 5x 2xx 2x 1x LACT dma LACT { ind } [ , next ARP ] √ √ √ √ √ √ Load Accumulator With Shift Specified by T Register Left shift the contents of the addressed data-memory location by the value specified in the 4 LSBs of the T register; load the result into the accumulator . If a shif[...]

  • Page 470

    Instruction Set Comparison T able B-21 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x LDP dma LDP { ind } [ , next ARP ] LDP # k √ √ √ √ √ √ √ √ √ √ Load Data-Memory Page Pointer TMS320C1x devices: Load the LSB of the contents of the addressed data-memory location into the DP regis- ter . All h[...]

  • Page 471

    Instruction Set Comparison T able B-22 Syntax Description 5x 2xx 2x 1x LST # n, dma LST # n, { ind } [ , next ARP ] √ √ √ √ √ √ Load Status Register n Load the contents of the addressed data-memory lo- cation into ST n . LST1 dma LST1 { ind } [ , next ARP ] √ √ √ √ √ √ Load ST1 Load the contents of the addressed data-memory [...]

  • Page 472

    Instruction Set Comparison T able B-23 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x MAC pma, dma MAC pma, { ind } [ , next ARP ] √ √ √ √ √ √ Multiply and Accumulate Multiply a data-memory value by a program-memory value and add the previous product (shifted as speci- fied by the PM status bits) to th[...]

  • Page 473

    Instruction Set Comparison T able B-24 Syntax Description 5x 2xx 2x 1x MPY A dma MPY A { ind } [ , next ARP ] √ √ √ √ √ √ Multiply and Accumulate Previous Product Multiply the contents of the T register (TMS320C2x/ 2xx) or TREG0 (TMS320C5x) by the contents of the addressed data-memory location; place the result in the P register . Add t[...]

  • Page 474

    Instruction Set Comparison T able B-25 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x OR dma OR { ind } [ , next ARP ] OR # lk [ , shift ] √ √ √ √ √ √ √ √ √ √ OR With Accumulator TMS320C1x and TMS320C2x devices: OR the 16 LSBs of the accumulator with the contents of the ad- dressed data-memory [...]

  • Page 475

    Instruction Set Comparison T able B-26 Syntax Description 5x 2xx 2x 1x POPD dma POPD { ind } [ , next ARP ] √ √ √ √ √ √ Pop T op of Stack to Data Memory T ransfer the value on the top of the stack into the ad- dressed data-memory location and then pop the stack one level. PSHD dma PSHD { ind } [ , next ARP ] √ √ √ √ √ √ Push[...]

  • Page 476

    Instruction Set Comparison T able B-27 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x RETE √ Enable Interrupts and Return From Interrupt Copy the contents of the top of the stack into the PC and pop the stack one level. RETE automatically clears the global interrupt enable bit and pops the shadow registers (stor[...]

  • Page 477

    Instruction Set Comparison T able B-28 Syntax Description 5x 2xx 2x 1x RPT dma RPT { ind } [ , next ARP ] RPT # k RPT # lk √ √ √ √ √ √ √ √ √ √ Repeat Next Instruction TMS320C2x devices: Load the 8 LSBs of the ad- dressed value into the RPTC; the instruction following RPT is executed the number of times indicated by RPTC + 1. TMS[...]

  • Page 478

    Instruction Set Comparison T able B-29 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x SACH dma [ , shift ] SACH { ind } [ , shift [ , next ARP ]] √ √ √ √ √ √ √ √ Store High Accumulator With Shift Copy the contents of the accumulator into a shifter . Shift the entire contents 0, 1, or 4 bits (TMS320[...]

  • Page 479

    Instruction Set Comparison T able B-30 Syntax Description 5x 2xx 2x 1x SBBB √ Subtract ACCB From Accumulator With Borrow Subtract the contents of the ACCB and the logical in- version of the carry bit from the accumulator . The result is stored in the accumulator; the accumulator buffer is not affected. Clear the carry bit if the result generates [...]

  • Page 480

    Instruction Set Comparison T able B-31 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x SHM √ √ Set Hold Mode Set the HM status bit to 1. SMMR dma, # lk SMMR { ind } , # lk [ , next ARP ] √ √ Store Memory-Mapped Register Store the memory-mapped register value, pointed at by the 7 LSBs of the data-memory addr[...]

  • Page 481

    Instruction Set Comparison T able B-32 Syntax Description 5x 2xx 2x 1x SQRA dma SQRA { ind } [ , next ARP ] √ √ √ √ √ √ Square and Accumulate Previous Product Add the contents of the P register (shifted as specified by the PM status bits) to the accumulator . Then load the contents of the addressed data-memory location into the T regist[...]

  • Page 482

    Instruction Set Comparison T able B-33 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x SUB dma [ , shift ] SUB { ind } [ , shift [ , next ARP ]] SUB # k SUB # lk [ , shift 2 ] √ √ √ √ √ √ √ √ √ √ √ √ Subtract From Accumulator With Shift TMS320C1x and TMS320C2x devices: Subtract the contents [...]

  • Page 483

    Instruction Set Comparison T able B-34 Syntax Description 5x 2xx 2x 1x SUBT dma SUBT { ind } [ , next ARP ] √ √ √ √ √ √ Subtract From Accumulator With Shift Specified by T Register Left shift the data-memory value as specified by the 4 LSBs of the T register (TMS320C2x/2xx) or TREG1 (TMS320C5x), and subtract the result from the accu- mu[...]

  • Page 484

    Instruction Set Comparison T able B-35 TMS320C1x/C2x/C2xx/C5x Instruction Set Comparison Syntax Description 5x 2xx 2x 1x XOR dma XOR { ind } [ , next ARP ] XOR # lk [ , shift ] √ √ √ √ √ √ √ √ √ √ Exclusive-OR With Accumulator TMS320C1x and TMS320C2x devices: Exclusive-OR the contents of the addressed data-memory location with 1[...]

  • Page 485

    Instruction Set Comparison T able B-36 Syntax Description 5x 2xx 2x 1x ZALR dma ZALR { ind } [ , next ARP ] √ √ √ √ √ √ Zero Low Accumulator , Load High Accumulator With Rounding Load the contents of the addressed data-memory location into the 16 MSBs of the accumulator . The value is rounded by 1/2 LSB; that is, the 15 LSBs of the accu[...]

  • Page 486

    C-1 Appendix A Program Examples This appendix provides: A brief introduction to the process for generating executable program files. Sample programs for implementing simple routines and using interrupts, I/O pins, the timer , and the serial ports. This appendix is not intended to teach you how to use the software develop- ment tools. The following [...]

  • Page 487

    About These Program Examples C-2 C.1 About These Program Examples Figure C–1 illustrates the basic process for creating assembly language files and then generating executable files from them: 1) Use the ’C2xx assembler to create: A command file ( c203.cmd in the figure) that defines address ranges according to the architecture of the particular[...]

  • Page 488

    About These Program Examples C-3 Program Examples The program examples in Section C.2 and Section C.3 consist of code for shared files and task-specific files. T able C–1 describes the shared programs. Shared files contain code that is used by multiple task-specific files. The task- specific programs are described in T able C–2. Every task-spec[...]

  • Page 489

    About These Program Examples C-4 T able C–2. T ask-Specific Programs in This Appendix (Continued) Program Functional Description See ... uart.asm Causes the asynchronous serial port to transmit a test message continuously at 1200 baud. Baud rate is 1200 at 50-ns cycle time. Example C–9, page C-13 echo.asm Echoes the character received by the as[...]

  • Page 490

    Shared Program Code C-5 Program Examples C.2 Shared Program Code Example C–1. Generic Command File (c203.cmd) /* Title: c203.cmd */ /* Generic command file for linking TMS320C2xx assembler files */ /* input files: *.obj files */ /* output files: *.out file */ /* Map files: *.map file (optional) */ /* TMS320C2xx architecture declaration for linker[...]

  • Page 491

    Shared Program Code C-6 Example C–2. Header File With I/O Register Declarations (init.h) * File: init.h * * Include file with I/O register declarations * .mmregs ; Include reserved words .bss dmem,10 ; Undefined variables space .def ini_d, start,codtx ; Directive for symbol address ; generation in the current module ; –optional ini_d: .usect ?[...]

  • Page 492

    Shared Program Code C-7 Program Examples Example C–3. Header File With Interrupt V ector Declarations (vector .h) * File: vector.h * * File defines Interrupt vector labels * .sect ”vectors” b start ; reset vector – Jump to label start on reset b inpt1 ; INT1 interrupt b inpt23 ; INT2/INT3 interrupt b timer ; TINT Timer interrupt b codrx ; R[...]

  • Page 493

    T ask-Specific Program Code C-8 C.3 T ask-Specific Program Code Example C–4. Implementing Simple Delay Loops (delay .asm) * File: delay.asm * * Function: Delay loop. XF and I/O 3 pins toggle after each delay * .title ”Delay routine” ; Title .copy ”init.h” ; Variable and register declaration .copy ”vector.h” ; Vector label declaration [...]

  • Page 494

    T ask-Specific Program Code C-9 Program Examples Example C–5. T esting and Using the Timer (timer.asm) * File: timer.asm * * Function: Timer test code * * PRD=0x00ff,TDDR=f @ 50ns, gives an interrupt interval=205us * * PRD=0xffff,TDDR=0 @ 50ns, gives an interrupt interval=3.27ms* * Timer interval measurable on I/O 2,3 or xf pins * .title ”Timer[...]

  • Page 495

    T ask-Specific Program Code C-10 Example C–6. T esting and Using Interrupt INT1 (intr1.asm) * File: intr1.asm * * Function: Interrupt test code * * For each INT1 interrupt XF,I/O pins IO3 and IO2 will toggle and * * transmit char ’c’ through UART * .title ”Interrupt 1 Test” ; Title .copy ”init.h” ; Variable and register declaration .c[...]

  • Page 496

    T ask-Specific Program Code C-1 1 Program Examples Example C–7. Implementing a HOLD Operation (hold.asm) * File: hold.asm * * Function: HOLD test code * * Check for HOLDA toggle for HOLD requests in MODE 0 * * Check for XF toggle on HOLD/INT1 requests in MODE 1 * .title ” HOLD Test ” ; Title .mmregs icr .set 0FFECh ; Interrupt control registe[...]

  • Page 497

    T ask-Specific Program Code C-12 Example C–8. T esting and Using Interrupts INT2 and INT3 (intr23.asm) * File: intr23.asm * * Function: Interrupt test code * * Interrupt on INT2 or INT3 will toggle IO3 and IO2 bits * * and icr value copied in the Buffer @300 * .title ” Interrupt 2/3 Test” ; Title .copy ”init.h” ; Variable and register dec[...]

  • Page 498

    T ask-Specific Program Code C-13 Program Examples Example C–9. Asynchronous Serial Port T ransmission (uart.asm) * File: uart.asm * * Function: UART Test Code * * Continuously sends ’’C203 UART is fine’ at 1200 baud. * .title ” UART Test” ; Title .copy ”init.h” ; Variable and register declaration .copy ”vector.h” ; Vector label [...]

  • Page 499

    T ask-Specific Program Code C-14 Example C–9. Asynchronous Serial Port T ransmission (uart.asm) (Continued) lar ar1,#rxbuf lar ar0, #20 ; load buffer size mar *,ar1 ; load data pointer clrc intm wait: clrc xf ; toggle xf bit idle b wait uart: setc xf ; toggle xf bit splk #0ffffh,67h out *+,adtr ; transmit character from data buffer@300 mar *,ar0 [...]

  • Page 500

    T ask-Specific Program Code C-15 Program Examples Example C–10. Loopback to V erify T ransmissions of Asynchronous Serial Port (echo.asm) (Continued) * UART initialization * splk #0ffffh,ifr ; clear interrupts splk #0000h,60h out 60h, wsgr ; Set zero wait states splk #0c080h,61h ; reset the UART by writing 0 out 61h, aspcr ; 1 stop bit, rx interr[...]

  • Page 501

    T ask-Specific Program Code C-16 Example C–1 1. T esting and Using Automatic Baud-Rate Detection on Asynchronous Serial Port (autobaud.asm) * File: autobaud.asm * * Function: UART,auto baud test * * Locks to incoming baud rate if the first character * * is ”A” or ”a” & continuously echoes data received * * through the port. * * Once d[...]

  • Page 502

    T ask-Specific Program Code C-17 Program Examples Example C–1 1. T esting and Using Automatic Baud-Rate Detection on Asynchronous Serial Port (autobaud.asm) (Continued) uart: setc xf in 68h,iosr ; load input status from iosr bit 68h,1 ; check if auto baud bit is set bcnd rcv,ntc ; branch normal receive splk #4fffh,67h ; clear ADC out 67h,iosr spl[...]

  • Page 503

    T ask-Specific Program Code C-18 Example C–12. T esting and Using Asynchronous Serial Port Delta Interrupts (bitio.asm) * File: bitio.asm * * Function: Delta interrupt test code * * Accepts delta interrupt on IO pins 3 and 2 * * If bit level changes on bit 7, send character ’c’ * * through UART & toggle xf pin. * * If bit level changes on[...]

  • Page 504

    T ask-Specific Program Code C-19 Program Examples Example C–12. T esting and Using Asynchronous Serial Port Delta Interrupts(bitio.asm) (Continued) uart: setc xf ; toggle xf bit in 68h,iosr ; Bit i/o check bit 68h,8 ; bit address 7 I/O 3 BIT IS SET? ; required bit place = complement 7 ! bcnd poll,ntc ; NO then check FOR I/O 2 clrc tc out 65h, adt[...]

  • Page 505

    T ask-Specific Program Code C-20 Example C–13. Synchronous Serial Port Continuous Mode T ransmission (ssp.asm) * File: ssp.asm * * Function: Continuous transmit in CONTINUOUS mode * * Internal shift clock and frame sync * * Transmit FIFO level is set to 4 * .title ”SSP Continuous mode” ; Title .copy ”init.h” ; Variable and register declar[...]

  • Page 506

    T ask-Specific Program Code C-21 Program Examples Example C–14. Using Synchronous Serial Port With Codec Device (ad55.asm) * File: ad55.asm * * Function: Burst mode simple loop back on AD55 CODEC * * CODEC master clock 10 MHz * * Simple I/O at 9.6-kHz sampling * .title ”AD55 codec simple I/O” ; Title .copy ”init.h” ; Variable and register[...]

  • Page 507

    T ask-Specific Program Code C-22 Example C–14. Using Synchronous Serial Port With Codec Device (ad55.asm) (Continued) codtx: splk #0010h, ifr ; clear tx intr flag clrc intm ret codrx: setc xf ; toggle xf bit in *,sdtr ; Read ADC value lacc *+,0 ; Make LSB zero and #0fffeh,0 ; to avoid secondary sacl 6ah,0 ; request for codec out 6ah,sdtr ; Send A[...]

  • Page 508

    Introduction to Generating Boot Loader Code C-23 Program Examples C.4 Introduction to Generating Boot Loader Code The ’C2xx on-chip boot loader boots software from an 8-bit external EPROM to a 16-bit external RAM at reset. This section introduces to the procedure for using T exas Instruments development tools to generate the code that will be loa[...]

  • Page 509

    Introduction to Generating Boot Loader Code C-24 Example C–15. Linker Command File MEMORY { PAGE 0: /* PM – Program memory */ EX1_PM :ORIGIN=0H , LENGTH=0FEFFH /* External program RAM */ B0_PM :ORIGIN=0FF00H, LENGTH=0100H /* BLOCK MAP IN CNF=1 */ PAGE 1: /* DM – Data memory */ REGS :ORIGIN=0H , LENGTH=60H /* MEM–MAPPED REGS */ BLK_B2 :ORIGI[...]

  • Page 510

    D-1 Appendix A Submitting ROM Codes to TI The size of a printed circuit board is a consideration in many DSP applications. T o make full use of the board space, T exas Instruments offers this ROM code option that reduces the chip count and provides a single-chip solution. This op- tion allows you to use a code-customized processor for a specific ap[...]

  • Page 511

    D-2 Figure D–1. TMS320 ROM Code Submittal Flow Chart Customer TMS320 Design Customer submits: — TMS320 New Code Release Form — Print Evaluation and Acceptance Form (PEAF) — Purchase order for mask prototypes — TMS320 code T exas Instruments responds: — Customer code input into TI system — Code sent back to customer for verification Cu[...]

  • Page 512

    D-3 Submitting ROM Codes to TI The TMS320 ROM code may be submitted in one of the following forms: 5-1/4-in floppy: COFF format from macro-assembler/linker (preferred) Modem (BBS): COFF format from macro-assembler/linker EPROM (others): TMS27C64 PROM: TBP28S166, TBP28S86 When code is submitted to TI for masking, the code is reformatted to accom- mo[...]

  • Page 513

    E-1 Appendix A Design Considerations for Using XDS510 Emulato r This appendix assists you in meeting the design requirements of the T exas Instruments XDS510 emulator with respect to IEEE-1 149.1 designs and discusses the XDS510 cable (manufacturing part number 2617698-0001). This cable is identified by a label on the cable pod marked JT AG 3/5V an[...]

  • Page 514

    Designing Y our T arget System’ s Emulator Connector (14-Pin Header) E-2 E.1 Designing Y our T arget System’ s Emulator Connector (14-Pin Header) JT AG target devices support emulation through a dedicated emulation port. This port is accessed directly by the emulator and provides emulation func- tions that are a superset of those specified by I[...]

  • Page 515

    Designing Y our T arget System’ s Emulator Connector (14-Pin Header) E-3 Design Considerations for Using XDS510 Emulato r T able E–1. 14-Pin Header Signal Descriptions Signal Description Emulator † State T arget † State EMU0 Emulation pin 0 I I/O EMU1 Emulation pin 1 I I/O GND Ground PD(V CC ) Presence detect. Indicates that the emulation c[...]

  • Page 516

    Bus Protocol E-4 E.2 Bus Protocol The IEEE 1 149.1 specification covers the requirements for the test access port (T AP) bus slave devices and provides certain rules, summarized as follows: The TMS and TDI inputs are sampled on the rising edge of the TCK signal of the device. The TDO output is clocked from the falling edge of the TCK signal of the [...]

  • Page 517

    Emulator Cable Pod E-5 Design Considerations for Using XDS510 Emulato r E.3 Emulator Cable Pod Figure E–2 shows a portion of the emulator cable pod. The functional features of the pod are: TDO and TCK_RET can be parallel-terminated inside the pod if required by the application. By default, these signals are not terminated. TCK is driven with a 74[...]

  • Page 518

    Emulator Cable Pod Signal Timing E-6 E.4 Emulator Cable Pod Signal Timing Figure E–3 shows the signal timings for the emulator cable pod. T able E–2 defines the timing parameters illustrated in the figure. These timing parame- ters are calculated from values specified in the standard data sheets for the emulator and cable pod and are for refere[...]

  • Page 519

    Emulation Timing Calculations E-7 Design Considerations for Using XDS510 Emulato r E.5 Emulation Timing Calculations Example E–1 and Example E–2 help you calculate emulation timings in your system. For actual target timing parameters, see the appropriate data sheet for the device you are emulating. The examples use the following assumptions: t [...]

  • Page 520

    Emulation Timing Calculations E-8 Example E–1. Key T iming for a Single-Processor System Without Buffers t pd TCK_RET-TMS TDI t d TMSmax t su TTMS t TCKfactor ( 20 ns 10 ns ) 0.4 75 ns, or 13.3 MHz t pd TCK_RET–TDO t d TTDO t su TDOmin t TCKfactor ( 15 ns 3n s ) 0.4 45 ns, or 22.2 MHz In this case, because the TCK_RET -to-TMS/TDI path requires [...]

  • Page 521

    Emulation Timing Calculations E-9 Design Considerations for Using XDS510 Emulato r In a multiprocessor application, it is necessary to ensure that the EMU0 and EMU1 lines can go from a logic low level to a logic high level in less than 10 µ s, this parameter is called rise time, t r . This can be calculated as follows: t r = 5(R pullup × N device[...]

  • Page 522

    Connections Between the Emulator and the T arget System E-10 E.6 Connections Between the Emulator and the T arget System It is extremely important to provide high-quality signals between the emulator and the JT AG target system. Y ou must supply the correct signal buffering, test clock inputs, and multiple processor interconnections to ensure prope[...]

  • Page 523

    Connections Between the Emulator and the T arget System E-1 1 Design Considerations for Using XDS510 Emulato r Figure E–5. Emulator Connections With Signal Buffering V CC Emulator header V CC GND 12 10 8 6 4 5 GND GND GND GND GND PD TCK_RET TCK TDO TDI TMS TRST EMU1 EMU0 9 11 7 3 1 2 14 13 JT AG device TCK TDO TDI TMS TRST EMU1 EMU0 Greater than [...]

  • Page 524

    Connections Between the Emulator and the T arget System E-12 E.6.2 Using a T arget-System Clock Figure E–6 shows an application with the system test clock generated in the target system. In this application, the emulator ’ s TCK signal is left uncon- nected. Figure E–6. T arget-System-Generated T est Clock NC System test clock V CC Emulator h[...]

  • Page 525

    Connections Between the Emulator and the T arget System E-13 Design Considerations for Using XDS510 Emulato r E.6.3 Configuring Multiple Processors Figure E–7 shows a typical daisy-chained multiprocessor configuration that meets the minimum requirements of the IEEE 1 149.1 specification. The emulation signals are buffered to isolate the processor[...]

  • Page 526

    Physical Dimensions for the 14-Pin Emulator Connector E-14 E.7 Physical Dimensions for the 14-Pin Emulator Connector The JT AG emulator target cable consists of a 3-foot section of jacketed cable that connects to the emulator , an active cable pod, and a short section of jack- eted cable that connects to the target system. The overall cable length [...]

  • Page 527

    Physical Dimensions for the 14-Pin Emulator Connector E-15 Design Considerations for Using XDS510 Emulato r Figure E–9. 14-Pin Connector Dimensions 0.100 inch, nominal (pin spacing) Key , pin 6 0.100 inch, nominal (pin spacing) 0.87 inch, nominal 0.66 inch, nominal 0.20 i nch, nominal Cable Connector , side view Connector , front view Cable 1 3 5[...]

  • Page 528

    Emulation Design Considerations E-16 E.8 Emulation Design Considerations This section describes the use and application of the scan path linker (SPL), which can simultaneously add all four secondary JT AG scan paths to the main scan path. It also describes the use of the emulation pins and the configuration of multiple processors. E.8.1 Using Scan [...]

  • Page 529

    Emulation Design Considerations E-17 Design Considerations for Using XDS510 Emulato r Figure E–10. Connecting a Secondary JT AG Scan Path to a Scan Path Linker TDI TCK TDO TRST TMS TDO TRST TCK TMS TDI DTDI0 DTMS0 DTDO0 DTCK TDO TRST TCK TMS TDI SPL JT AG 0 JT AG N DTDI1 DTMS1 DTDO1 DTDI2 DTMS2 DTDO2 DTDI3 DTMS3 DTDO3 . . . The TRST signal from t[...]

  • Page 530

    Emulation Design Considerations E-18 E.8.2 Emulation Timing Calculations for a Scan Path Linker (SPL) Example E–3 and Example E–4 help you to calculate the key emulation tim- ings in the SPL secondary scan path of your system. For actual target timing parameters, see the appropriate device data sheet for your target device. The examples use the[...]

  • Page 531

    Emulation Design Considerations E-19 Design Considerations for Using XDS510 Emulato r Of the following two cases, the worst-case path delay is calculated to deter- mine the maximum system test clock frequency . Example E–3. Key T iming for a Single-Processor System Without Buffering (SPL) t pd TCK-DTMS t d DTMSmax t d DTCKHmin t su TTMS t TCKfact[...]

  • Page 532

    Emulation Design Considerations E-20 E.8.3 Using Emulation Pins The EMU0/1 pins of TI devices are bidirectional, 3-state output pins. When in an inactive state, these pins are at high impedance. When the pins are active, they provide one of two types of output: Signal Event. The EMU0/1 pins can be configured via software to signal internal events. [...]

  • Page 533

    Emulation Design Considerations E-21 Design Considerations for Using XDS510 Emulato r Figure E–1 1. EMU0/1 Configuration to Meet Timing Requirements of Less Than 25 ns Open- collector drivers EMU0/1-IN Backplane T arget board m TCK XCNT_ENABLE T o emulator EMU0 PA L Pullup resistor Open- collector drivers T arget board 1 EMU0/1 EMU0/1-OUT . . . D[...]

  • Page 534

    Emulation Design Considerations E-22 The bused EMU0/1 signals go into a programmable logic array device PA L whose function is to generate a low pulse on the EMU0/1-IN signal when a low level is detected on the EMU0/1-OUT signal. This pulse must be longer than one TCK period to affect the devices but less than 10 µ s to avoid possible conflicts or[...]

  • Page 535

    Emulation Design Considerations E-23 Design Considerations for Using XDS510 Emulato r Figure E–13. EMU0/1 Configuration With Additional AND Gate to Meet T iming Requirements of Greater Than 25 ns Open- collector drivers EMU0/1-IN Backplane T arget board m TCK XCNT_ENABLE T o Emulator EMU0 PA L Pullup resistor Open- collector drivers T arget board[...]

  • Page 536

    Emulation Design Considerations E-24 Y ou do not need to have devices on one target board stop devices on another target board using the EMU0/1 signals (see the circuit in Figure E–14). In this configuration, the global-stop capability is lost. It is important not to overload EMU0/1 with more than 16 devices. Figure E–14. EMU0/1 Configuration W[...]

  • Page 537

    Emulation Design Considerations E-25 Design Considerations for Using XDS510 Emulato r Figure E–15. TBC Emulation Connections for n JT AG Scan Paths JT AG0 JT AGN TDI EMU1 TMS TDO EMU0 TRST TCK TDO TCK TRST EMU1 EMU0 TMS TDI Clock TDI1 TDI0 TCKO TMS5/EVNT3 TMS4/EVNT2 TMS3/EVNT1 TMS2/EVNT0 TMS1 TMS0 TDO TCKI V CC TBC In the system design shown in F[...]

  • Page 538

    F-1 Appendix A Glossary A A0–A15: Collectively , the external address bus; the 16 pins are used in par- allel to address external data memory , program memory , or I/O space. ACC: See accumulator . ACCH: Accumulator high word. The upper 16 bits of the accumulator . See also accumulator . ACCL: Accumulator low word. The lower 16 bits of the accumu[...]

  • Page 539

    F-2 analog-to-digital (A/D) converter: A circuit that translates an analog signal to a digital signal. AR: See auxiliary register . AR0–AR7: Auxiliary registers 0 through 7. See auxiliary register . ARAU: See auxiliary register arithmetic unit (ARAU). ARB: See auxiliary register pointer buffer (ARB) . ARP: See auxiliary register pointer (ARP). AR[...]

  • Page 540

    F-3 Glossary B B0: An on-chip block of dual-access RAM that can be configured as either data memory or program memory , depending on the value of the CNF bit in status register ST1. B1: An on-chip block of dual-access RAM available for data memory . B2: An on-chip block of dual-access RAM available for data memory . baud-rate divisor register (BRD)[...]

  • Page 541

    F-4 CALU: See central arithmetic logic unit (CALU). carry bit: Bit 9 of status register ST1; used by the CALU for extended arithmetic operations and accumulator shifts and rotates. The carry bit can be tested by conditional instructions. central arithmetic logic unit (CALU): The 32-bit wide main arithmetic logic unit for the ’C2xx CPU that perfor[...]

  • Page 542

    F-5 Glossary clock mode (clock generator): One of the modes which sets the internal CPU clock frequency to a fraction or multiple of the frequency of the input clock signal CLKIN. The ’C209 has two clock modes ( ÷ 2 and × 2); other ’C2xx devices have four clock modes ( ÷ 2, × 1, × 2, and × 4). clock mode (synchronous serial port): See clo[...]

  • Page 543

    F-6 current data page: The data page indicated by the content of the data page pointer (DP). See also data page ; DP . D D0–D15: Collectively , the external data bus; the 16 pins are used in parallel to transfer data between the ’C2xx and external data memory , program memory , or I/O space. DARAM: Dual-access RAM . RAM that can be accessed twi[...]

  • Page 544

    F-7 Glossary decode phase: The phase of the pipeline in which the instruction is de- coded. See also pipeline ; instruction-fetch phase ; operand-fetch phase; instruction-execute phase . delta interrupt: An asynchronous serial port interrupt (TXRXINT) that is generated if a change takes place on one of these general-purpose I/O pins: IO0, IO1, IO2,[...]

  • Page 545

    F-8 DRAB: See data-read address bus (DRAB). DRDB: See data read bus (DRDB). DS: Data memory select pin . The ’C2xx asserts DS to indicate an access to external data memory (local or global). DSWS: Data-space wait-state bit(s). A value in the wait-state generator con- trol register (WSGR) that determines the number of wait states applied to reads [...]

  • Page 546

    F-9 Glossary FR0/FR1: FIFO receive-interrupt bits . Bits 8 and 9 of the synchronous serial port control register (SSPCR); together they set an interrupt trigger condition based on the number of words in the receive FIFO buffer . frame synchronization (frame sync) mode: One of two modes in the syn- chronous serial port that determine whether frame s[...]

  • Page 547

    F-10 G general-purpose input/output pins: Pins that can be used to accept input signals and/or send output signals but are not linked to specific uses. These pins are the input pin BIO , the output pin XF , and the input/output pins IO0, IO1, IO2, and IO3. (IO0–IO3 are not available on the ’C209.) global data space : One of the four ’C2xx add[...]

  • Page 548

    F-1 1 Glossary IC: (Used in earlier documentation.) See interrupt control register (ICR). ICR: See interrupt control register (ICR) . IFR: See interrupt flag register (IFR) . immediate addressing: One of the methods for obtaining data values used by an instruction; the data value is a constant embedded directly into the instruction word; data memor[...]

  • Page 549

    F-12 INT1–INT3: Three external pins used to generate general-purpose hard- ware interrupts. internal interrupt: A hardware interrupt caused by an on-chip peripheral. interrupt: A signal sent to the CPU that (when not masked or disabled) forces the CPU into a subroutine called an interrupt service routine (ISR). This signal can be triggered by an [...]

  • Page 550

    F-13 Glossary IO0–IO3 bits: Bits 0–3 of the IOSR. When pins IO0–IO3 are configured as inputs, these bits reflect the current logic levels on the pins. For example, the IO0 bit reflects the level on the IO0 pin. See also CIO0–CIO3 bits ; DIO0–DIO3 bits . IO0–IO3 pins: Four pins that can be individually configured as inputs or out- puts. [...]

  • Page 551

    F-14 LSB : Least significant bit. The lowest order bit in a word. When used in plural form (LSBs), refers to a specified number of low-order bits, beginning with the lowest order bit and counting to the left. For example, the four LSBs of a 16-bit value are bits 0 through 3. See also MSB . M machine cycle: See CPU cycle . maskable interrupt : A har[...]

  • Page 552

    F-15 Glossary MST ACK: See micro stack . multiplier: A part of the CPU that performs 16-bit × 16-bit multiplication and generates a 32-bit product. The multiplier operates using either signed or unsigned 2s-complement arithmetic. N next AR: See next auxiliary register . next auxiliary register: The register that will be pointed to by the auxiliary[...]

  • Page 553

    F-16 OV bit: Overflow flag bit. Bit 12 of status register ST0; indicates whether the result of an arithmetic operation has exceeded the capacity of the accu- mulator . overflow (in a register): A condition in which the result of an arithmetic op- eration exceeds the capacity of the register used to hold that result. overflow (in the synchronous ser[...]

  • Page 554

    F-17 Glossary pipeline : A method of executing instructions in an assembly line fashion. The ’C2xx pipeline has four independent phases. During a given CPU cycle, four different instructions can be active, each at a dif ferent stage of completion. See also instruction-fetch phase ; instruction-decode phase ; operand-fetch phase; instruction-execu[...]

  • Page 555

    F-18 program control logic: Logic circuitry that decodes instructions, manages the pipeline, stores status of operations, and decodes conditional opera- tions. program counter (PC): A register that indicates the location of the next instruction to be executed. program read bus (PRDB): A 16-bit internal bus that carries instruction code and immediat[...]

  • Page 556

    F-19 Glossary receive interrupt (asynchronous serial port): An interrupt (TXRXINT) caused during reception by any one of these events: the ADTR holds a new character; overrun occurs; a framing error occurs; a break has been detected on the RX pin; a character A or a has been detected in the ADTR by the automatic baud-rate detection logic. receive i[...]

  • Page 557

    F-20 RPTC: See repeat counter (RPTC). RRST : Receive reset bit . Bit 4 of the synchronous serial port control register (SSPCR); resets the receiver portion of the synchronous serial port. RS : Reset pin . When driven low , causes a reset on any ’C2xx device, includ- ing the ’C209. RS: Reset pin . (On the ’C209 only) When driven high, causes a[...]

  • Page 558

    F-21 Glossary single-access RAM: See SARAM . slave phase: See latch phase . SOFT bit (asynchronous serial port): Bit 14 in the asynchronous serial port control register (ASPCR); a special emulation bit that is used in con- junction with bit 15 (FREE) to determine the state of an asynchronous serial port transfer when a software breakpoint is encoun[...]

  • Page 559

    F-22 status registers ST0 and ST1: T wo 16-bit registers that contain bits for de- termining processor modes, addressing pointer values, and indicating various processor conditions and arithmetic logic results. These regis- ters can be stored into and loaded from data memory , allowing the status of the machine to be saved and restored for subrouti[...]

  • Page 560

    F-23 Glossary TIM bit: T ransmit interrupt mask bit . Bit 8 of the asynchronous serial port control register (ASPCR); enables or disables transmit interrupts of the asynchronous serial port. TIM register: See timer counter register (TIM) . timer counter register (TIM): A 16-bit memory-mapped register that holds the main count for the on-chip timer [...]

  • Page 561

    F-24 transmit mode (TXM) bit: Bit 3 of the synchronous serial port control regis- ter (SSPCR); determines whether the source signal for frame synchro- nization is external or internal. transmit pin (asynchronous serial port): See TX pin . transmit pin (synchronous serial port): See DX pin . transmit/receive interrupt (TXRXINT): The CPU interrupt us[...]

  • Page 562

    F-25 Glossary URST : Reset asynchronous serial port bit . Bit 13 of the asynchronous serial port control register (ASPCR); resets the asynchronous port. V vector: See interrupt vector . vector location: See interrupt vector location . W wait state : A CLKOUT1 cycle during which the CPU waits when reading from or writing to slower external memory . [...]

  • Page 563

    F-26 Z zero fill: Fill the unused low or high order bits in a register with zeros. Glossary[...]

  • Page 564

    Index Index-1 Index * operand 6-10 *+ operand 6-10 *– operand 6-10 *0+ operand 6-10 *0– operand 6-10 *BR0+ operand 6-1 1 *BR0– operand 6-1 1 14-pin connector , dimensions E-15 14-pin header header signals E-2 JT AG E-2 4-level pipeline operation 5-7 A A0–A15 (external address bus) definition 4-3 shown in figure 4-6, 4-10, 4-13, 4-15, 4-26 A[...]

  • Page 565

    Index Index-2 accumulator instructions (continued) store high byte of accumulator to data memory (SACH) 7-148 store low byte of accumulator to data memory (SACL) 7-150 subtract conditionally from accumulator (SUBC) 7-180 subtract PREG from accumulator (SP AC) 7-160 subtract PREG from accumulator and load TREG (L TS) 7-100 subtract PREG from accumul[...]

  • Page 566

    Index Index-3 asynchronous serial port (continued) baud-rate detection logic detecting A or a character (ADC bit) 10-10 enabling/disabling (CAD bit) 10-8 block diagram 10-3 components 10-3 configuration 10-7 delta interrupts 10-17 enabling/disabling (DIM bit) 10-8 emulation modes (FREE and SOFT bits) 10-7 features 10-1 interrupts (TXRXINT s) flag b[...]

  • Page 567

    Index Index-4 B B instruction 7-39 BACC instruction 7-40 BANZ instruction 7-41 baud-rate detection procedure 10-14 divisor register (BRD) 10-13 generator 10-4 BCND instruction 7-43 BI bit 10-10 BIO pin 8-17 to 8-18 BIT instruction 7-45 bit-reversed indexed addressing 6-10, F-3 BITT instruction 7-47 BLDD instruction 7-49 block diagrams ’C2xx overa[...]

  • Page 568

    Index Index-5 bus request pin (BR ) definition 4-3 shown in figure 4-13, 4-15 buses block diagram 2-4 data read bus (DRDB) 2-3 data write bus (DWEB) 2-3 data-read address bus (DRAB) 2-3 data-write address bus (DW AB) 2-3 program address bus (P AB) definition 2-3 used in program-memory address genera- tion 5-3 program read bus (PRDB) 2-3 C C (carry [...]

  • Page 569

    Index Index-6 CMPR instruction 7-65 CNF (DARAM configuration bit) 3-16 code compatibility 1-6 codec, definition F-5 conditional instructions 5-10 to 5-13 conditional branch 5-1 1 to 5-13 conditional call 5-12 to 5-13 conditional return 5-12 to 5-13 conditions that may be tested 5-10 stabilization of conditions 5-1 1 using multiple conditions 5-10 c[...]

  • Page 570

    Index Index-7 data memory select pin (DS ) definition 4-3 shown in figure 4-10, 4-13 data page 0 4-8 caution about test/emulation addresses 4-8 data page pointer (DP) caution about initializing DP 6-5 definition 3-16 load (LDP instruction) 7-83 role in direct addressing 6-4 data read bus (DRDB) 2-3 data write bus (DWEB) 2-3 data-read address bus (D[...]

  • Page 571

    Index Index-8 emulator cable pod E-5 connection to target system, JT AG mechanical dimensions E-14 to E-25 designing the JT AG cable E-1 emulation pins E-20 pod interface E-5 pod timings E-6 signal buffering E-10 to E-13 target cable, header design E-2 to E-3 enhanced instructions B-5 error conditions asynchronous serial port framing error (FE bit)[...]

  • Page 572

    Index Index-9 H hardware interrupts definition 5-15 nonmaskable external 5-27 priorities 5-16 types 5-15 hardware reset 5-33 header 14-pin E-2 dimensions, 14-pin E-2 HOLD (HOLD operation request pin) definition 4-4 use in HOLD operation 4-27 HOLD acknowledge pin (HOLDA) definition 4-4 use in HOLD operation 4-27 HOLD operation description 4-27 durin[...]

  • Page 573

    Index Index-10 IMR (interrupt mask register) 5-22 to 5-38 bits ’C203/C204 5-23 ’C209 1 1-13 in interrupt acknowledgement process 5-19 quick reference A-7 IN instruction 7-69 IN0 bit 9-10 indirect addressing description 6-9 effects on auxiliary register pointer (ARP) 6-14 to 6-16 effects on current auxiliary register 6-14 to 6-16 examples 6-15 m[...]

  • Page 574

    Index Index-1 1 INT1 interrupt ’C203/C204 flag bit (HOLD/INT1) 5-22 mask bit (HOLD/INT1) 5-24 priority 5-16 vector location 5-16 ’C209 flag bit 1 1-12 mask bit 1 1-13 priority 1 1-10 vector location 1 1-10 INT2 bit (’C209) in interrupt flag register (IFR) 1 1-12 in interrupt mask register (IMR) 1 1-13 INT2 interrupt ’C203/C204 flag bits FIN[...]

  • Page 575

    Index Index-12 interrupt (continued) phases of operation 5-15 priorities ’C203/C204 5-16 ’C209 1 1-10 in interrupt acknowledgement process 5-19 registers interrupt control register (ICR) 5-24 interrupt flag register (IFR) 5-20 to 5-22 ’C209 1 1-12 interrupt mask register (IMR) 5-22 to 5-24 ’C209 1 1-13 software interrupt definition 5-15 ins[...]

  • Page 576

    Index Index-13 L LACC instruction 7-72 LACL instruction 7-75 LACT instruction 7-78 LAR instruction 7-80 latch phase of CPU cycle F-13 latency , interrupt 5-30 to 5-36 after execution of RET 5-32 during execution of CLRC INTM 5-31 minimum latency 5-30 LDP instruction 7-83 local data memory address map ’C203 4-32 ’C204 4-35 ’C209 1 1-6 configur[...]

  • Page 577

    Index Index-14 memory (continued) introduction 4-2 local data memory description 4-7 to 4-10 pages of (diagram) 4-7 on-chip memory , advantages 4-2 organization 4-2 overview 2-7 pins for external interfacing 4-3 program memory 4-5 to 4-6 address generation logic 5-2 address sources 5-3 RAM (dual-access) configuration ’C203 4-33 ’C204 4-36 ’C2[...]

  • Page 578

    Index Index-15 next program address register (NP AR) definition F-15 shown in figure 5-2 NMI hardware interrupt description 5-27 priority ’C203/C204 5-17 ’C209 1 1-1 1 vector location ’C203/C204 5-17 ’C209 1 1-1 1 NMI instruction 7-124 introduction 5-28 vector location ’C203/C204 5-17 ’C209 1 1-1 1 nonmaskable interrupts 5-27 definition[...]

  • Page 579

    Index Index-16 OUT instruction 7-132 output modes external count E-20 signal event E-20 output shifter 3-1 1 OV (overflow flag bit) 3-16 overflow in accumulator detecting (OV bit) 3-16 enabling/disabling overflow mode (OVM bit) 3-17 overflow in synchronous serial port burst mode 9-29 continuous mode 9-30 detecting (OVF bit) 9-10 overflow mode bit ([...]

  • Page 580

    Index Index-17 PREG instructions (continued) load high bits of PREG (LPH) 7-85 set PREG output shift mode (SPM) 7-167 store high word of PREG to data memory (SPH) 7-161 store low word of PREG to data memory (SPL) 7-163 store PREG to accumulator (P AC instruc- tion) 7-134 store PREG to accumulator and load TREG (L TP) 7-98 subtract PREG from accumul[...]

  • Page 581

    Index Index-18 program memory (continued) configuration RAM (dual-access) ’C203 4-33 ’C204 4-36 ’C209 1 1-8 RAM (single-access) 1 1-7 ROM ’C204 4-36 ’C209 1 1-7 description 4-5 external interfacing 4-5 caution about proper timing 4-5 program memory select pin (PS) definition 4-3 shown in figure 4-6 program read bus (PRDB) 2-3 program-addr[...]

  • Page 582

    Index Index-19 registers (continued) mapped to data page 0 4-8 mapped to I/O space ’C203/C204 4-24 ’C209 1 1-9 accessing 4-25 quick reference A-1 to A-14 status registers ST0 and ST1 3-15 timer control register (TCR) ’C203/C204 8-10 ’C209 1 1-16 counter register (TIM) 8-12, F-23 divide-down register (TDDR) ’C203/C204 8-12 ’C209 1 1-16 p[...]

  • Page 583

    Index Index-20 S SACH instruction 7-148 SACL instruction 7-150 SAR instruction 7-152 SARAM (single-access RAM) configuration 1 1-7 definition F-20 description 2-8 SBRK instruction 7-154 scaling shifters input shifter 3-3 introduction 2-5 output shifter 3-1 1 product shifter 3-6 product shift modes 3-7 scan path linkers E-16 secondary JT AG scan cha[...]

  • Page 584

    Index Index-21 status registers ST0 and ST1 addresses and reset values A-2 bits 3-15 clear control bit (CLRC instruction) 7-62 introduction 3-15 load (LST instruction) 7-87 load data page pointer (LDP instruction) 7-83 modify auxiliary register pointer (MAR instruc- tion) 7-1 1 1 quick reference A-5 set control bit (SETC instruction) 7-155 set prod[...]

  • Page 585

    Index Index-22 synchronous serial port (continued) troubleshooting bits for testing the port 9-27 error conditions burst mode 9-29 continuous mode 9-29 underflow in transmitter burst mode 9-29 continuous mode 9-29 synchronous serial port registers control register (SSPCR) description 9-8 quick reference A-12 FIFO buffers detecting data in receive F[...]

  • Page 586

    Index Index-23 timer control register (TCR) 8-10 to 8-12 ’C209 1 1-15 quick reference A-9 timer counter register (TIM) 8-12, F-23 to F-26 timer period register (PRD) 8-12, F-23 to F-26 timing calculations E-7 to E-9, E-18 to E-26 TINT bit ’C203/C204 in interrupt flag register (IFR) 5-22 in interrupt mask register (IMR) 5-23 ’C209 in interrupt[...]

  • Page 587

    Index Index-24 TSS bit ’C203/C204 8-12 ’C209 1 1-16 TX pin 10-4 TXM bit 9-1 1 TXRXINT bit in interrupt flag register (IFR) 5-21 in interrupt mask register (IMR) 5-23 TXRXINT interrupt flag bit 5-21 mask bit in IMR 5-23 priority 5-16 vector location 5-16 U unconditional instructions unconditional branch 5-8 unconditional call 5-8 unconditional r[...]