Download  Print this page

Hitachi H8/3022 Hardware Manual

H8/3022 series hitachi single-chip microcomputer.
Hide thumbs
   
1
2
3
Table of Contents
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
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674

Advertisement

Hitachi Single-Chip Microcomputer
H8/3022 Series
H8/3022, H8/3021, H8/3020
TM
H8/3022 F-ZTAT
Hardware Manual
ADE-602-179
Rev. 1.0
12/6/99
Hitachi,Ltd

Advertisement

Table of Contents

   Related Manuals for Hitachi H8/3022

   Summary of Contents for Hitachi H8/3022

  • Page 1 Hitachi Single-Chip Microcomputer H8/3022 Series H8/3022, H8/3021, H8/3020 H8/3022 F-ZTAT Hardware Manual ADE-602-179 Rev. 1.0 12/6/99 Hitachi,Ltd...
  • Page 2 Cautions 1. Hitachi neither warrants nor grants licenses of any rights of Hitachi’s or any third party’s patent, copyright, trademark, or other intellectual property rights for information contained in this document. Hitachi bears no responsibility for problems that may arise with third party’s rights, including intellectual property rights, in connection with use of the information contained in this document.
  • Page 3 The five MCU operating modes offer a choice of expanded mode, single-chip mode, and address space size, enabling the H8/3022 Series to adapt quickly and flexibly to a variety of conditions. In addition to its masked-ROM versions, the H8/3022 Series has an F-ZTAT * version with user programmable on-chip flash memory that can be programmed on-board.
  • Page 4: Table Of Contents

    Contents Section 1 Overview ......................Overview ..........................Block Diagram........................Pin Description ........................1.3.1 Pin Arrangement ....................1.3.2 Pin Functions......................Pin Functions........................11 Section 2 ........................15 Overview ..........................15 2.1.1 Features ......................... 15 2.1.2 Differences from H8/300 CPU................16 CPU Operating Modes ....................... 17 Address Space ........................
  • Page 5 2.9.1 Overview ....................... 52 2.9.2 On-Chip Memory Access Timing ................. 52 2.9.3 On-Chip Supporting Module Access Timing............53 2.9.4 Access to External Address Space ................ 54 Section 3 MCU Operating Modes ................. 55 Overview ..........................55 3.1.1 Operating Mode Selection ..................55 3.1.2 Register Configuration ..................
  • Page 6 5.2.3 IRQ Status Register (ISR) ..................87 5.2.4 IRQ Enable Register (IER) ................... 88 5.2.5 IRQ Sense Control Register (ISCR)..............89 Interrupt Sources ........................ 90 5.3.1 External Interrupts....................90 5.3.2 Internal Interrupts....................91 5.3.3 Interrupt Vector Table ................... 91 Interrupt Operation ......................94 5.4.1 Interrupt Handling Process..................
  • Page 7 Port 2 ..........................135 7.3.1 Overview ....................... 135 7.3.2 Register Descriptions .................... 136 7.3.3 Pin Functions in Each Mode ................. 138 7.3.4 Input Pull-Up Transistors..................140 Port 3 ..........................141 7.4.1 Overview ....................... 141 7.4.2 Register Descriptions .................... 141 7.4.3 Pin Functions in Each Mode .................
  • Page 8 8.1.4 Register Configuration ..................191 Register Descriptions......................194 8.2.1 Timer Start Register (TSTR)................. 194 8.2.2 Timer Synchro Register (TSNC) ................195 8.2.3 Timer Mode Register (TMDR) ................197 8.2.4 Timer Function Control Register (TFCR) ............200 8.2.5 Timer Output Master Enable Register (TOER) ............ 202 8.2.6 Timer Output Control Register (TOCR) ...............
  • Page 9 9.2.3 Port B Data Direction Register (PBDDR) ............286 9.2.4 Port B Data Register (PBDR)................286 9.2.5 Next Data Register A (NDRA) ................287 9.2.6 Next Data Register B (NDRB)................289 9.2.7 Next Data Enable Register A (NDERA)............... 291 9.2.8 Next Data Enable Register B (NDERB) ...............
  • Page 10 11.2.1 Receive Shift Register (RSR)................327 11.2.2 Receive Data Register (RDR) ................327 11.2.3 Transmit Shift Register (TSR) ................328 11.2.4 Transmit Data Register (TDR)................328 11.2.5 Serial Mode Register (SMR)................. 329 11.2.6 Serial Control Register (SCR)................333 11.2.7 Serial Status Register (SSR).................. 337 11.2.8 Bit Rate Register (BRR)..................
  • Page 11 13.2.3 A/D Control Register (ADCR)................415 13.3 CPU Interface ........................416 13.4 Operation ..........................417 13.4.1 Single Mode (SCAN = 0)..................417 13.4.2 Scan Mode (SCAN = 1) ..................419 13.4.3 Input Sampling and A/D Conversion Time ............421 13.4.4 External Trigger Input Timing ................422 13.5 Interrupts ..........................
  • Page 12 15.7.5 Erase-Verify Mode....................465 15.8 Protection..........................467 15.8.1 Hardware Protection....................467 15.8.2 Software Protection ....................468 15.8.3 Error Protection ..................... 469 15.8.4 NMI Input Disable Conditions................471 15.9 Flash Memory Emulation in RAM..................472 15.10 Flash Memory PROM Mode....................474 15.10.1 Socket Adapters and Memory Map ..............
  • Page 13 17.5 Hardware Standby Mode....................505 17.5.1 Transition to Hardware Standby Mode ..............505 17.5.2 Exit from Hardware Standby Mode ..............505 17.5.3 Timing for Hardware Standby Mode ..............505 17.6 Module Standby Function ....................506 17.6.1 Module Standby Timing..................506 17.6.2 Read/Write in Module Standby................
  • Page 14 Port 5 Block Diagram......................638 Port 6 Block Diagrams ....................... 639 Port 7 Block Diagram......................641 Port 8 Block Diagrams ....................... 642 Port 9 Block Diagrams ....................... 644 Port A Block Diagrams ...................... 648 C.10 Port B Block Diagrams ...................... 651 Appendix D Pin States ......................
  • Page 15: Section 1 Overview

    (SCI), an A/D converter, I/O ports, and other facilities. The H8/3022 Series consists of four models: the H8/3022 with 256 kbytes of ROM and 8 kbytes of RAM, the H8/3021 with 192 kbytes of ROM and 8 kbytes of RAM, and the H8/3020 with 128 kbytes of ROM and 4 kbytes of RAM.
  • Page 16 Signed and unsigned divide instructions (16 bits ÷ 8 bits, 32 bits ÷ 16 bits) • Bit accumulator function • Bit manipulation instructions with register-indirect specification of bit positions Memory H8/3022 • ROM: 256 kbytes • RAM: 8 kbytes H8/3021 •...
  • Page 17 Feature Description • Five 16-bit timer channels, capable of processing up to 12 pulse outputs or 10 16-bit integrated pulse inputs timer unit (ITU) • 16-bit timer counter (channels 0 to 4) • Two multiplexed output compare/input capture pins (channels 0 to 4) •...
  • Page 18 Feature Description • Sleep mode Power-down • Software standby mode state • Hardware standby mode • Module standby function • Programmable System clock frequency division • On-chip clock oscillator Other features Product lineup Model (3V) Package HD64F3022F 80-pin QFP (FP-80A) Flash memory HD64F3022TE 80-pin TQFP (TFP-80C)
  • Page 19: Block Diagram

    1.2 Block Diagram Figure 1-1 shows an internal block diagram of the H8/3022 Series. Port 3 Address bus Data bus (upper) Data bus (lower) EXTAL XTAL ø H8/300H CPU STBY RESO/FWE* Interrupt controller (Flash memory, masked ROM) /WAIT Watchdog timer...
  • Page 20: Pin Description

    1.3 Pin Description 1.3.1 Pin Arrangement Figure 1-2 shows the pin arrangement of the H8/3022 Series. /IRQ /IRQ Top view /TxD (FP-80A, TFP-80C) /RxD /IRQ /SCK /TCLKA /TCLKB /TIOCA /TCLKC /TIOCB /TCLKD /TIOCA /TIOCB /TIOCA /TIOCB Note: * Masked ROM: RESO...
  • Page 21: Pin Functions

    1.3.2 Pin Functions Pin Assignments in Each Mode: Table 1-2 lists the FP-80A and TFP-80C pin assignments in each mode. Table 1-2 FP-80A and TFP-80C Pin Assignments in Each Mode Pin Name Pin No. Mode 1 Mode 3 Mode 5 Mode 6 Mode 7 TIOCA...
  • Page 22 Pin Name Pin No. Mode 1 Mode 3 Mode 5 Mode 6 Mode 7 /WAIT /WAIT /WAIT /WAIT ø ø ø ø ø STBY STBY STBY STBY STBY...
  • Page 23 Pin Name Pin No. Mode 1 Mode 3 Mode 5 Mode 6 Mode 7 EXTAL EXTAL EXTAL EXTAL EXTAL XTAL XTAL XTAL XTAL XTAL RESO/ RESO/ RESO/ RESO/ RESO/ FWE* FWE* FWE* FWE* FWE* /IRQ /IRQ /IRQ /IRQ /IRQ /IRQ /IRQ /IRQ /IRQ...
  • Page 24 Pin Name Pin No. Mode 1 Mode 3 Mode 5 Mode 6 Mode 7 TIOCB TIOCB TIOCB TIOCB TIOCB TCLKD TCLKD TCLKD TCLKD TCLKD TIOCA TIOCA TIOCA TIOCA TIOCA TIOCB TIOCB TIOCB TIOCB TIOCB TIOCA TIOCA TIOCA TIOCA TIOCA TIOCB TIOCB TIOCB Notes: Pins marked NC should be left unconnected.
  • Page 25: Pin Functions

    1.4 Pin Functions Table 1-3 summarizes the pin functions. Table 1-3 Pin Functions Type Symbol Pin No. Name and Function Power Input Power: For connection to the power supply. Connect all V pins to the system power supply. Input Ground: For connection to ground (0 V). Connect all V pins to the 0-V system power supply.
  • Page 26 Type Symbol Pin No. Name and Function System Input Reset input: When driven low, this pin control resets the chip RESO/ Output/ Reset output (Masked ROM version): Input Outputs WDT-generated reset signal to an external device. Write enable signal (F-ZTAT version): Flash memory write control signal.
  • Page 27 Type Symbol Pin No. Name and Function Programm- 8, 6 to 1 Output TPC output 15, 13 to 0 : Pulse output able timing 80 to 73 pattern controller (TPC) Serial com- 70, 9 Output Transmit data:(channels 0 and 1): SCI data output munication interface...
  • Page 28 Type Symbol Pin No. Name and Function I/O ports 72, 11 Input/ Port 9: Six input/output pins. The direction 71, 10 output of each pin can be selected in the port 9 70, 9 data direction register (P9DDR). 80 to 73 Input/ Port A: Eight input/output pins.
  • Page 29: Cpu

    Section 2 CPU 2.1 Overview The H8/300H CPU is a high-speed central processing unit with an internal 32-bit architecture that is upward-compatible with the H8/300 CPU. The H8/300H CPU has sixteen 16-bit general registers, can address a 16-Mbyte linear address space, and is ideal for realtime control. 2.1.1 Features The H8/300H CPU has the following features.
  • Page 30: Differences From H8/300 Cpu

    • High-speed operation  All frequently-used instructions execute in two to four states  Maximum clock frequency: 18 MHz  8/16/32-bit register-register add/subtract: 111 ns  8 × 8-bit register-register multiply: 778 ns  16 ÷ 8-bit register-register divide: 778 ns ...
  • Page 31: Cpu Operating Modes

    2.2 CPU Operating Modes The H8/300H CPU has two operating modes: normal and advanced. Normal mode supports a maximum 64-kbyte address space. Advanced mode supports up to 16 Mbytes. See figure 2-1. Unless specified otherwise, all descriptions in this manual refer to advanced mode. Maximum 64 kbytes, program Normal mode * and data areas combined...
  • Page 32: Address Space

    1-Mbyte mode or 16-Mbyte mode for the address space depending on the MCU operation mode. Figure 2-2 shows the address ranges of the H8/3022 Series. For further details see section 3.6, Memory Map in Each Operating Mode.
  • Page 33: Register Configuration

    2.4 Register Configuration 2.4.1 Overview The H8/300H CPU has the internal registers shown in figure 2-3. There are two types of registers: general registers and control registers. General Registers (ERn) (SP) Control Registers (CR) 6 5 4 3 2 1 0 I UI H U N Z V C Legend Stack pointer...
  • Page 34: General Registers

    2.4.2 General Registers The H8/300H CPU has eight 32-bit general registers. These general registers are all functionally alike and can be used without distinction between data registers and address registers. When a general register is used as a data register, it can be accessed as a 32-bit, 16-bit, or 8-bit register. When the general registers are used as 32-bit registers or as address registers, they are designated by the letters ER (ER0 to ER7).
  • Page 35: Control Registers

    General register ER7 has the function of stack pointer (SP) in addition to its general-register function, and is used implicitly in exception handling and subroutine calls. Figure 2-5 shows the stack. Free area SP (ER7) Stack area Figure 2-5 Stack 2.4.3 Control Registers The control registers are the 24-bit program counter (PC) and the 8-bit condition code register (CCR).
  • Page 36: Initial Cpu Register Values

    Bit 5—Half-Carry Flag (H): When the ADD.B, ADDX.B, SUB.B, SUBX.B, CMP.B, or NEG.B instruction is executed, this flag is set to 1 if there is a carry or borrow at bit 3, and cleared to 0 otherwise. When the ADD.W, SUB.W, CMP.W, or NEG.W instruction is executed, the H flag is set to 1 if there is a carry or borrow at bit 11, and cleared to 0 otherwise.
  • Page 37: Data Formats

    2.5 Data Formats The H8/300H CPU can process 1-bit, 4-bit (BCD), 8-bit (byte), 16-bit (word), and 32-bit (longword) data. Bit-manipulation instructions operate on 1-bit data by accessing bit n (n = 0, 1, 2, …, 7) of byte operand data. The DAA and DAS decimal-adjust instructions treat byte data as two digits of 4-bit BCD data.
  • Page 38: Memory Data Formats

    General Data Type Register Data Format Word data Word data Longword data Legend ERn: General register General register E General register R MSB: Most significant bit LSB: Least significant bit Figure 2-7 General Register Data Formats 2.5.2 Memory Data Formats Figure 2-8 shows the data formats on memory.
  • Page 39 Data Type Address Data Format 1-bit data Address Byte data Address Word data Address 2m Address 2m + 1 Address 2n Longword data Address 2n + 1 Address 2n + 2 Address 2n + 3 Figure 2-8 Memory Data Formats When ER7 (SP) is used as an address register to access the stack, the operand size should be word size or longword size.
  • Page 40: Instruction Set

    PUSH.W Rn is identical to MOV.W Rn, @–SP. POP.L ERn is identical to MOV.L @SP+, Rn. PUSH.L ERn is identical to MOV.L Rn, @–SP. 2. These instructions are not available on the H8/3022 Series. 3. Bcc is a generic branching instruction.
  • Page 41: Instructions And Addressing Modes

    2.6.2 Instructions and Addressing Modes Table 2-2 indicates the instructions available in the H8/300H CPU. Table 2-2 Instructions and Addressing Modes Addressing Modes (d:16, (d:24, @ERn+/ (d:8, (d:16, Function Instruction #xx Rn ERn) ERn) @–ERn aa:8 aa:16 aa:24 aa:8 Implied Data BWL BWL BWL BWL BWL BWL BWL —...
  • Page 42 Addressing Modes (d:16, (d:24, @ERn+/ (d:8, (d:16, Function Instruction #xx Rn ERn) ERn) @–ERn aa:8 aa:16 aa:24 aa:8 Implied System TRAPA — — — — — — — — — — — — control — — — — — — —...
  • Page 43: Tables Of Instructions Classified By Function

    2.6.3 Tables of Instructions Classified by Function Tables 2-3 to 2-10 summarize the instructions in each functional category. The operation notation used in these tables is defined as follows. Operation Notation General register (destination)* General register (source)* General register* General register (32-bit register or address register) (EAd) Destination operand (EAs)
  • Page 44 Moves data between two general registers or between a general register and memory, or moves immediate data to a general register. (EAs) → Rd MOVFPE Cannot be used in the H8/3022 Series. Rs → (EAs) MOVTPE Cannot be used in the H8/3022 Series.
  • Page 45 Table 2-4 Arithmetic Operation Instructions Instruction Size* Function Rd ± Rs → Rd, Rd ± #IMM → Rd ADD, B/W/L Performs addition or subtraction on data in two general registers, or on immediate data and data in a general register. (Immediate byte data cannot be subtracted from data in a general register.
  • Page 46 Instruction Size* Function Rd ÷ Rs → Rd DIVXU Performs unsigned division on data in two general registers: either 16 bits ÷ 8 bits → 8-bit quotient and 8-bit remainder or 32 bits ÷ 16 bits → 16-bit quotient and 16-bit remainder. Rd ÷...
  • Page 47 Table 2-5 Logic Operation Instructions Instruction Size* Function Rd ∧ Rs → Rd, Rd ∧ #IMM → Rd B/W/L Performs a logical AND operation on a general register and another general register or immediate data. Rd ∨ Rs → Rd, Rd ∨ #IMM → Rd B/W/L Performs a logical OR operation on a general register and another general register or immediate data.
  • Page 48 Table 2-7 Bit Manipulation Instructions Instruction Size* Function 1 → (<bit-No.> of <EAd>) BSET Sets a specified bit in a general register or memory operand to 1. The bit number is specified by 3-bit immediate data or the lower 3 bits of a general register.
  • Page 49 Instruction Size* Function C ∨ (<bit-No.> of <EAd>) → C ORs the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. C ∨ [¬ (<bit-No.> of <EAd>)] → C BIOR ORs the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag.
  • Page 50 Table 2-8 Branching Instructions Instruction Size Function — Branches to a specified address if a specified condition is true. The branching conditions are listed below. Mnemonic Description Condition BRA (BT) Always (true) Always BRN (BF) Never (false) Never C ∨ Z = 0 High C ∨...
  • Page 51 Table 2-9 System Control Instructions Instruction Size* Function TRAPA — Starts trap-instruction exception handling — Returns from an exception-handling routine SLEEP — Causes a transition to the power-down state (EAs) → CCR Moves the source operand contents to the condition code register. The condition code register size is one byte, but in transfer from memory, data is read by word access.
  • Page 52 Table 2-10 Block Transfer Instruction Instruction Size Function if R4L ≠ 0 then EEPMOV.B — @ER5+ → @ER6+, R4L – 1 → R4L repeat until R4L = 0 else next; if R4 ≠ 0 then EEPMOV.W — @ER5+ → @ER6+, R4 – 1 → R4 repeat until R4 = 0...
  • Page 53: Basic Instruction Formats

    2.6.4 Basic Instruction Formats The H8/300H instructions consist of 2-byte (1-word) units. An instruction consists of an operation field (OP field), a register field (r field), an effective address extension (EA field), and a condition field (cc). Operation Field: Indicates the function of the instruction, the addressing mode, and the operation to be carried out on the operand.
  • Page 54: Notes On Use Of Bit Manipulation Instructions

    2.6.5 Notes on Use of Bit Manipulation Instructions The BSET, BCLR, BNOT, BST, and BIST instructions read a byte of data, modify a bit in the byte, then write the byte back. Care is required when these instructions are used to access registers with write-only bits, or to access ports.
  • Page 55: Addressing Modes And Effective Address Calculation

    As a result, PA DDR is cleared to 0, making PA an input pin. In addition, PA DDR and DDR are set to 1, making PA and PA output pins. The BCLR instruction can be used to clear flags in the on-chip registers. In an interrupt-handling routine, for example, if it is known that the flag is set to 1, it is not necessary to read the flag ahead of time.
  • Page 56 3 Register Indirect with Displacement—@(d:16, ERn) or @(d:24, ERn): A 16-bit or 24-bit displacement contained in the instruction code is added to the contents of an address register (ERn) specified by the register field of the instruction, and the lower 24 bits of the sum specify the address of a memory operand.
  • Page 57: Effective Address Calculation

    The instruction codes of the ADDS, SUBS, INC, and DEC instructions contain immediate data implicitly. The instruction codes of some bit manipulation instructions contain 3-bit immediate data specifying a bit number. The TRAPA instruction code contains 2-bit immediate data specifying a vector address. 7 Program-Counter Relative—@(d:8, PC) or @(d:16, PC): This mode is used in the Bcc and BSR instructions.
  • Page 61: Processing States

    2.8 Processing States 2.8.1 Overview The H8/300H CPU has four processing states: the program execution state, exception-handling state, power-down state, and reset state. The power-down state includes sleep mode, software standby mode, and hardware standby mode. Figure 2-11 classifies the processing states. Figure 2-13 indicates the state transitions.
  • Page 62: Program Execution State

    2.8.2 Program Execution State In this state the CPU executes program instructions in normal sequence. 2.8.3 Exception-Handling State The exception-handling state is a transient state that occurs when the CPU alters the normal program flow due to a reset, interrupt, or trap instruction. The CPU fetches a starting address from the exception vector table and branches to that address.
  • Page 63 Reset External interrupts Exception Interrupt sources Internal interrupts (from on-chip supporting modules) Trap instruction Figure 2-12 Classification of Exception Sources Program execution state SLEEP instruction with SSBY = 0 Exception End of exception Sleep mode handling SLEEP instruction Interrupt with SSBY = 1 NMI, IRQ , IRQ , or IRQ interrupt Exception-handling state...
  • Page 64: Exception-handling Sequences

    2.8.4 Exception-Handling Sequences Reset Exception Handling: Reset exception handling has the highest priority. The reset state is entered when the RES signal goes low. Reset exception handling starts after that, when RES changes from low to high. When reset exception handling starts the CPU fetches a start address from the exception vector table and starts program execution from that address.
  • Page 65: Reset State

    2.8.5 Reset State When the RES input goes low all current processing stops and the CPU enters the reset state. The I bit in the condition code register is set to 1 by a reset. All interrupts are masked in the reset state. Reset exception handling starts when the RES signal changes from low to high.
  • Page 66: Basic Operational Timing

    2.9 Basic Operational Timing 2.9.1 Overview The H8/300H CPU operates according to the system clock (ø). The interval from one rise of the system clock to the next rise is referred to as a “state.” A memory cycle or bus cycle consists of two or three states.
  • Page 67: On-chip Supporting Module Access Timing

    ø Address bus Address RD WR High High impedance to D Figure 2-16 Pin States during On-Chip Memory Access 2.9.3 On-Chip Supporting Module Access Timing The on-chip supporting modules are accessed in three states. The data bus is 8 or 16 bits wide, depending on the register being accessed.
  • Page 68: Access To External Address Space

    ø Address bus Address RD WR High High impedance to D Figure 2-18 Pin States during Access to On-Chip Supporting Modules 2.9.4 Access to External Address Space The external address space is divided into eight areas (areas 0 to 7). Bus-controller settings determine whether each area accessed in two or three states.
  • Page 69: Mcu Operating Modes

    Section 3 MCU Operating Modes 3.1 Overview 3.1.1 Operating Mode Selection The H8/3022 Series has five operating modes (modes 1, 3, 5 to7) that are selected by the mode pins (MD and MD ) as indicated in table 3-1. The input at these pins determines expanded mode or single-chip mode.
  • Page 70: Register Configuration

    Mode 7 is an advanced mode with a maximum address space of 1 Mbyte. The H8/3022 Series can be used only in modes 1, 3, or 5 to 7. The inputs at the mode pins must select one of these seven modes. The inputs at the mode pins must not be changed during operation.
  • Page 71: Mode Control Register (mdcr)

    3.2 Mode Control Register (MDCR) MDCR is an 8-bit read-only register that indicates the current operating mode of the H8/3022 Series. — — — — — MDS2 MDS1 MDS0 Initial value — — — Read/Write — — — — —...
  • Page 72: System Control Register (syscr)

    3.3 System Control Register (SYSCR) SYSCR is an 8-bit register that controls the operation of the H8/3022 Series. SSBY STS2 STS1 STS0 NMIEG — RAME Initial value Read/Write — RAM enable Enables or disables on-chip RAM Reserved bit NMI edge select...
  • Page 73 Bits 6 to 4—Standby Timer Select (STS2 to STS0): These bits select the length of time the CPU and on-chip supporting modules wait for the internal clock oscillator to settle when software standby mode is exited by an external interrupt. Set these bits so that the waiting time will be at least 7 ms at the system clock rate.
  • Page 74: Operating Mode Descriptions

    3.4.5 Mode 7 This mode is an advanced mode with a 1-Mbyte address space which operates using the on-chip ROM, RAM, and registers. All I/O ports are available. Note: The H8/3022 Series cannot be used in mode 2 and 4.
  • Page 75: Pin Functions In Each Operating Mode

    3.6 Memory Map in Each Operating Mode Figure 3-1 shows a memory map of the H8/3022. Figure 3-2 shows a memory map of the H8/3021. Figure 3-3 shows a memory map of the H8/3020. The address space is divided into eight areas.
  • Page 76 H'FF8000 H'FFFFF H'FFDF0F H'FFDF10 On-chip RAM * H'FFFF00 H'FFFF0F H'FFFF10 External address space H'FFFF1B H'FFFF1C Internal I/O registers H'FFFFFF Note: * External addresses can be accessed by disabling on-chip RAM. Figure 3-1 H8/3022 Memory Map in Each Operating Mode (1)
  • Page 77 H'FFF1B H'FFFF1B H'FFF1C H'FFF1C H'FFFF1C Internal I/O Internal I/O Internal I/O registers registers registers H'FFFFF H'FFFFF H'FFFFFF Note: * External addresses can be accessed by disabling on-chip RAM. Figure 3-1 H8/3022 Memory Map in Each Operating Mode (2)
  • Page 78 Mode 1 Mode 3 (1-Mbyte expanded modes with (16-Mbyte expanded modes with on-chip ROM disabled) on-chip ROM disabled) H'00000 H'000000 Vector area Vector area H'000FF H'0000FF H'07FFF H'007FFF Area 0 Area 0 H'1FFFF H'20000 H'1FFFFF Area 1 H'3FFFF H'200000 H'40000 Area 1 Area 2 H'5FFFF...
  • Page 79 Mode 5 Mode 6 Mode 7 (1-Mbyte expanded mode with (16-Mbyte expanded mode with (single-chip advanced mode) on-chip ROM enabled) on-chip ROM enabled) H'00000 H'00000 H'000000 Vector area Vector area Vector area H'000FF H'000FF H'0000FF On-chip ROM On-chip ROM On-chip ROM H'07FFF H'007FFF H'07FFF...
  • Page 80 Mode 1 Mode 3 (1-Mbyte expanded modes with (16-Mbyte expanded modes with on-chip ROM disabled) on-chip ROM disabled) H'00000 H'000000 Vector area Vector area H'000FF H'0000FF H'07FFF H'007FFF Area 0 Area 0 H'1FFFF H'20000 H'1FFFFF Area 1 H'3FFFF H'200000 H'40000 Area 1 Area 2 H'5FFFF...
  • Page 81 Mode 5 Mode 6 Mode 7 (1-Mbyte expanded mode with (16-Mbyte expanded mode with (single-chip advanced mode) on-chip ROM enabled) on-chip ROM enabled) H'00000 H'00000 H'000000 Vector area Vector area Vector area H'000FF H'000FF H'0000FF On-chip ROM On-chip ROM On-chip ROM H'07FFF H'07FFF H'007FFF...
  • Page 82: Exception Handling

    Section 4 Exception Handling 4.1 Overview 4.1.1 Exception Handling Types and Priority As table 4-1 indicates, exception handling may be caused by a reset, trap instruction, or interrupt. Exception handling is prioritized as shown in table 4-1. If two or more exceptions occur simultaneously, they are accepted and processed in priority order.
  • Page 83: Exception Vector Table

    4.1.3 Exception Vector Table The exception sources are classified as shown in figure 4-1. Different vectors are assigned to different exception sources. Table 4-2 lists the exception sources and their vector addresses. • Reset External interrupts: NMI, IRQ , IRQ , IRQ , IRQ Exception •...
  • Page 84 Table 4-2 Exception Vector Table Vector Address* Exception Source Vector Number Normal Mode Advanced Mode Reset H'0000 to H'0001 H'0000 to H'0003 Reserved for system use H'0002 to H'0003 H'0004 to H'0007 H'0004 to H'0005 H'0008 to H'000B H'0006 to H'0007 H'000C to H'000F H'0008 to H'0009 H'0010 to H'0013...
  • Page 85: Reset

    "Low" level for a least 1usec. See appendix D.2, Pin States at Reset, for the states of the pins in the reset state. When the RES pin goes high after being held low for the necessary time, the H8/3022 Series chip starts reset exception handling as follows.
  • Page 86 Figure 4-2 Reset Sequence (Modes 5 and 7)
  • Page 87: Interrupts After Reset

    4.2.3 Interrupts after Reset If an interrupt is accepted after a reset but before the stack pointer (SP) is initialized, PC and CCR will not be saved correctly, leading to a program crash. To prevent this, all interrupt requests, including NMI, are disabled immediately after a reset. The first instruction of the program is always executed immediately after the reset state ends.
  • Page 88: Trap Instruction

    4.4 Trap Instruction Trap instruction exception handling starts when a TRAPA instruction is executed. If the UE bit is set to 1 in the system control register (SYSCR), the exception handling sequence sets the I bit to 1 in CCR. If the UE bit is 0, the I and UI bits are both set to 1. The TRAPA instruction fetches a start address from a vector table entry corresponding to a vector number from 0 to 3, which is specified in the instruction code.
  • Page 89: Notes On Stack Usage

    4.6 Notes on Stack Usage When accessing word data or longword data, the H8/3022 Series regards the lowest address bit as 0. The stack should always be accessed by word access or longword access, and the value of the stack pointer (SP, ER7) should always be kept even. Use the following instructions to save registers: PUSH.W Rn...
  • Page 90: Interrupt Controller

    Section 5 Interrupt Controller 5.1 Overview 5.1.1 Features The interrupt controller has the following features: • Interrupt priority registers (IPRs) for setting interrupt priorities Interrupts other than NMI can be assigned to two priority levels on a module-by-module basis in interrupt priority registers A and B (IPRA and IPRB). •...
  • Page 91: Block Diagram

    5.1.2 Block Diagram Figure 5-1 shows a block diagram of the interrupt controller. ISCR IPRA, IPRB input IRQ input IRQ input section ISR Interrupt request Priority decision logic Vector number ADIE Interrupt controller SYSCR Legend Interrupt mask bit IER: IRQ enable register IPRA: Interrupt priority register A IPRB:...
  • Page 92: Pin Configuration

    5.1.3 Pin Configuration Table 5-1 lists the interrupt pins. Table 5-1 Interrupt Pins Name Abbreviation Function Nonmaskable interrupt Input Nonmaskable interrupt, rising edge or falling edge selectable , IRQ External interrupt Input Maskable interrupts, falling edge or level and IRQ , IRQ request 5, 4, 1, and 0 sensing selectable...
  • Page 93: Register Descriptions

    5.2 Register Descriptions 5.2.1 System Control Register (SYSCR) SYSCR is an 8-bit readable/writable register that controls software standby mode, selects the action of the UI bit in CCR, selects the NMI edge, and enables or disables the on-chip RAM. Only bits 3 and 2 are described here. For the other bits, see section 3.3, System Control Register (SYSCR).
  • Page 94 Bit 3—User Bit Enable (UE): Selects whether to use the UI bit in CCR as a user bit or an interrupt mask bit. Bit 3 Description UI bit in CCR is used as interrupt mask bit UI bit in CCR is used as user bit (Initial value) Bit 2—NMI Edge Select (NMIEG): Selects the NMI input edge.
  • Page 95: Interrupt Priority Registers A And B (ipra, Iprb)

    5.2.2 Interrupt Priority Registers A and B (IPRA, IPRB) IPRA and IPRB are 8-bit readable/writable registers that control interrupt priority. Interrupt Priority Register A (IPRA): IPRA is an 8-bit readable/writable register in which interrupt priority levels can be set. IPRA7 IPRA6 —...
  • Page 96 Bit 7—Priority Level A7 (IPRA7): Selects the priority level of IRQ interrupt requests. Bit7 IPRA7 Description interrupt requests have priority level 0 (low priority) (Initial value) interrupt requests have priority level 1 (high priority) Bit 6—Priority Level A6 (IPRA6): Selects the priority level of IRQ interrupt requests.
  • Page 97 Bit 1—Priority Level A1 (IPRA1): Selects the priority level of ITU channel 1 interrupt requests. Bit1 IPRA1 Description ITU channel 1 interrupt requests have priority level 0 (low priority) (Initial value) ITU channel 1 interrupt requests have priority level 1 (high priority) Bit 0—Priority Level A0 (IPRA0): Selects the priority level of ITU channel 2 interrupt requests.
  • Page 98 Interrupt Priority Register B (IPRB): IPRB is an 8-bit readable/writable register in which interrupt priority levels can be set. IPRB7 IPRB6 — — IPRB3 IPRB2 IPRB1 — Initial value Read/Write Reserved bit Priority level B1 Selects the priority level of A/D converter interrupt request Priority level B2 Selects the priority level of SCI...
  • Page 99 Bit 7—Priority Level B7 (IPRB7): Selects the priority level of ITU channel 3 interrupt requests. Bit7 IPRB7 Description ITU channel 3 interrupt requests have priority level 0 (low priority) (Initial value) ITU channel 3 interrupt requests have priority level 1 (high priority) Bit 6—Priority Level B6 (IPRB6): Selects the priority level of ITU channel 4 interrupt requests.
  • Page 100: Irq Status Register (isr)

    5.2.3 IRQ Status Register (ISR) ISR is an 8-bit readable/writable register that indicates the status of IRQ , IRQ , IRQ , and IRQ interrupt requests. — — IRQ5F IRQ4F — — IRQ1F IRQ0F Initial value Read/Write — — R/(W)* R/(W) * —...
  • Page 101: Irq Enable Register (ier)

    5.2.4 IRQ Enable Register (IER) IER is an 8-bit readable/writable register that enables or disables IRQ , IRQ , IRQ , and IRQ interrupt requests. — — IRQ5E IRQ4E — — IRQ1E IRQ0E Initial value Read/Write Reserved bits Reserved bits IRQ to IRQ enable IRQ to IRQ enable These bits enable or disable...
  • Page 102: Irq Sense Control Register (iscr)

    5.2.5 IRQ Sense Control Register (ISCR) ISCR is an 8-bit readable/writable register that selects level sensing or falling-edge sensing of the inputs at pins IRQ , IRQ , IRQ , and IRQ — — IRQ5SC IRQ4SC — — IRQ1SC IRQ0SC Initial value Read/Write Reserved bits...
  • Page 103: Interrupt Sources

    5.3 Interrupt Sources The interrupt sources include external interrupts (NMI, IRQ , IRQ , IRQ and IRQ ) and 25 internal interrupts. 5.3.1 External Interrupts There are five external interrupts: NMI, and IRQ , IRQ , IRQ , and IRQ .
  • Page 104: Internal Interrupts

    Figure 5-3 shows the timing of the setting of the interrupt flags (IRQnF). ø IRQn input pin IRQnF Note: n = 5, 4, 1 and 0 Figure 5-3 Timing of Setting of IRQnF Interrupts IRQ , IRQ , IRQ , IRQ have vector numbers 17, 16, 13, 12.
  • Page 105 Table 5-3 Interrupt Sources, Vector Addresses, and Priority Vector Address* Vector Interrupt Source Origin Number Normal Mode Advanced Mode Priority External pins H'000E to H'000F H'001C to H'001F — High H'0018 to H'0019 H'0030 to H'0033 IPRA7 H'001A to H'001B H'0034 to H0037 IPRA6 Reserved —...
  • Page 106 Vector Address* Vector Interrupt Source Origin Number Normal Mode Advanced Mode Priority IMIA3 (compare match/ ITU channel 3 H'0048 to H'0049 H'0090 to H'0093 IPRB7 input capture A3) IMIB3 (compare match/ H'004A to H'004B H'0094 to H'0097 input capture B3) OVI3 (overflow 3) H'004C to H'004D H'0098 to H'009B...
  • Page 107: Interrupt Operation

    5.4.1 Interrupt Handling Process The H8/3022 Series handles interrupts differently depending on the setting of the UE bit. When UE = 1, interrupts are controlled by the I bit. When UE = 0, interrupts are controlled by the I and UI bits.
  • Page 108 Program execution state Interrupt requested? Pending Priority level 1? I = 0 Save PC and CCR ← Read vector address Branch to interrupt service routine Figure 5-4 Process Up to Interrupt Acceptance when UE = 1...
  • Page 109 • If an interrupt condition occurs and the corresponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. • When the interrupt controller receives one or more interrupt requests, it selects the highest- priority request, following the IPR interrupt priority settings, and holds other requests pending.
  • Page 110 ← All interrupts are Only NMI, IRQ , and ← ← 1, UI unmasked IRQ are unmasked Exception handling, ← ← or I 1, UI ← ← Exception handling, ← or UI All interrupts are masked except NMI Figure 5-5 Interrupt Masking State Transitions (Example) Figure 5-6 is a flowchart showing how interrupts are accepted when UE = 0.
  • Page 111 Program execution state Interrupt requested? Pending Priority level 1? I = 0 I = 0 UI = 0 Save PC and CCR ← ← 1, UI Read vector address Branch to interrupt service routine Figure 5-6 Process Up to Interrupt Acceptance when UE = 0...
  • Page 112: Interrupt Sequence

    5.4.2 Interrupt Sequence Figure 5-7 shows the interrupt sequence in mode 5 when the program code and stack are in an on- chip memory area. Figure 5-7 Interrupt Sequence (Mode 5, Stack in On-Chip Memory)
  • Page 113: Interrupt Response Time

    5.4.3 Interrupt Response Time Table 5-5 indicates the interrupt response time from the occurrence of an interrupt request until the first instruction of the interrupt service routine is executed. Table 5-5 Interrupt Response Time External Memory On-Chip 8-Bit Bus Item Memory 2 States 3 States...
  • Page 114: Usage Notes

    5.5 Usage Notes 5.5.1 Contention between Interrupt and Interrupt-Disabling Instruction When an instruction clears an interrupt enable bit to 0 to disable the interrupt, the interrupt is not disabled until after execution of the instruction is completed. If an interrupt occurs while a BCLR, MOV, or other instruction is being executed to clear its interrupt enable bit to 0, at the instant when execution of the instruction ends the interrupt is still enabled, so its interrupt exception handling is carried out.
  • Page 115: Instructions That Inhibit Interrupts

    5.5.2 Instructions that Inhibit Interrupts The LDC, ANDC, ORC, and XORC instructions inhibit interrupts. When an interrupt occurs, after determining the interrupt priority, the interrupt controller requests a CPU interrupt. If the CPU is currently executing one of these interrupt-inhibiting instructions, however, when the instruction is completed the CPU always continues by executing the next instruction.
  • Page 116 2 Generation conditions (1) A read of the ISR register is executed to clear the IRQaF flag while it is set to 1, then the IRQbF flag is cleared by the execution of interrupt exception handling. (2) When the IRQaF flag is cleared, there is contention with IRQb generation (IRQaF flag setting). (IRQbF was 0 when ISR was read to clear the IRQaF flag, but IRQbF is set to 1 before ISR is written to.) If the above setting conditions (1) to (3) and generation conditions (1) and (3)are all fulfilled,...
  • Page 117 Method 1 When clearing the IRQaF flag, read ISR as a byte unit instead of using a bit-manipulation instruction, and write a byte value that clears the IRQaF flag to 0 and sets the other bits to 1. Example: When a = 0 MOV.B @ISR, R0L MOV.B #HFE, R0L MOV.B R0L, @ISR...
  • Page 118: Bus Controller

    Section 6 Bus Controller 6.1 Overview The H8/3022 Series has an on-chip bus controller that divides the external address space into eight areas and can assign different bus specifications to each. This enables different types of memory to be connected easily.
  • Page 119: Block Diagram

    6.1.2 Block Diagram Figure 6-1 shows a block diagram of the bus controller. ASTCR Internal WCER address bus Area Internal signals decoder Access state control signal Bus control Wait request signal circuit Wait-state WAIT controller Legend ASTCR: Access state control register WCER: Wait state controller enable register WCR:...
  • Page 120: Pin Configuration

    6.1.3 Pin Configuration Table 6-1 summarizes the bus controller’s input/output pins. Table 6-1 Bus Controller Pins Name Abbreviation Function Address strobe Output Strobe signal indicating valid address output on the address bus Read Output Strobe signal indicating reading from the external address space Write Output...
  • Page 121: Register Descriptions

    6.2 Register Descriptions 6.2.1 Access State Control Register (ASTCR) ASTCR is an 8-bit readable/writable register that selects whether each area is accessed in two states or three states. AST7 AST6 AST5 AST4 AST3 AST2 AST1 AST0 Initial value Read/Write Bits selecting number of states for access to each area ASTCR is initialized to H'FF by a reset and in hardware standby mode.
  • Page 122: Wait Control Register (wcr)

    6.2.2 Wait Control Register (WCR) WCR is an 8-bit readable/writable register that selects the wait mode for the wait-state controller (WSC) and specifies the number of wait states. — — — — WMS1 WMS0 Initial value Read/Write — — — —...
  • Page 123: Wait State Controller Enable Register (wcer)

    Bits 1 and 0—Wait Count 1 and 0 (WC1/0): These bits select the number of wait states inserted in access to external three-state-access areas. Bit1 Bit0 Description No wait states inserted by wait-state controller 1 state inserted 2 states inserted 3 states inserted (Initial value) 6.2.3 Wait State Controller Enable Register (WCER)
  • Page 124: Address Control Register (adrcr)

    6.2.4 Address Control Register (ADRCR) ADRCR is an 8-bit readable/writable register that enables address output on bus lines A23 to A21. — — — — — Initial value Modes 1 and 5 to 7 Read/Write — — — — — —...
  • Page 125 Bit 5—Address 21 Enable (A E): Enables PA to be used as the A address output pin. Writing 0 in this bit enables A address output from PA . In modes other than 3 and 6 this bit cannot be modified and PA has its ordinary input/output functions.
  • Page 126: Operation

    6.3 Operation 6.3.1 Area Division The external address space is divided into areas 0 to 7. Each area has a size of 128 kbytes in the 1-Mbyte mode and 2 Mbytes in the 16-Mbyte mode. Figure 6-2 shows a general view of the memory map.
  • Page 127 The bus specifications for each area can be selected in ASTCR, WCER, and WCR as shown in table 6-3. Table 6-3 Bus Specifications ASTCR WCER Bus Specifications Access ASTn WCEn WMS1 WMS0 Width States Wait Mode — — — Disabled —...
  • Page 128: Bus Control Signal Timing

    6.3.2 Bus Control Signal Timing 8-Bit, Three-State-Access Areas: Figure 6-3 shows the timing of bus control signals for an 8-bit, three-state-access area. Wait states can be inserted. Bus cycle ø Address bus External address Read access Valid to D Write access Valid to D...
  • Page 129 8-Bit, Two-State-Access Areas: Figure 6-4 shows the timing of bus control signals for an 8-bit, two-state-access area. Wait states cannot be inserted. Bus cycle ø Address bus External address Read access to D Valid Write access to D Valid Figure 6-4 Bus Control Signal Timing for 8-Bit, Two-State-Access Area...
  • Page 130: Wait Modes

    6.3.3 Wait Modes Four wait modes can be selected for each area as shown in table 6-4. Table 6-4 Wait Mode Selection ASTCR WCER ASTn Bit WCEn Bit WMS1 Bit WMS0 Bit WSC Control Wait Mode — — — Disabled No wait states —...
  • Page 131 Pin Wait Mode 0: The wait state controller is disabled. Wait states can only be inserted by WAIT pin control. During access to an external three-state-access area, if the WAIT pin is low at the fall ) is inserted. If the WAIT pin remains low, of the system clock (ø) in the T state, a wait state (T wait states continue to be inserted until the WAIT signal goes high.
  • Page 132 Pin Wait Mode 1: In all accesses to external three-state-access areas, the number of wait states ) selected by bits WC1 and WC0 are inserted. If the WAIT pin is low at the fall of the system clock (ø) in the last of these wait states, an additional wait state is inserted. If the WAIT pin remains low, wait states continue to be inserted until the WAIT signal goes high.
  • Page 133 Pin Auto-Wait Mode: If the WAIT pin is low, the number of wait states (T ) selected by bits WC1 and WC0 are inserted. In pin auto-wait mode, if the WAIT pin is low at the fall of the system clock (ø) in the T state, the number of wait states (T ) selected by bits WC1 and WC0 are inserted.
  • Page 134 Programmable Wait Mode: The number of wait states (T ) selected by bits WC1 and WC0 are inserted in all accesses to external three-state-access areas. Figure 6-8 shows the timing when the wait count is 1 (WC1 = 0, WC0 = 1). ø...
  • Page 135 Example of Wait State Control Settings: A reset initializes ASTCR and WCER to H'FF and WCR to H'F3, selecting programmable wait mode and three wait states for all areas. Software can select other wait modes for individual areas by modifying the ASTCR, WCER, and WCR settings. Figure 6-9 shows an example of wait mode settings.
  • Page 136: Interconnections With Memory (example)

    6.3.4 Interconnections with Memory (Example) For each area, the bus controller can select two- or three-state access. In three-state-access areas, wait states can be inserted in a variety of modes, simplifying the connection of both high-speed and low-speed devices. Figure 6-10 shows a memory map for this example. A 32-kword ×...
  • Page 137 (one auto-wait state) On-chip RAM On-chip I/O registers H'FFFFF Note: The bus width and the number of access states of the on-chip memories and I/O registers are fixed; they cannot be changed by register setting. Figure 6-10 Memory Map (H8/3022 Mode 5)
  • Page 138: Usage Notes

    Figure 6-11 ASTCR Write Timing 6.4.2 Precautions on setting ASTCR and ABWCR* Use the H8/3022 Series on-chip program to set ASTCR and ABWCR as shown below, so that the on-chip ROM access cycle for H8/3022 Series can be emulated using the evaluation chip for support tools.
  • Page 139: I/o Ports

    7.1 Overview The H8/3022 Series has nine input/output ports (ports 1, 2, 3, 5, 6, 8, 9, A, and B) and one input port (port 7). Table 7-1 summarizes the port functions. The pins in each port are multiplexed as shown in table 7-1.
  • Page 140 Table 7-1 Port Functions Mode 6 Mode 7 Port Description Pins Mode 1 Mode 3 Mode 5 Port 1 • 8-bit I/O port to P1 Address output Address output (A to A Generic to A pins (A to A and generic input input/ •...
  • Page 141 Port Description Pins Mode 1 Mode 3 Mode 5 Mode 6 Mode 7 Port 9 • 6-bit I/O /SCK Input and output (SCK , SCK , RxD , RxD , TxD I R Q port ) for serial communication interfaces 1 and 0 input (SCI0, 1), IRQ and IRQ...
  • Page 142 Mode 6 Mode 7 Port Description Pins Mode 1 Mode 3 Mode 5 Port B • 7-bit I/Oport TPC output (TP ), trigger input (ADTRG) to A/D converter, and ADTRG generic input/output. • Can drive LEDs TPC output (TP to TP ), ITU input or output (TOCXB , TOCXA TOCXB...
  • Page 143: Port 1

    7.2 Port 1 7.2.1 Overview Port 1 is an 8-bit input/output port with the pin configuration shown in figure 7-1. The pin functions differ between the expanded modes with on-chip ROM disabled, expanded modes with on-chip ROM enabled, and single-chip mode. In modes 1, 3 (expanded modes with on-chip ROM disabled), they are address bus output pins (A to A In modes 5 and 6 (expanded modes with on-chip ROM enabled), settings in the port 1 data...
  • Page 144 Table 7-2 Port 1 Registers Initial Value Address* Name Abbreviation Modes 1, 3 Modes 5 to 7 H'FFC0 Port 1 data direction P1DDR H'FF H'00 register H'FFC2 Port 1 data register P1DR H'00 H'00 Note: Lower 16 bits of the address. Port 1 Data Direction Register (P1DDR): P1DDR is an 8-bit write-only register that can select input or output for each pin in port 1.
  • Page 145 P1DR is initialized to H'00 by a reset and in hardware standby mode. In software standby mode it retains its previous setting. 7.2.3 Pin Functions in Each Mode The pin functions of port 1 differ between mode 1, 3 (expanded mode with on-chip ROM disabled) , modes 5 and 6 (expanded mode with on-chip ROM enabled), and mode 7 (single-chip mode).
  • Page 146 When P1DDR = 1 When P1DDR = 0 A (output) P1 (input) A (output) P1 (input) A (output) P1 (input) A (output) P1 (input) Port 1 A (output) P1 (input) A (output) P1 (input) A (output) P1 (input) A (output) P1 (input) Figure 7-3 Pin Functions in Modes 5 and 6 (Port 1) Mode 7 (Single-Chip Mode): Input or output can be selected separately for each pin in port 1.
  • Page 147 7.3 Port 2 7.3.1 Overview Port 2 is an 8-bit input/output port with the pin configuration shown in figure 7-5. Pin functions differ according to operation mode. In modes 1 and 3 (expanded mode with on-chip ROM disabled), port 2 consists of address bus output pins (A to A ).
  • Page 148 7.3.2 Register Descriptions Table 7-3 summarizes the registers of port 2. Table 7-3 Port 2 Registers Initial Value Address* Name Abbreviation Modes 1 and 3 Modes 5 to 7 H'FFC1 Port 2 data P2DDR H'FF H'00 direction register H'FFC3 Port 2 data P2DR H'00 H'00...
  • Page 149 Port 2 Data Register (P2DR): P2DR is an 8-bit readable/writable register that stores data for pins to P2 Initial value Read/Write Port 2 data 7 to 0 These bits store data for port 2 pins When a bit in P2DDR is set to 1, if port 2 is read the value of the corresponding P2DR bit is returned directly, regardless of the actual state of the pin.
  • Page 150: Pin Functions In Each Mode

    7.3.3 Pin Functions in Each Mode The pin functions of port 2 differ between mode 1, 3 (expanded mode with on-chip ROM disabled), modes 5 and 6 (expanded mode with on-chip ROM enabled), and mode 7 (single-chip mode). The pin functions in each mode are described followings. Modes 1 and 3: Address output can be selected for each pin in port 2.
  • Page 151 When P2DDR = 1 When P2DDR = 0 (output) P2 (input) (output) P2 (input) (output) P2 (input) (output) P2 (input) Port 2 (output) P2 (input) (output) P2 (input) A (output) P2 (input) A (output) P2 (input) Figure 7-7 Pin Functions in Modes 5 and 6 (Port 2) Mode 7: Input or output can be selected separately for each pin in port 2.
  • Page 152 7.3.4 Input Pull-Up Transistors Port 2 has built-in MOS input pull-up transistors that can be controlled by software. These input pull-up transistors can be turned on and off individually. When a P2PCR bit is set to 1 and the corresponding P2DDR bit is cleared to 0, the input pull-up transistor is turned on.
  • Page 153 7.4 Port 3 7.4.1 Overview Port 3 is an 8-bit input/output port with the pin configuration shown in figure 7-9. Port 3 is a data bus in modes 1, 3, 5, and 6 (expanded modes) and a generic input/output port in mode 7 (single- chip mode).
  • Page 154 Port 3 Data Direction Register (P3DDR): P3DDR is an 8-bit write-only register that can select input or output for each pin in port 3. P3 DDR P3 DDR P3 DDR P3 DDR P3 DDR P3 DDR P3 DDR P3 DDR Initial value Read/Write Port 3 data direction 7 to 0...
  • Page 155 7.4.3 Pin Functions in Each Mode The pin functions of port 3 differ between modes 1, 3, 5, and 6 and mode 7. The pin functions in each mode are described below. Modes 1, 3, 5, and 6: All pins of port 3 automatically become data input/output pins. Figure 7-10 shows the pin functions in modes 1, 3, 5, and 6.
  • Page 156 7.5 Port 5 7.5.1 Overview Port 5 is a 4-bit input/output port with the pin configuration shown in figure 7-12. The pin functions differ depending on the operating mode. In modes 1, 3 (expanded modes with on-chip ROM disabled), port 5 consists of address output pins (A to A ).
  • Page 157 Port 5 Data Direction Register (P5DDR): P5DDR is an 8-bit write-only register that can select input or output for each pin in port 5. — — — — P5 DDR P5 DDR P5 DDR P5 DDR Initial value Modes 1 and 3 Read/Write —...
  • Page 158 Port 5 Input Pull-Up Control Register (P5PCR): P5PCR is an 8-bit readable/writable register that controls the MOS input pull-up transistors in port 5. — — — — P5 PCR P5 PCR P5 PCR P5 PCR Initial value Read/Write — — —...
  • Page 159 7.5.3 Pin Functions in Each Mode The pin functions differ between mode 1, 3 (expanded modes with on-chip ROM disabled), modes 5 and 6 (expanded modes with on-chip ROM enabled), and mode 7 (single-chip mode). The pin functions in each mode are described below. Modes 1 and 3: Address output can be selected for each pin in port 5.
  • Page 160 P5 (input/output) P5 (input/output) Port 5 P5 (input/output) P5 (input/output) Figure 7-15 Pin Functions in Mode 7 (Port 5) 7.5.4 Input Pull-Up Transistors Port 5 has built-in MOS pull-up transistors that can be controlled by software. These input pull-up transistors can be turned on and off individually. When a P5PCR bit is set to 1 and the corresponding P5DDR bit is cleared to 0, the input pull-up transistor is turned on.
  • Page 161 7.6 Port 6 7.6.1 Overview Port 6 is a 4-bit input/output port that is also used for input and output of bus control signals (WR, RD, AS, and WAIT). Figure 7-16 shows the pin configuration of port 6. In modes 1, 3, 5, and 6 the pin functions are WR, RD, AS, and P6 /WAIT.
  • Page 162 Table 7-8 Port 6 Registers Initial Value Address* Name Abbreviation Modes 1, 3, 5, and 6 Mode 7 H'FFC9 Port 6 data P6DDR H'F8 H'80 direction register H'FFCB Port 6 data P6DR H'80 H'80 register Note: * Lower 16 bits of the address. Port 6 Data Direction Register (P6DDR): P6DDR is an 8-bit write-only register that can select input or output for each pin in port 6.
  • Page 163 Port 6 Data Register (P6DR): P6DR is an 8-bit readable/writable register that stores data for pins to P6 and P6 — — — — Initial value Read/Write — Reserved bits Port 6 data 5 to 3, 0 These bits store data for port 6 pins When a bit in P6DDR is set to 1, if port 6 is read the value of the corresponding P6DR bit is returned directly.
  • Page 164: Port 2

    7.6.3 Pin Functions in Each Mode Modes 1, 3, 5, and 6: P6 to P6 function as bus control output pins. P6 is either a bus control input pin or generic input/output pin, functioning as an output pin when bit P6 DDR is set to 1 and an input pin when this bit is cleared to 0.
  • Page 165 Table 7-9 Port 6 Pin Functions in Modes 1, 3, 5, and 6 Pin Functions and Selection Method Functions as follows regardless of P6 WR output Pin function Functions as follows regardless of P6 RD output Pin function Functions as follows regardless of P6 AS output Pin function /WAIT...
  • Page 166 Mode 7: Input or output can be selected separately for each pin in port 6. A pin becomes an output pin if the corresponding P6DDR bit is set to 1, and an input pin if this bit is cleared to 0. Figure 7- 18 shows the pin functions in mode 7.
  • Page 167: Overview

    7.7 Port 7 7.7.1 Overview Port 7 is an 8-bit input port that is also used for analog input to the A/D converter. The pin functions are the same in all operating modes. Figure 7-19 shows the pin configuration of port 7. Port 7 pins P7 (input)/AN (input) P7 (input)/AN (input)
  • Page 168: Overview

    Port 7 Data Register (P7DR) Initial value — — — — — — — — Read/Write Note: * Determined by pins P7 to P7 When port 7 is read, the pin levels are always read. 7.8 Port 8 7.8.1 Overview Port 8 is a 2-bit input/output port that is also used for IRQ and IRQ input.
  • Page 169 7.8.2 Register Descriptions Table 7-11 summarizes the registers of port 8. Table 7-11 Port 8 Registers Address* Name Abbreviation Initial Value H'FFCD Port 8 data direction register P8DDR H'E0 H'FFCF Port 8 data register P8DR H'E0 Note: * Lower 16 bits of the address. Port 8 Data Direction Register (P8DDR): P8DDR is an 8-bit write-only register that can select input or output for each pin in port 8.
  • Page 170 Bits 7 to 2 are reserved. Bits 7 to 5 cannot be modified and always read 1. Bit 4, 3, and 2 can be written and read, but it cannot be used for port input or output. If bit 4, 3, and 2 of P8DDR is read while its value is 1, bit 4, 3 and 2 of P8DR is read directly.
  • Page 171: Overview

    7.9 Port 9 7.9.1 Overview Port 9 is a 6-bit input/output port that is also used for input and output (TxD , TxD , RxD , RxD ) by serial communication interface channels 0 and 1 (SCI0 and SCI1), and for IRQ , SCK and IRQ input.
  • Page 172 Port 9 Data Direction Register (P9DDR): P9DDR is an 8-bit write-only register that can select input or output for each pin in port 9. — — P9 DDR P9 DDR P9 DDR P9 DDR P9 DDR P9 DDR Initial value Read/Write —...
  • Page 173 Table 7-14 Port 9 Pin Functions Pin Functions and Selection Method /SCK Bit C/A in SMR of SCI1, bits CKE0 and CKE1 in SCR of SCI1, and bit P9 select the pin function as follows CKE1 — CKE0 — — —...
  • Page 174 Pin Functions and Selection Method /TxD Bit TE in SCR of SCI1 and bit P9 DDR select the pin function as follows — Pi n funct i on input output output /TxD Bit TE in SCR of SCI0, bit SMIF in SCMR, and bit P9 DDR select the pin function as follows SMIF...
  • Page 175: Overview

    7.10 Port A 7.10.1 Overview Port A is an 8-bit input/output port that is also used for output (TP to TP ) from the programmable timing pattern controller (TPC), input and output (TIOCB , TIOCA , TIOCB , TIOCA , TIOCB TIOCA , TCLKD, TCLKC, TCLKB, TCLKA) by the 16-bit integrated timer unit (ITU), and address output (A...
  • Page 176: Register Descriptions

    7.10.2 Register Descriptions Table 7-15 summarizes the registers of port A. Table 7-15 Port A Registers Initial Value Address* Name Abbreviation Modes 1, 5, and 7 Modes 3 and 6 H'FFD1 Port A data PADDR H'00 H'80 direction register H'FFD3 Port A data register PADR H'00...
  • Page 177 Port A Data Register (PADR): PADR is an 8-bit readable/writable register that stores data for pins PA to PA Initial value Read/Write Port A data 7 to 0 These bits store data for port A pins When a bit in PADDR is set to 1, if port A is read the value of the corresponding PADR bit is returned directly.
  • Page 178 7.10.3 Pin Functions The port A pins are also used for TPC output (TP to TP ), ITU input/output (TIOCB to TIOCB TIOCA to TIOCA ) and input (TCLKD, TCLKC, TCLKB, TCLKA), and as address bus pins to A ). Table 7-16 describes the selection of pin functions. Table 7-16 Port A Pin Functions Pin Functions and Selection Method The mode setting, ITU channel 2 settings (bit PWM2 in TMDR and bits IOB2 to IOB0...
  • Page 179 Pin Functions and Selection Method / TP The mode setting, bit A E in BRCR, ITU channel 2 settings (bit PWM2 in TMDR and TI OCA bits IOA2 to IOA0 in TIOR2), bit NDER6 in NDERA, and bit PA DDR in PADDR select the pin function as follows Mode 1, 5 and 7...
  • Page 180 Pin Functions and Selection Method The mode setting, bit A E in BRCR, ITU channel 1 settings (bit PWM1 in TMDR and TIOCB bits IOB2 to IOB0 in TIOR1), bit NDER5 in NDERA, and bit PA DDR in PADDR select the pin function as follows Mode 1, 5 to 7...
  • Page 181 Pin Functions and Selection Method The mode setting, bit A E in BRCR, ITU channel 1 settings (bit PWM1 in TMDR and TIOCA bits IOA2 to IOA0 in TIOR1), bit NDER4 in NDERA, and bit PA DDR in PADDR select the pin function as follows Mode 1, 5 and 7...
  • Page 182: Pin Functions

    Pin Functions and Selection Method ITU channel 0 settings (bit PWM0 in TMDR and bits IOB2 to IOB0 in TIOR0), bits TIOCB TPSC2 to TPSC0 in TCR4 to TCR0, bit NDER3 in NDERA, and bit PA DDR in PADDR TCLKD select the pin function as follows channel 0 (1) in table below...
  • Page 183 Pin Functions and Selection Method ITU channel 0 settings (bit PWM0 in TMDR and bits IOA2 to IOA0 in TIOR0), bits TIOCA TPSC2 to TPSC0 in TCR4 to TCR0, bit NDER2 in NDERA, and bit PA DDR in PADDR TCLKC select the pin function as follows channel 0 (1) in table below...
  • Page 184 Pin Functions and Selection Method Bit NDER1 in NDERA and bit PA DDR in PADDR select the pin function as follows TCLKB NDER1 — input output output function TCLKB input* Note: * TCLKB input when MDF = 1 in TMDR, or when TPSC2 = 1, TPSC1 = 0, and TPSC0 = 1 in any of TCR4 to TCR0.
  • Page 185: Port B

    7.11 Port B 7.11.1 Overview Port B is an 7-bit input/output port that is also used for TPC output (TP , TP to TP ), ITU input/output (TIOCB , TIOCB , TIOCA , TIOCA ) and ITU output (TOCXB , TOCXA ), and ADTRG input to the A/D converter.
  • Page 186 Port B Data Direction Register (PBDDR): PBDDR is an 8-bit write-only register that can select input or output for each pin in port B. PB DDR — PB DDR PB DDR PB DDR PB DDR PB DDR PB DDR Initial value Read/Write Port B data 7, 5 to 0 Reserved bit...
  • Page 187 When port B pins are used for TPC output, PBDR stores output data for TPC output groups 2 and 3. If a bit in the next data enable register (NDERB) is set to 1, the corresponding PBDR bit cannot be written. In this case, PBDR can be updated only when data is transferred from NDRB. 7.11.3 Pin Functions The port B pins are also used for TPC output (TP , TP...
  • Page 188 Table 7-18 Port B Pin Functions Pin Functions and Selection Method Bit TRGE in ADCR, bit NDER15 in NDERB and bit PB DDR in PBDDR select the pin function as follows ADTRG NDER15 — input output output ADTRG input* function Notes: * ADTRG input when TRGE = 1.
  • Page 189: Pin Functions

    Pin Functions and Selection Method ITU channel 4 settings (bit PWM4 in TMDR, bit CMD1 in TFCR, bit EB4 in TOER, and bits IOB2 to IOB0 in TIOR4), bit NDER11 in NDERB, and bit PB DDR in PBDDR TIOCB select the pin function as follows channel 4 (1) in table below (2) in table below...
  • Page 190 Pin Functions and Selection Method ITU channel 4 settings (bit CMD1 in TFCR, bit EA4 in TOER, bit PWM4 in TMDR, and bits IOA2 to IOA0 in TIOR4), bit NDER10 in NDERB, and bit PB DDR in PBDDR TIOCA select the pin function as follows channel 4 (1) in table below (2) in table below...
  • Page 191 Pin Functions and Selection Method ITU channel 3 settings (bit PWM3 in TMDR, bit CMD1 in TFCR, bit EB3 in TOER, and TIOCB bits IOB2 to IOB0 in TIOR3), bit NDER9 in NDERB, and bit PB DDR in PBDDR select the pin function as follows channel 3 settings...
  • Page 192 Pin Functions and Selection Method ITU channel 3 settings (bit CMD1 in TFCR, bit EA3 in TOER, bit PWM3 in TMDR, and TIOCA bits IOA2 to IOA0 in TIOR3), bit NDER8 in NDERB, and bit PB DDR in PBDDR select the pin function as follows channel 3 settings...
  • Page 193: 16-bit Integrated Timer Unit (itu)

    Section 8 16-Bit Integrated Timer Unit (ITU) 8.1 Overview The H8/3022 Series has a built-in 16-bit integrated timer unit (ITU) with five 16-bit timer channels. 8.1.1 Features ITU features are listed below. • Capability to process up to 12 pulse outputs or 10 pulse inputs •...
  • Page 194  Complementary PWM mode If channels 3 and 4 are combined, three-phase PWM output is possible with three pairs of non-overlapping complementary waveforms.  Buffering Input capture registers can be double-buffered. Output compare registers can be updated automatically. • High-speed access via internal 16-bit bus The 16-bit timer counters, general registers, and buffer registers can be accessed at high speed via a 16-bit bus.
  • Page 195 Item Channel 0 Channel 1 Channel 2 Channel 3 Channel 4 Compare match output Toggle — Input capture function Synchronization PWM mode Reset-synchronized — — — PWM mode Complementary — — — PWM mode Phase counting — — — — mode Buffering —...
  • Page 196: Block Diagrams

    8.1.2 Block Diagrams ITU Block Diagram (overall): Figure 8-1 is a block diagram of the ITU. IMIA0 to IMIA4 TCLKA to TCLKD Clock selector IMIB0 to IMIB4 OVI0 to OVI4 ø, ø/2, ø/4, ø/8 TOCXA , TOCXB Control logic TIOCA to TIOCA TIOCB to TIOCB...
  • Page 197 Block Diagram of Channels 0 and 1: ITU channels 0 and 1 are functionally identical. Both have the structure shown in figure 8-2. TCLKA to TCLKD TIOCA Clock selector TIOCB ø, ø/2, ø/4, ø/8 Control logic IMIA0 IMIB0 Comparator OVI0 Module data bus Legend TCNT:...
  • Page 198 Block Diagram of Channel 2: Figure 8-3 is a block diagram of channel 2. This is the channel that provides only 0 output and 1 output. TCLKA to TCLKD TIOCA Clock selector TIOCB ø, ø/2, ø/4, ø/8 Control logic IMIA2 IMIB2 Comparator OVI2...
  • Page 199 Block Diagrams of Channels 3 and 4: Figure 8-4 is a block diagram of channel 3. Figure 8-5 is a block diagram of channel 4. TIOCA TCLKA to TIOCB TCLKD Clock selector ø, ø/2, ø/4, ø/8 Control logic IMIA3 Comparator IMIB3 OVI3 Module data bus...
  • Page 200 TOCXA TCLKA to TOCXB TCLKD Clock selector ø, ø/2, TIOCA ø/4, ø/8 TIOCB Control logic IMIA4 Comparator IMIB4 OVI4 Module data bus Legend TCNT4: Timer counter 4 (16 bits) GRA4, GRB4: General registers A4 and B4 (input capture/output compare registers) ×...
  • Page 201: Pin Configuration

    8.1.3 Pin Configuration Table 8-2 summarizes the ITU pins. Table 8-2 ITU Pins Abbre- Input/ Channel Name viation Output Function Common Clock input A TCLKA Input External clock A input pin (phase-A input pin in phase counting mode) Clock input B TCLKB Input External clock B input pin...
  • Page 202 Abbre- Input/ Channel Name viation Output Function Input TIOCA Input/ GRA4 output compare or input capture capture/output output pin PWM output pin in PWM mode, compare A4 complementary PWM mode, or reset- synchronized PWM mode Input TIOCB Input/ GRB4 output compare or input capture capture/output output pin PWM output pin in complementary...
  • Page 203: Register Configuration

    8.1.4 Register Configuration Table 8-3 summarizes the ITU registers. Table 8-3 ITU Registers Abbre- Initial Channel Address* Name viation Value Common H'FF60 Timer start register TSTR H'E0 H'FF61 Timer synchro register TSNC H'E0 H'FF62 Timer mode register TMDR H'80 H'FF63 Timer function control register TFCR H'C0...
  • Page 204 Abbre- Initial Channel Address* Name viation Value H'FF78 Timer control register 2 TCR2 H'80 H'FF79 Timer I/O control register 2 TIOR2 H'88 H'FF7A Timer interrupt enable register 2 TIER2 H'F8 H'FF7B Timer status register 2 TSR2 R/(W)* H'F8 H'FF7C Timer counter 2 (high) TCNT2H H'00 H'FF7D...
  • Page 205 Abbre- Initial Channel Address* Name viation Value H'FF92 Timer control register 4 TCR4 H'80 H'FF93 Timer I/O control register 4 TIOR4 H'88 H'FF94 Timer interrupt enable register 4 TIER4 H'F8 H'FF95 Timer status register 4 TSR4 R/(W)* H'F8 H'FF96 Timer counter 4 (high) TCNT4H H'00 H'FF97...
  • Page 206 8.2 Register Descriptions 8.2.1 Timer Start Register (TSTR) TSTR is an 8-bit readable/writable register that starts and stops the timer counter (TCNT) in channels 0 to 4. — — — STR4 STR3 STR2 STR1 STR0 Initial value Read/Write — — —...
  • Page 207: Timer Synchro Register (tsnc)

    Bit 1—Counter Start 1 (STR1): Starts and stops timer counter 1 (TCNT1). Bit 1 STR1 Description TCNT1 is halted (Initial value) TCNT1 is counting Bit 0—Counter Start 0 (STR0): Starts and stops timer counter 0 (TCNT0). Bit 0 Description STR0 TCNT0 is halted (Initial value) TCNT0 is counting...
  • Page 208 Bit 3—Timer Sync 3 (SYNC3): Selects whether channel 3 operates independently or synchronously. Bit 3 SYNC3 Description Channel 3’s timer counter (TCNT3) operates independently (Initial value) TCNT3 is preset and cleared independently of other channels Channel 3 operates synchronously TCNT3 can be synchronously preset and cleared Bit 2—Timer Sync 2 (SYNC2): Selects whether channel 2 operates independently or synchronously.
  • Page 209: Timer Mode Register (tmdr)

    8.2.3 Timer Mode Register (TMDR) TMDR is an 8-bit readable/writable register that selects PWM mode for channels 0 to 4. It also selects phase counting mode and the overflow flag (OVF) setting conditions for channel 2. — FDIR PWM4 PWM3 PWM2 PWM1 PWM0...
  • Page 210 When MDF is set to 1 to select phase counting mode, timer counter 2 (TCNT2) operates as an up/down-counter and pins TCLKA and TCLKB become counter clock input pins. TCNT2 counts both rising and falling edges of TCLKA and TCLKB, and counts up or down as follows. Counting Direction Down-Counting Up-Counting...
  • Page 211 Bit 3—PWM Mode 3 (PWM3): Selects whether channel 3 operates normally or in PWM mode. Bit 3 PWM3 Description Channel 3 operates normally (Initial value) Channel 3 operates in PWM mode When bit PWM3 is set to 1 to select PWM mode, pin TIOCA3 becomes a PWM output pin. The output goes to 1 at compare match with general register A3 (GRA3), and to 0 at compare match with general register B3 (GRB3).
  • Page 212: Timer Function Control Register (tfcr)

    Bit 0—PWM Mode 0 (PWM0): Selects whether channel 0 operates normally or in PWM mode. PWM0 Description Channel 0 operates normally (Initial value) Channel 0 operates in PWM mode When bit PWM0 is set to 1 to select PWM mode, pin TIOCA0 becomes a PWM output pin. The output goes to 1 at compare match with general register A0 (GRA0), and to 0 at compare match with general register B0 (GRB0).
  • Page 213 Bits 7 and 6—Reserved: These bits cannot be modified and are always read as 1. Bits 5 and 4—Combination Mode 1 and 0 (CMD1, CMD0): These bits select whether channels 3 and 4 operate in normal mode, complementary PWM mode, or reset-synchronized PWM mode. Bit 5 Bit 4 CMD1...
  • Page 214: Timer Output Master Enable Register (toer)

    Bit 1—Buffer Mode B3 (BFB3): Selects whether GRB3 operates normally in channel 3, or whether GRB3 is buffered by BRB3. Bit 1 BFB3 Description GRB3 operates normally (Initial value) GRB3 is buffered by BRB3 Bit 0—Buffer Mode A3 (BFA3): Selects whether GRA3 operates normally in channel 3, or whether GRA3 is buffered by BRA3.
  • Page 215 Bits 7 and 6—Reserved: These bits cannot be modified and are always read as 1. Bit 5—Master Enable TOCXB (EXB4): Enables or disables ITU output at pin TOCXB Bit 5 EXB4 Description TOCXB output is disabled regardless of TFCR settings (TOCXB operates as a generic input/output pin).
  • Page 216 Bit 1—Master Enable TIOCA (EA4): Enables or disables ITU output at pin TIOCA Bit 1 Description TIOCA output is disabled regardless of TIOR4, TMDR, and TFCR settings (TIOCA operates as a generic input/output pin). If XTGD = 0, EA4 is cleared to 0 when input capture A occurs in channel 1. TIOCA is enabled for output according to TIOR4, TMDR, and TFCR (Initial value)
  • Page 217: Timer Output Control Register (tocr)

    8.2.6 Timer Output Control Register (TOCR) TOCR is an 8-bit readable/writable register that selects externally triggered disabling of output in complementary PWM mode and reset-synchronized PWM mode, and inverts the output levels. — — — XTGD — — OLS4 OLS3 Initial value Read/Write —...
  • Page 218: Timer Counters (tcnt)

    Bits 3 and 2—Reserved: These bits cannot be modified and are always read as 1. Bit 1—Output Level Select 4 (OLS4): Selects output levels in complementary PWM mode and reset-synchronized PWM mode. Bit 1 OLS4 Description TIOCA , TIOCA , and TIOCB pin outputs are inverted TIOCA , TIOCA...
  • Page 219: General Registers (gra, Grb)

    TCNT0 and TCNT1 are up-counters. TCNT2 is an up/down-counter in phase counting mode and an up-counter in other modes. TCNT3 and TCNT4 are up/down-counters in complementary PWM mode and up-counters in other modes. TCNT can be cleared to H'0000 by compare match with general register A or B (GRA or GRB) or by input capture to GRA or GRB (counter clearing function) in the same channel.
  • Page 220: Buffer Registers (bra, Brb)

    When a general register is used as an input capture register, rising edges, falling edges, or both edges of an external input capture signal are detected and the current TCNT value is stored in the general register. The corresponding IMFA or IMFB flag in TSR is set to 1 at the same time. The valid edge or edges of the input capture signal are selected in TIOR.
  • Page 221: Timer Control Registers (tcr)

    The buffer registers are linked to the CPU by an internal 16-bit bus and can be written or read by either word or byte access. Buffer registers are initialized to H'FFFF by a reset and in standby mode. 8.2.10 Timer Control Registers (TCR) TCR is an 8-bit register.
  • Page 222 Bit 7—Reserved: This bit cannot be modified and is always read as 1. Bits 6 and 5—Counter Clear 1/0 (CCLR1, CCLR0): These bits select how TCNT is cleared. Bit 6 Bit 5 CCLR1 CCLR0 Description TCNT is not cleared (Initial value) TCNT is cleared by GRA compare match or input capture* TCNT is cleared by GRB compare match or input capture* Synchronous clear: TCNT is cleared in synchronization with...
  • Page 223 Bits 2 to 0—Timer Prescaler 2 to 0 (TPSC2 to TPSC0): These bits select the counter clock source. Bit 2 Bit 1 Bit 0 TPSC2 TPSC1 TPSC0 Function Internal clock: ø (Initial value) Internal clock: ø/2 Internal clock: ø/4 Internal clock: ø/8 External clock A: TCLKA input External clock B: TCLKB input External clock C: TCLKC input...
  • Page 224: Timer I/o Control Register (tior)

    8.2.11 Timer I/O Control Register (TIOR) TIOR is an 8-bit register. The ITU has five TIORs, one in each channel. Channel Abbreviation Function TIOR0 TIOR controls the general registers. Some functions differ in PWM TIOR1 mode. TIOR3 and TIOR4 settings are ignored when complementary TIOR2 PWM mode or reset-synchronized PWM mode is selected in TIOR3...
  • Page 225 Bit 7—Reserved: This bit cannot be modified and is always read as 1. Bits 6 to 4—I/O Control B2 to B0 (IOB2 to IOB0): These bits select the GRB function. Bit 6 Bit 5 Bit 4 IOB2 IOB1 IOB0 Function GRB is an output No output at compare match (Initial value)
  • Page 226: Timer Status Register (tsr)

    8.2.12 Timer Status Register (TSR) TSR is an 8-bit register. The ITU has five TSRs, one in each channel. Channel Abbreviation Function TSR0 Indicates input capture, compare match, and overflow status TSR1 TSR2 TSR3 TSR4 — — — — — IMFB IMFA Initial value...
  • Page 227 Bits 7 to 3—Reserved: These bits cannot be modified and are always read as 1. Bit 2—Overflow Flag (OVF): This status flag indicates TCNT overflow or underflow. Bit 2 Description [Clearing condition] (Initial value) Read OVF when OVF = 1, then write 0 in OVF [Setting condition] TCNT overflowed from H'FFFF to H'0000, or underflowed from H'0000 to H'FFFF* Notes: *...
  • Page 228: Timer Interrupt Enable Register (tier)

    8.2.13 Timer Interrupt Enable Register (TIER) TIER is an 8-bit register. The ITU has five TIERs, one in each channel. Channel Abbreviation Function TIER0 Enables or disables interrupt requests. TIER1 TIER2 TIER3 TIER4 — — — — — OVIE IMIEB IMIEA Initial value Read/Write...
  • Page 229 Bits 7 to 3—Reserved: These bits cannot be modified and are always read as 1. Bit 2—Overflow Interrupt Enable (OVIE): Enables or disables the interrupt requested by the overflow flag (OVF) in TSR when OVF is set to 1. Bit 2 OVIE Description OVI interrupt requested by OVF is disabled...
  • Page 230: Cpu Interface

    8.3 CPU Interface 8.3.1 16-Bit Accessible Registers The timer counters (TCNTs), general registers A and B (GRAs and GRBs), and buffer registers A and B (BRAs and BRBs) are 16-bit registers, and are linked to the CPU by an internal 16-bit data bus.
  • Page 231 Internal data bus Module Bus interface data bus TCNTH TCNTL Figure 8-8 Access to Timer Counter (CPU Writes to TCNT, Upper Byte) Internal data bus Module Bus interface data bus TCNTH TCNTL Figure 8-9 Access to Timer Counter (CPU Writes to TCNT, Lower Byte) Internal data bus Module Bus interface...
  • Page 232: 8-bit Accessible Registers

    Internal data bus Module Bus interface data bus TCNTH TCNTL Figure 8-11 Access to Timer Counter (CPU Reads TCNT, Lower Byte) 8.3.2 8-Bit Accessible Registers The registers other than the timer counters, general registers, and buffer registers are 8-bit registers. These registers are linked to the CPU by an internal 8-bit data bus. Figures 8-12 and 8-13 show examples of byte read and write access to a TCR.
  • Page 233: Operation

    8.4 Operation 8.4.1 Overview A summary of operations in the various modes is given below. Normal Operation: Each channel has a timer counter and general registers. The timer counter counts up, and can operate as a free-running counter, periodic counter, or external event counter. General registers A and B can be used for input capture or output compare.
  • Page 234: Basic Functions

    When input capture occurs the TCNT value is transferred to the general register, and the previous general register value is transferred to the buffer register. • Complementary PWM mode The buffer register value is transferred to the general register when TCNT3 and TCNT4 change counting direction.
  • Page 235 Counter setup Select counter clock Type of counting? Free-running counting Periodic counting Select counter clear source Select output compare register function Set period Start counter Start counter Periodic counter Free-running counter Figure 8-14 Counter Setup Procedure (Example) 1. Set bits TPSC2 to TPSC0 in TCR to select the counter clock source. If an external clock source is selected, set bits CKEG1 and CKEG0 in TCR to select the desired edge(s) of the external clock signal.
  • Page 236 • Free-running and periodic counter operation A reset leaves the counters (TCNTs) in ITU channels 0 to 4 all set as free-running counters. A free-running counter starts counting up when the corresponding bit in TSTR is set to 1. When the count overflows from H'FFFF to H'0000, the overflow flag (OVF) is set to 1 in the timer status register (TSR).
  • Page 237 TCNT value Counter cleared by general register compare match H'0000 Time STR bit Figure 8-16 Periodic Counter Operation • Count timing  Internal clock source Bits TPSC2 to TPSC0 in TCR select the system clock (ø) or one of three internal clock sources obtained by prescaling the system clock (ø/2, ø/4, ø/8).
  • Page 238  External clock source Bits TPSC2 to TPSC0 in TCR select an external clock input pin (TCLKA to TCLKD), and its valid edge or edges are selected by bits CKEG1 and CKEG0. The rising edge, falling edge, or both edges can be selected. The pulse width of the external clock signal must be at least 1.5 system clocks when a single edge is selected, and at least 2.5 system clocks when both edges are selected.
  • Page 239 Waveform Output by Compare Match: In ITU channels 0, 1, 3, and 4, compare match A or B can cause the output at the TIOCA or TIOCB pin to go to 0, go to 1, or toggle. In channel 2 the output can only go to 0 or go to 1.
  • Page 240 TCNT value H'FFFF H'0000 Time TIOCB No change No change 1 output No change No change 0 output TIOCA Figure 8-20 0 and 1 Output (Examples) Figure 8-21 shows examples of toggle output. TCNT operates as a periodic counter, cleared by compare match B.
  • Page 241 • Output compare timing The compare match signal is generated in the last state in which TCNT and the general register match (when TCNT changes from the matching value to the next value). When the compare match signal is generated, the output value selected in TIOR is output at the output compare pin (TIOCA or TIOCB).
  • Page 242 Input selection Set TIOR to select the input capture function of a general register and the rising edge, falling edge, or both edges of the input capture signal. Clear the port data direction bit to 0 before making these TIOR settings. Select input-capture input Start counter Set the STR bit to 1 in TSTR to start the timer...
  • Page 243 • Input capture signal timing Input capture on the rising edge, falling edge, or both edges can be selected by settings in TIOR. Figure 8-25 shows the timing when the rising edge is selected. The pulse width of the input capture signal must be at least 1.5 system clocks for single-edge capture, and 2.5 system clocks for capture of both edges.
  • Page 244: Synchronization

    8.4.3 Synchronization The synchronization function enables two or more timer counters to be synchronized by writing the same data to them simultaneously (synchronous preset). With appropriate TCR settings, two or more timer counters can also be cleared simultaneously (synchronous clear). Synchronization enables additional general registers to be associated with a single time base.
  • Page 245 Example of Synchronization: Figure 8-27 shows an example of synchronization. Channels 0, 1, and 2 are synchronized, and are set to operate in PWM mode. Channel 0 is set for counter clearing by compare match with GRB0. Channels 1 and 2 are set for synchronous counter clearing. The timer counters in channels 0, 1, and 2 are synchronously preset, and are synchronously cleared by compare match with GRB0.
  • Page 246: Pwm Mode

    8.4.4 PWM Mode In PWM mode GRA and GRB are paired and a PWM waveform is output from the TIOCA pin. GRA specifies the time at which the PWM output changes to 1. GRB specifies the time at which the PWM output changes to 0. If either GRA or GRB is selected as the counter clear source, a PWM waveform with a duty cycle from 0% to 100% is output at the TIOCA pin.
  • Page 247 Sample Setup Procedure for PWM Mode: Figure 8-28 shows a sample procedure for setting up PWM mode. PWM mode 1. Set bits TPSC2 to TPSC0 in TCR to select the counter clock source. If an external clock source is selected, set bits CKEG1 and CKEG0 in TCR to Select counter clock select the desired edge(s) of the...
  • Page 248 Examples of PWM Mode: Figure 8-29 shows examples of operation in PWM mode. The PWM waveform is output from the TIOCA pin. The output goes to 1 at compare match with GRA, and to 0 at compare match with GRB. In the examples shown, TCNT is cleared by compare match with GRA or GRB.
  • Page 249 Figure 8-30 shows examples of the output of PWM waveforms with duty cycles of 0% and 100%. If the counter is cleared by compare match with GRB, and GRA is set to a higher value than GRB, the duty cycle is 0%. If the counter is cleared by compare match with GRA, and GRB is set to a higher value than GRA, the duty cycle is 100%.
  • Page 250: Reset-synchronized Pwm Mode

    8.4.5 Reset-Synchronized PWM Mode In reset-synchronized PWM mode channels 3 and 4 are combined to produce three pairs of complementary PWM waveforms, all having one waveform transition point in common. When reset-synchronized PWM mode is selected TIOCA , TIOCB , TIOCA , TOCXA , TIOCB and TOCXB...
  • Page 251 Sample Setup Procedure for Reset-Synchronized PWM Mode: Figure 8-31 shows a sample procedure for setting up reset-synchronized PWM mode. Reset-synchronized PWM mode 1. Clear the STR3 bit in TSTR to 0 to halt TCNT3. Reset-synchronized PWM mode must be set up while TCNT3 is halted.
  • Page 252 Example of Reset-Synchronized PWM Mode: Figure 8-32 shows an example of operation in reset-synchronized PWM mode. TCNT3 operates as an up-counter in this mode. TCNT4 operates independently, detached from GRA4 and GRB4. When TCNT3 matches GRA3, TCNT3 is cleared and resumes counting from H'0000. The PWM outputs toggle at compare match with GRB3, GRA4, GRB4, and TCNT3 respectively, and when the counter is cleared.
  • Page 253: Complementary Pwm Mode

    8.4.6 Complementary PWM Mode In complementary PWM mode channels 3 and 4 are combined to output three pairs of complementary, non-overlapping PWM waveforms. When complementary PWM mode is selected TIOCA , TIOCB , TIOCA , TOCXA , TIOCB , and TOCXB automatically become PWM output pins, and TCNT3 and TCNT4 function as up/down- counters.
  • Page 254 Setup Procedure for Complementary PWM Mode: Figure 8-33 shows a sample procedure for setting up complementary PWM mode. Complementary PWM mode 1. Clear bits STR3 and STR4 to 0 in TSTR to halt the timer counters. Complementary PWM mode must be set up while TCNT3 and TCNT4 are Stop counting halted.
  • Page 255 Clearing Complementary PWM Mode: Figure 8-34 shows a sample procedure for clearing complementary PWM mode. Complementary PWM mode Clear bit CMD1 in TFCR to 0, and set channels 3 and 4 to normal operating Clear complementary mode mode. After setting channels 3 and 4 to normal operating mode, wait at least one clock count before clearing bits STR3 and Stop counting...
  • Page 256 Examples of Complementary PWM Mode: Figure 8-35 shows an example of operation in complementary PWM mode. TCNT3 and TCNT4 operate as up/down-counters, counting down from compare match between TCNT3 and GRA3 and counting up from the point at which TCNT4 underflows.
  • Page 257 Figure 8-36 shows examples of waveforms with 0% and 100% duty cycles (in one phase) in complementary PWM mode. In this example the outputs change at compare match with GRB3, so waveforms with duty cycles of 0% or 100% can be output by setting GRB3 to a value larger than GRA3.
  • Page 258 In complementary PWM mode, TCNT3 and TCNT4 overshoot and undershoot at the transitions between up-counting and down-counting. The setting conditions for the IMFA bit in channel 3 and the OVF bit in channel 4 differ from the usual conditions. In buffered operation the buffer transfer conditions also differ.
  • Page 259 Underflow Overflow TCNT4 H'0001 H'0000 H'FFFF H'0000 Flag not set Set to 1 Buffer transfer signal (BR to GR) No buffer transfer Buffer transfer Figure 8-38 Undershoot Timing In channel 3, IMFA is set to 1 only during up-counting. In channel 4, OVF is set to 1 only when an underflow occurs.
  • Page 260 GRA3 H'0000 Not allowed Figure 8-39 Changing a General Register Setting by Buffer Transfer (Example 1)  Buffer transfer at transition from up-counting to down-counting If the general register value is in the range from GRA3 – T + 1 to GRA3, do not transfer a buffer register value outside this range.
  • Page 261  Buffer transfer at transition from down-counting to up-counting If the general register value is in the range from H'0000 to T – 1, do not transfer a buffer register value outside this range. Conversely, when a general register value is outside this range, do not transfer a value within this range.
  • Page 262  General register settings outside the counting range (H'0000 to GRA3) Waveforms with a duty cycle of 0% or 100% can be output by setting a general register to a value outside the counting range. When a buffer register is set to a value outside the counting range, then later restored to a value within the counting range, the counting direction (up or down) must be the same both times.
  • Page 263: Phase Counting Mode

    8.4.7 Phase Counting Mode In phase counting mode the phase difference between two external clock inputs (at the TCLKA and TCLKB pins) is detected, and TCNT2 counts up or down accordingly. In phase counting mode, the TCLKA and TCLKB pins automatically function as external clock input pins and TCNT2 becomes an up/down-counter, regardless of the settings of bits TPSC2 to TPSC0, CKEG1, and CKEG0 in TCR2.
  • Page 264 Example of Phase Counting Mode: Figure 8-44 shows an example of operations in phase counting mode. Table 8-9 lists the up-counting and down-counting conditions for TCNT2. In phase counting mode both the rising and falling edges of TCLKA and TCLKB are counted. The phase difference between TCLKA and TCLKB must be at least 1.5 states, the phase overlap must also be at least 1.5 states, and the pulse width must be at least 2.5 states.
  • Page 265: Buffering

    8.4.8 Buffering Buffering operates differently depending on whether a general register is an output compare register or an input capture register, with further differences in reset-synchronized PWM mode and complementary PWM mode. Buffering is available only in channels 3 and 4. Buffering operations under the conditions mentioned above are described next.
  • Page 266 • Complementary PWM mode The buffer register value is transferred to the general register when TCNT3 and TCNT4 change counting direction. This occurs at the following two times:  When TCNT3 matches GRA3  When TCNT4 underflows • Reset-synchronized PWM mode The buffer register value is transferred to the general register at compare match A3.
  • Page 267 Examples of Buffering: Figure 8-49 shows an example in which GRA is set to function as an output compare register buffered by BRA, TCNT is set to operate as a periodic counter cleared by GRB compare match, and TIOCA and TIOCB are set to toggle at compare match A and B. Because of the buffer setting, when TIOCA toggles at compare match A, the BRA value is simultaneously transferred to GRA.
  • Page 268 ø n + 1 TCNT Compare match signal Buffer transfer signal Figure 8-50 Compare Match and Buffer Transfer Timing (Example)
  • Page 269 Figure 8-51 shows an example in which GRA is set to function as an input capture register buffered by BRA, and TCNT is cleared by input capture B. The falling edge is selected as the input capture edge at TIOCB. Both edges are selected as input capture edges at TIOCA. Because of the buffer setting, when the TCNT value is captured into GRA at input capture A, the previous GRA value is simultaneously transferred to BRA.
  • Page 270 ø TIOC pin Input capture signal TCNT n + 1 N + 1 Figure 8-52 Input Capture and Buffer Transfer Timing (Example)
  • Page 271 Figure 8-53 shows an example in which GRB3 is buffered by BRB3 in complementary PWM mode. Buffering is used to set GRB3 to a higher value than GRA3, generating a PWM waveform with 0% duty cycle. The BRB3 value is transferred to GRB3 when TCNT3 matches GRA3, and when TCNT4 underflows.
  • Page 272: Itu Output Timing

    8.4.9 ITU Output Timing The ITU outputs from channels 3 and 4 can be disabled by bit settings in TOER or by an external trigger, or inverted by bit settings in TOCR. Timing of Enabling and Disabling of ITU Output by TOER: In this example an ITU output is disabled by clearing a master enable bit to 0 in TOER.
  • Page 273 Timing of Disabling of ITU Output by External Trigger: If the XTGD bit is cleared to 0 in TOCR in reset-synchronized PWM mode or complementary PWM mode, when an input capture A signal occurs in channel 1, the master enable bits are cleared to 0 in TOER, disabling ITU output. Figure 8-55 shows the timing.
  • Page 274: Interrupts

    8.5 Interrupts The ITU has two types of interrupts: input capture/compare match interrupts, and overflow interrupts. 8.5.1 Setting of Status Flags Timing of Setting of IMFA and IMFB at Compare Match: IMFA and IMFB are set to 1 by a compare match signal generated when TCNT matches a general register (GR).
  • Page 275 Timing of Setting of IMFA and IMFB by Input Capture: IMFA and IMFB are set to 1 by an input capture signal. The TCNT contents are simultaneously transferred to the corresponding general register. Figure 8-58 shows the timing. ø Input capture signal TCNT Figure 8-58 Timing of Setting of IMFA and IMFB by Input Capture...
  • Page 276: Clearing Of Status Flags

    ø TCNT H'FFFF H'0000 Overflow signal Figure 8-59 Timing of Setting of OVF 8.5.2 Clearing of Status Flags If the CPU reads a status flag while it is set to 1, then writes 0 in the status flag, the status flag is cleared.
  • Page 277: Interrupt Sources

    8.5.3 Interrupt Sources Each ITU channel can generate a compare match/input capture A interrupt, a compare match/input capture B interrupt, and an overflow interrupt. In total there are 15 interrupt sources, all independently vectored. An interrupt is requested when the interrupt request flag and interrupt enable bit are both set to 1.
  • Page 278: Usage Notes

    8.6 Usage Notes This section describes contention and other matters requiring special attention during ITU operations. Contention between TCNT Write and Clear: If a counter clear signal occurs in the T state of a TCNT write cycle, clearing of the counter takes priority and the write is not performed. See figure 8-61.
  • Page 279 Contention between TCNT Word Write and Increment: If an increment pulse occurs in the T state of a TCNT word write cycle, writing takes priority and TCNT is not incremented. See figure 8-62. TCNT word write cycle ø Address TCNT address Internal write signal TCNT input clock TCNT...
  • Page 280 Contention between TCNT Byte Write and Increment: If an increment pulse occurs in the T or T state of a TCNT byte write cycle, writing takes priority and TCNT is not incremented. The TCNT byte that was not written retains its previous value. See figure 8-63, which shows an increment pulse occurring in the T state of a byte write to TCNTH.
  • Page 281 Contention between General Register Write and Compare Match: If a compare match occurs in the T state of a general register write cycle, writing takes priority and the compare match signal is inhibited. See figure 8-64. General register write cycle ø...
  • Page 282 Contention between TCNT Write and Overflow or Underflow: If an overflow occurs in the T state of a TCNT write cycle, writing takes priority and the counter is not incremented. OVF is set to 1.The same holds for underflow. See figure 8-65. TCNT write cycle ø...
  • Page 283 Contention between General Register Read and Input Capture: If an input capture signal occurs during the T state of a general register read cycle, the value before input capture is read. See figure 8-66. General register read cycle ø GR address Address Internal read signal Input capture signal...
  • Page 284 Contention between Counter Clearing by Input Capture and Counter Increment: If an input capture signal and counter increment signal occur simultaneously, the counter is cleared according to the input capture signal. The counter is not incremented by the increment signal. The value before the counter is cleared is transferred to the general register.
  • Page 285 Contention between General Register Write and Input Capture: If an input capture signal occurs in the T state of a general register write cycle, input capture takes priority and the write to the general register is not performed. See figure 8-68. General register write cycle ø...
  • Page 286 Contention between Buffer Register Write and Input Capture: If a buffer register is used for input capture buffering and an input capture signal occurs in the T state of a write cycle, input capture takes priority and the write to the buffer register is not performed. See figure 8-69. Buffer register write cycle ø...
  • Page 287 Note on Synchronous Preset: When channels are synchronized, if a TCNT value is modified by byte write access, all 16 bits of all synchronized counters assume the same value as the counter that was addressed. (Example) When channels 2 and 3 are synchronized •...
  • Page 293: Programmable Timing Pattern Controller

    Section 9 Programmable Timing Pattern Controller 9.1 Overview The H8/3022 Series has a built-in programmable timing pattern controller (TPC) * that provides pulse outputs by using the 16-bit integrated timer unit (ITU) as a time base. The TPC pulse outputs are divided into 4-bit groups (group 3 to group 0) that can operate simultaneously and independently.
  • Page 294: Block Diagram

    9.1.2 Block Diagram Figure 9-1 shows a block diagram of the TPC. ITU compare match signals PADDR PBDDR NDERA NDERB Control logic TPMR TPCR Internal data bus Pulse output pins, group 3 PBDR NDRB Pulse output pins, group 2 Pulse output pins, group 1 PADR NDRA...
  • Page 295: Pin Configuration

    9.1.3 Pin Configuration Table 9-1 summarizes the TPC output pins. Table 9-1 TPC Pins Name Symbol Function TPC output 0 Output Group 0 pulse output TPC output 1 Output TPC output 2 Output TPC output 3 Output TPC output 4 Output Group 1 pulse output TPC output 5...
  • Page 296: Register Configuration

    9.1.4 Register Configuration Table 9-2 summarizes the TPC registers. Table 9-2 TPC Registers Address* Name Abbreviation Initial Value H'FFD1 Port A data direction register PADDR H'00 H'FFD3 Port A data register PADR R/(W)* H'00 H'FFD4 Port B data direction register PBDDR H'00 H'FFD6...
  • Page 297: Register Descriptions

    9.2 Register Descriptions 9.2.1 Port A Data Direction Register (PADDR) PADDR is an 8-bit write-only register that selects input or output for each pin in port A. PA DDR PA DDR PA DDR PA DDR PA DDR PA DDR PA DDR PA DDR Initial value Read/Write...
  • Page 298: Port B Data Direction Register (pbddr)

    9.2.3 Port B Data Direction Register (PBDDR) PBDDR is an 8-bit write-only register that selects input or output for each pin in port B. PB DDR — PB DDR PB DDR PB DDR PB DDR PB DDR PB DDR Initial value Read/Write Port B data direction 7, 5 to 0 These bits select input or...
  • Page 299: Next Data Register A (ndra)

    9.2.5 Next Data Register A (NDRA) NDRA is an 8-bit readable/writable register that stores the next output data for TPC output groups 1 and 0 (pins TP to TP ). During TPC output, when an ITU compare match event specified in TPCR occurs, NDRA contents are transferred to the corresponding bits in PADR.
  • Page 300 Different Triggers for TPC Output Groups 0 and 1: If TPC output groups 0 and 1 are triggered by different compare match events, the address of the upper 4 bits of NDRA (group 1) is H'FFA5 and the address of the lower 4 bits (group 0) is H'FFA7. Bits 3 to 0 of address H'FFA5 and bits 7 to 4 of address H'FFA7 are reserved bits that cannot be modified and always read 1.
  • Page 301: Next Data Register B (ndrb)

    9.2.6 Next Data Register B (NDRB) NDRB is an 8-bit readable/writable register that stores the next output data for TPC output groups 3 and 2 (pins TP to TP )*. During TPC output, when an ITU compare match event specified in TPCR occurs, NDRB contents are transferred to the corresponding bits in PBDR.
  • Page 302 Different Triggers for TPC Output Groups 2 and 3: If TPC output groups 2 and 3 are triggered by different compare match events, the address of the upper 4 bits of NDRB (group 3)* is H'FFA4 and the address of the lower 4 bits (group 2) is H'FFA6. Bits 3 to 0 of address H'FFA4 and bits 7 to 4 of address H'FFA6 are reserved bits that cannot be modified and always read 1.
  • Page 303: Next Data Enable Register A (ndera)

    9.2.7 Next Data Enable Register A (NDERA) NDERA is an 8-bit readable/writable register that enables or disables TPC output groups 1 and 0 to TP ) on a bit-by-bit basis. NDER7 NDER6 NDER5 NDER4 NDER3 NDER2 NDER1 NDER0 Initial value Read/Write Next data enable 7 to 0 These bits enable or disable...
  • Page 304: Next Data Enable Register B (nderb)

    9.2.8 Next Data Enable Register B (NDERB) NDERB is an 8-bit readable/writable register that enables or disables TPC output groups 3 and 2 to TP )* on a bit-by-bit basis. NDER15 NDER14 NDER13 NDER12 NDER11 NDER10 NDER9 NDER8 Initial value Read/Write Next data enable 15 to 8 These bits enable or disable...
  • Page 305: Tpc Output Control Register (tpcr)

    9.2.9 TPC Output Control Register (TPCR) TPCR is an 8-bit readable/writable register that selects output trigger signals for TPC outputs on a group-by-group basis. G3CMS1 G3CMS0 G2CMS1 G2CMS0 G1CMS1 G1CMS0 G0CMS1 G0CMS0 Initial value Read/Write Group 3 compare match select 1 and 0 These bits select the compare match Group 2 compare...
  • Page 306 Bits 7 and 6—Group 3 Compare Match Select 1 and 0 (G3CMS1, G3CMS0): These bits select the compare match event that triggers TPC output group 3 (TP to TP Bit 7 Bit6 G3CMS1 G3CMS0 Description TPC output group 3 (TP to TP )* is triggered by compare match in ITU channel 0...
  • Page 307 Bits 3 and 2—Group 1 Compare Match Select 1 and 0 (G1CMS1, G1CMS0): These bits select the compare match event that triggers TPC output group 1 (TP to TP Bit 3 Bit2 G1CMS1 G1CMS0 Description TPC output group 1 (TP to TP ) is triggered by compare match in ITU channel 0...
  • Page 308: Tpc Output Mode Register (tpmr)

    9.2.10 TPC Output Mode Register (TPMR) TPMR is an 8-bit readable/writable register that selects normal or non-overlapping TPC output for each group. — — — — G3NOV G2NOV G1NOV G0NOV Initial value Read/Write — — — — Reserved bits Group 3 non-overlap Selects non-overlapping TPC to TP ) ∗...
  • Page 309 Bit 3—Group 3 Non-Overlap (G3NOV): Selects normal or non-overlapping TPC output for group 3 (TP to TP Bit 3 G3NOV Description Normal TPC output in group 3 (output values change at compare (Initial value) match A in the selected ITU channel) Non-overlapping TPC output in group 3 (independent 1 and 0 output at compare match A and B in the selected ITU channel) Note: * Since this LSI does not have a TP...
  • Page 310: Operation

    9.3 Operation 9.3.1 Overview When corresponding bits in PADDR or PBDDR and NDERA or NDERB are set to 1, TPC output is enabled. The TPC output initially consists of the corresponding PADR or PBDR contents. When a compare-match event selected in TPCR occurs, the corresponding NDRA or NDRB bit contents are transferred to PADR or PBDR to update the output values.
  • Page 311: Output Timing

    9.3.2 Output Timing If TPC output is enabled, NDRA/NDRB contents are transferred to PADR/PBDR and output when the selected compare match event occurs. Figure 9-3 shows the timing of these operations for the case of normal output in groups 0 and 1, triggered by compare match A. ø...
  • Page 312 9.3.3 Normal TPC Output Sample Setup Procedure for Normal TPC Output: Figure 9-4 shows a sample procedure for setting up normal TPC output. Normal TPC output Select GR functions Set TIOR to make GRA an output compare register (with output inhibited). Set the TPC output trigger period.
  • Page 313: Normal Tpc Output

    Example of Normal TPC Output (Example of Five-Phase Pulse Output): Figure 9-5 shows an example in which the TPC is used for cyclic five-phase pulse output. TCNT value Compare match TCNT H'0000 Time NDRA PADR • The ITU channel to be used as the output trigger channel is set up so that GRA is an output compare register and the counter will be cleared by compare match A.
  • Page 314: Non-overlapping Tpc Output

    9.3.4 Non-Overlapping TPC Output Sample Setup Procedure for Non-Overlapping TPC Output: Figure 9-6 shows a sample procedure for setting up non-overlapping TPC output. Non-overlapping TPC output Select GR functions Set TIOR to make GRA and GRB output compare registers (with output inhibited). Set the TPC output trigger period in GRB Set GR values and the non-overlap margin in GRA.
  • Page 315 Example of Non-Overlapping TPC Output (Example of Four-Phase Complementary Non- Overlapping Output): Figure 9-7 shows an example of the use of TPC output for four-phase complementary non-overlapping pulse output. TCNT value TCNT H'0000 Time NDRA PADR Non-overlap margin • The ITU channel to be used as the output trigger channel is set up so that GRA and GRB are output compare registers and the counter will be cleared by compare match B.
  • Page 316 9.3.5 TPC Output Triggering by Input Capture TPC output can be triggered by ITU input capture as well as by compare match. If GR functions as an input capture register in the ITU channel selected in TPCR, TPC output will be triggered by the input capture signal.
  • Page 317: Usage Notes

    9.4 Usage Notes 9.4.1 Operation of TPC Output Pins to TP * are multiplexed with ITU pin functions. When ITU output is enabled, the corresponding pins cannot be used for TPC output. The data transfer from NDR bits to DR bits takes place, however, regardless of the usage of the pin.
  • Page 318 Therefore, 0 data can be transferred ahead of 1 data by making compare match B occur before compare match A. NDR contents should not be altered during the interval from compare match B to compare match A (the non-overlap margin). This can be accomplished by having the IMFA interrupt service routine write the next data in NDR, or by having the IMFA interrupt activate the DMAC.
  • Page 319: Section 10 Watchdog Timer

    As a watchdog timer, it generates a reset signal for the H8/3022 Series chip if a system crash allows the timer counter (TCNT) to overflow before being rewritten. In interval timer operation, an interval timer interrupt is requested at each TCNT overflow.
  • Page 320: Block Diagram

    10.1.2 Block Diagram Figure 10-1 shows a block diagram of the WDT. Overflow Internal TCNT data bus Read/ Interrupt Interrupt signal write control (interval timer) control TCSR Internal clock sources ø/2 RSTCSR ø/32 ø/64 Reset Reset control Clock ø/128 (internal, external) Clock selector ø/256...
  • Page 321: Register Configuration

    10.1.4 Register Configuration Table 10-2 summarizes the WDT registers. Table 10-2 WDT Registers Address* Write* Read Name Abbreviation Initial Value H'FFA8 H'FFA8 Timer control/status TCSR R/(W)* H'18 register H'FFA9 Timer counter TCNT H'00 H'FFAA H'FFAB Reset control/status RSTCSR R/(W)* H'3F register Notes: 1.
  • Page 322 10.2 Register Descriptions 10.2.1 Timer Counter (TCNT) TCNT is an 8-bit readable and writable* up-counter. Initial value Read/Write When the TME bit is set to 1 in TCSR, TCNT starts counting pulses generated from an internal clock source selected by bits CKS2 to CKS0 in TCSR. When the count overflows (changes from H'FF to H'00), the OVF bit is set to 1 in TCSR.
  • Page 323: Timer Control/status Register (tcsr)

    10.2.2 Timer Control/Status Register (TCSR) TCSR is an 8-bit readable and writable* register. Its functions include selecting the timer mode and clock source. WT/IT — — CKS2 CKS1 CKS0 Initial value Read/Write R/(W) — — Clock select These bits select the TCNT clock source Reserved bits Timer enable...
  • Page 324 Bit 7—Overflow Flag (OVF): This status flag indicates that the timer counter has overflowed from H'FF to H'00. Bit 7 Description [Clearing condition] Cleared by reading OVF when OVF = 1, then writing 0 in OVF (Initial value) [Setting condition] Set when TCNT changes from H'FF to H'00 Bit 6—Timer Mode Select (WT/IT): Selects whether to use the WDT as a watchdog timer or interval timer.
  • Page 325: Reset Control/status Register (rstcsr)

    Bits 2 to 0—Clock Select 2 to 0 (CKS2/1/0): These bits select one of eight internal clock sources, obtained by prescaling the system clock (ø), for input to TCNT. Bit 2 Bit 1 Bit 0 CKS2 CKS1 CKS0 Description ø/2 (Initial value) ø/32 ø/64...
  • Page 326 Bit 7—Watchdog Timer Reset (WRST): During watchdog timer operation, this bit indicates that TCNT has overflowed and generated a reset signal. This reset signal resets the entire chip internally. If bit RSTOE is set to 1, this reset signal is also output (low) at the RESO pin* initialize external system devices.
  • Page 327: Notes On Register Access

    10.2.4 Notes on Register Access The watchdog timer’s TCNT, TCSR, and RSTCSR registers differ from other registers in being more difficult to write. The procedures for writing and reading these registers are given below. Writing to TCNT and TCSR: These registers must be written by a word transfer instruction. They cannot be written by byte instructions.
  • Page 328 Writing to RSTCSR: RSTCSR must be written by a word transfer instruction. It cannot be written by byte transfer instructions. Figure 10-3 shows the format of data written to RSTCSR. To write 0 in the WRST bit, the write data must have H'A5 in the upper byte and H'00 in the lower byte.
  • Page 329: Operation

    WT/IT and TME bits to 1 in TCSR. Software must prevent TCNT overflow by rewriting the TCNT value (normally by writing H'00) before overflow occurs. If TCNT fails to be rewritten and overflows due to a system crash etc., the H8/3022 Series is internally reset for a duration of 518 states.
  • Page 330: Watchdog Timer Operation

    WDT overflow H'FF TME set to 1 TCNT count value H'00 OVF = 1 Start H'00 written Reset H'00 written in TCNT in TCNT Internal reset signal 518 states RESO 132 states Figure 10-4 Watchdog Timer Operation (Masked ROM Version) 10.3.2 Interval Timer Operation Figure 10-5 illustrates interval timer operation.
  • Page 331: Timing Of Setting Of Overflow Flag (ovf)

    10.3.3 Timing of Setting of Overflow Flag (OVF) Figure 10-6 shows the timing of setting of the OVF flag in TCSR. The OVF flag is set to 1 when TCNT overflows. At the same time, a reset signal is generated in watchdog timer operation, or an interval timer interrupt is generated in interval timer operation.
  • Page 332: Timing Of Setting Of Watchdog Timer Reset Bit (wrst)

    1 when TCNT overflows and OVF is set to 1. At the same time an internal reset signal is generated for the entire H8/3022 Series chip. This internal reset signal clears OVF to 0, but the WRST bit remains set to 1. The reset routine must therefore clear the WRST bit.
  • Page 333: Interrupts

    10.4 Interrupts During interval timer operation, an overflow generates an interval timer interrupt (WOVI). The interval timer interrupt is requested whenever the OVF bit is set to 1 in TCSR. 10.5 Usage Notes Contention between TCNT Write and Increment: If a timer counter clock pulse is generated during the T3 state of a write cycle to TCNT, the write takes priority and the timer count is not incremented.
  • Page 334: Section 11 Serial Communication Interface

    Section 11 Serial Communication Interface 11.1 Overview The H8/3022 Series has a serial communication interface (SCI) with two independent channels. The two channels are functionally identical. The SCI can communicate in asynchronous or synchronous mode. It also has a multiprocessor communication function for serial communication among two or more processors.
  • Page 335 • Full-duplex communication The transmitting and receiving sections are independent, so the SCI can transmit and receive simultaneously. The transmitting and receiving sections are both double-buffered, so serial data can be transmitted and received continuously. • Built-in baud rate generator with selectable bit rates •...
  • Page 336: Block Diagram

    11.1.2 Block Diagram Figure 11-1 shows a block diagram of the SCI. Internal data bus Module data bus ø Baud rate ø/4 generator Transmit/ ø/16 receive control ø/64 Parity generation Clock Parity check External clock Legend RSR: Receive shift register RDR: Receive data register TSR:...
  • Page 337: Pin Configuration

    11.1.3 Pin Configuration The SCI has the serial pins for each channel as listed in table 11-1. Table 11-1 SCI Pins Channel Name Abbreviation Function Serial clock pin Input/output clock input/output Receive data pin Input receive data input Transmit data pin Output transmit data output Serial clock pin...
  • Page 338: Register Descriptions

    11.2 Register Descriptions 11.2.1 Receive Shift Register (RSR) RSR is an 8-bit register that receives serial data. Read/Write — — — — — — — — The SCI loads serial data input at the RxD pin into RSR in the order received, LSB (bit 0) first, thereby converting the data to parallel data.
  • Page 339: Transmit Shift Register (tsr)

    11.2.3 Transmit Shift Register (TSR) TSR is an 8-bit register used to transmit serial data. Read/Write — — — — — — — — The SCI loads transmit data from TDR into TSR, then transmits the data serially from the TxD pin, LSB (bit 0) first.
  • Page 340: Serial Mode Register (smr)

    11.2.5 Serial Mode Register (SMR) SMR is an 8-bit register that specifies the SCI serial communication format and selects the clock source for the baud rate generator. STOP CKS1 CKS0 Initial value Read/Write Clock select 1/0 These bits select the baud rate generator’s clock source Multiprocessor mode...
  • Page 341 Bit 7—Communication Mode (C/A): Selects whether the SCI operates in asynchronous or synchronous mode. Bit 7 Description Asynchronous mode (Initial value) Synchronous mode Bit 6—Character Length (CHR): Selects 7-bit or 8-bit data length in asynchronous mode. In synchronous mode the data length is 8 bits regardless of the CHR setting. Bit 6 Description 8-bit data...
  • Page 342 Bit 4—Parity Mode (O/E): Selects even or odd parity. The O/E bit setting is valid in asynchronous mode when the PE bit is set to 1 to enable the adding and checking of a parity bit. The O/E setting is ignored in synchronous mode, or when parity adding and checking is disabled in asynchronous mode.
  • Page 343 Bit 2—Multiprocessor Mode (MP): Selects a multiprocessor format. When a multiprocessor format is selected, parity settings made by the PE and O/E bits are ignored. The MP bit setting is valid only in asynchronous mode. It is ignored in synchronous mode. For further information on the multiprocessor communication function, see section 11.3.3, Multiprocessor Communication Function.
  • Page 344: Serial Control Register (scr)

    11.2.6 Serial Control Register (SCR) SCR enables the SCI transmitter and receiver, enables or disables serial clock output in asynchronous mode, enables or disables interrupts, and selects the transmit/receive clock source. MPIE TEIE CKE1 CKE0 Initial value Read/Write Clock enable 1/0 These bits select the SCI clock source Transmit end interrupt enable...
  • Page 345 Bit 7—Transmit Interrupt Enable (TIE): Enables or disables the transmit-data-empty interrupt (TXI) requested when the TDRE flag in SSR is set to 1 due to transfer of serial transmit data from TDR to TSR. Bit 7 Description Transmit-data-empty interrupt request (TXI) is disabled* (Initial value) Transmit-data-empty interrupt request (TXI) is enabled Note: * TXI interrupt requests can be cleared by reading the value 1 from the TDRE flag, then...
  • Page 346 Bit 4—Receive Enable (RE): Enables or disables the start of SCI serial receiving operations. Bit 4 Description Receiving disabled* (Initial value) Receiving enabled* Notes: 1. Clearing the RE bit to 0 does not affect the RDRF, FER, PER, and ORER flags. These flags retain their previous values.
  • Page 347 Bit 2—Transmit-End Interrupt Enable (TEIE): Enables or disables the transmit-end interrupt (TEI) requested if TDR does not contain new transmit data when the MSB is transmitted. Bit 2 TEIE Description Transmit-end interrupt requests (TEI) are disabled* (Initial value) Transmit-end interrupt requests (TEI) are enabled* Note: * TEI interrupt requests can be cleared by reading the value 1 from the TDRE flag in SSR, then clearing the TDRE flag to 0, thereby also clearing the TEND flag to 0;...
  • Page 348: Serial Status Register (ssr)

    11.2.7 Serial Status Register (SSR) SSR is an 8-bit register containing multiprocessor bit values, and status flags that indicate the SCI operating status. TDRE RDRF ORER TEND MPBT Initial value Read/Write R/(W) R/(W) R/(W) R/(W) R/(W) Multiprocessor bit transfer Value of multi- processor bit to be transmitted Multiprocessor bit...
  • Page 349 The CPU can always read and write SSR, but cannot write 1 in the TDRE, RDRF, ORER, PER, and FER flags. These flags can be cleared to 0 only if they have first been read while set to 1. The TEND and MPB flags are read-only bits that cannot be written.
  • Page 350 Bit 5—Overrun Error (ORER): Indicates that data reception ended abnormally due to an overrun error. Bit 5 ORER Description Receiving is in progress or has ended normally (Initial value)* [Clearing conditions] The chip is reset or enters standby mode. Software reads ORER while it is set to 1, then writes 0. A receive overrun error occurred* [Setting condition] Reception of the next serial data ends when RDRF = 1.
  • Page 351 Bit 3—Parity Error (PER): Indicates that data reception ended abnormally due to a parity error in asynchronous mode. Bit 3 Description Receiving is in progress or has ended normally* (Initial value) [Clearing conditions] The chip is reset or enters standby mode. Software reads PER while it is set to 1, then writes 0.
  • Page 352: Bit Rate Register (brr)

    Bit 1—Multiprocessor Bit (MPB): Stores the value of the multiprocessor bit in receive data when a multiprocessor format is used in asynchronous mode. MPB is a read-only bit and cannot be written. Bit 1 Description Multiprocessor bit value in receive data is 0* (Initial value) Multiprocessor bit value in receive data is 1 Note: * If the RE bit is cleared to 0 when a multiprocessor format is selected, MPB retains its...
  • Page 353 Table 11-3 Examples of Bit Rates and BRR Settings in Asynchronous Mode ø (MHz) 2.097152 2.4576 Bit Rate Error Error Error Error (bits/s) 0.03 –0.04 –0.26 0.03 0.16 0.21 0.16 0.16 0.21 0.16 0.16 0.21 0.16 1200 0.16 –0.70 0.16 2400 0.16 1.14...
  • Page 354 ø (MHz) 6.144 7.3728 Bit Rate Error Error Error Error (bits/s) –0.44 0.08 –0.07 0.03 0.16 0.16 0.16 0.16 0.16 0.16 1200 0.16 0.16 2400 0.16 0.16 4800 0.16 0.16 9600 –2.34 0.16 19200 –2.34 0.16 31250 2.40 5.33 38400 –2.34 –6.99 ø...
  • Page 355 ø (MHz) 14.7456 Bit Rate Error Error Error Error (bits/s) –0.17 0.70 0.03 –0.12 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 1200 0.16 0.16 0.16 2400 0.16 0.16 0.16 4800 0.16 0.16 0.16 9600 –0.93 0.16 –0.69 19200 –0.93 0.16 1.02...
  • Page 356 Table 11-4 Examples of Bit Rates and BRR Settings in Synchronous Mode ø (MHz) Bit Rate (bits/s) — — — — — — — — — — — — — — — — — — 2.5 k 10 k 25 k 50 k 100 k 250 k...
  • Page 357 SMR Settings Clock Source CKS1 CKS0 ø ø/4 ø/16 ø/64 The bit rate error in asynchronous mode is calculated as follows. ø × 10 –1} ×100 Error (%) ={ (N + 1) × B × 64 × 2 2n-1...
  • Page 358 Table 11-5 indicates the maximum bit rates in asynchronous mode for various system clock frequencies. Tables 11-6 and 11-7 indicate the maximum bit rates with external clock input. Table 11-5 Maximum Bit Rates for Various Frequencies (Asynchronous Mode) Settings ø (MHz) Maximum Bit Rate (bits/s) 62500 2.097152...
  • Page 359 Table 11-6 Maximum Bit Rates with External Clock Input (Asynchronous Mode) ø (MHz) External Input Clock (MHz) Maximum Bit Rate (bits/s) 0.5000 31250 2.097152 0.5243 32768 2.4576 0.6144 38400 0.7500 46875 3.6864 0.9216 57600 1.0000 62500 4.9152 1.2288 76800 1.2500 78125 1.5000 93750...
  • Page 360 Table 11-7 Maximum Bit Rates with External Clock Input (Synchronous Mode) ø (MHz) External Input Clock (MHz) Maximum Bit Rate (bits/s) 0.3333 333333.3 0.6667 666666.7 1.0000 1000000.0 1.3333 1333333.3 1.6667 1666666.7 2.0000 2000000.0 2.3333 2333333.3 2.6667 2666666.7 3.0000 3000000.0...
  • Page 361: Operation

    11.3 Operation 11.3.1 Overview The SCI has an asynchronous mode in which characters are synchronized individually, and a synchronous mode in which communication is synchronized with clock pulses. Serial communication is possible in either mode. Asynchronous or synchronous mode and the communication format are selected in SMR, as shown in table 11-8.
  • Page 362 Table 11-8 SMR Settings and Serial Communication Formats SCI Communication Format SMR Settings Multi- Stop Bit 7 Bit 6 Bit 2 Bit 5 Bit 3 Data processor Parity STOP Mode Length Length Asynchronous 8-bit data Absent Absent 1 bit mode 2 bits Pr es ent 1 bit...
  • Page 363: Operation In Asynchronous Mode

    11.3.2 Operation in Asynchronous Mode In asynchronous mode each transmitted or received character begins with a start bit and ends with a stop bit. Serial communication is synchronized one character at a time. The transmitting and receiving sections of the SCI are independent, so full-duplex communication is possible.
  • Page 364 Communication Formats: Table 11-10 shows the 12 communication formats that can be selected in asynchronous mode. The format is selected by settings in SMR. Table 11-10 Serial Communication Formats (Asynchronous Mode) SMR Settings Serial Communication Format and Frame Length STOP 8-bit data STOP 8-bit data...
  • Page 365 Clock: An internal clock generated by the on-chip baud rate generator or an external clock input from the SCK pin can be selected as the SCI transmit/receive clock. The clock source is selected by the C/A bit in SMR and bits CKE1 and CKE0 in SCR. See table 11-9. When an external clock is input at the SCK pin, it must have a frequency equal to 16 times the desired bit rate.
  • Page 366 Start of initialization Select the clock source in SCR. Clear the RIE, TIE, TEIE, MPIE, TE, and RE bits to 0. If clock output is selected in asynchronous mode, clock output starts immediately after Clear TE and RE bits the setting is made in SCR. to 0 in SCR Select the communication format in SMR.
  • Page 367 Transmitting Serial Data (Asynchronous Mode): Figure 11-5 shows a sample flowchart for transmitting serial data and indicates the procedure to follow. 1. SCI initialization: the transmit data output function Initialize of the TxD pin is selected automatically. After the TE bit is set to 1, one frame of 1s is output, then transmission is Start transmitting possible.
  • Page 368 In transmitting serial data, the SCI operates as follows. • The SCI monitors the TDRE flag in SSR. When the TDRE flag is cleared to 0 the SCI recognizes that TDR contains new data, and loads this data from TDR into TSR. •...
  • Page 369 Receiving Serial Data (Asynchronous Mode): Figure 11-7 shows a sample flowchart for receiving serial data and indicates the procedure to follow. Initialize SCI initialization: the receive data function of the RxD pin is selected automatically. 2., 3. Receive error handling and break Start receiving detection: if a receive error occurs, read the ORER, PER, and FER flags in SSR to identify...
  • Page 370 Error handling ORER = 1? Overrun error handling FER = 1? Break? Framing error handling Clear RE bit to 0 in SCR PER = 1? Parity error handling Clear ORER, PER, and FER flags to 0 in SSR Figure 11-7 Sample Flowchart for Receiving Serial Data (2)
  • Page 371 In receiving, the SCI operates as follows. • The SCI monitors the receive data line. When it detects a start bit, the SCI synchronizes internally and starts receiving. • Receive data is stored in RSR in order from LSB to MSB. •...
  • Page 372: Multiprocessor Communication

    Figure 11-8 shows an example of SCI receive operation in asynchronous mode. Start Parity Stop Start Parity Stop Data Data Idle (mark) state RDRF RXI interrupt handler request reads data in RDR and Framing error, clears RDRF flag to 0 ERI request 1 frame Figure 11-8 Example of SCI Receive Operation (8-Bit Data with Parity and One Stop Bit)
  • Page 373 Communication Formats: Four formats are available. Parity-bit settings are ignored when a multiprocessor format is selected. For details see table 11-11. Clock: See the description of asynchronous mode. Transmitting processor Serial communication line Receiving Receiving Receiving Receiving processor A processor B processor C processor D (ID = 01)
  • Page 374 Transmitting and Receiving Data Transmitting Multiprocessor Serial Data: Figure 11-10 shows a sample flowchart for transmitting multiprocessor serial data and indicates the procedure to follow. Initialize SCI initialization: the transmit data output function of the TxD pin is selected automatically. Start transmitting SCI status check and transmit data write: read SSR, check that the TDRE...
  • Page 375 In transmitting serial data, the SCI operates as follows. • The SCI monitors the TDRE flag in SSR. When the TDRE flag is cleared to 0 the SCI recognizes that TDR contains new data, and loads this data from TDR into TSR. •...
  • Page 376 Receiving Multiprocessor Serial Data: Figure 11-12 shows a sample flowchart for receiving multiprocessor serial data and indicates the procedure to follow. Initialize SCI initialization: the receive data function of the RxD pin is selected automatically. Start receiving ID receive cycle: set the MPIE bit to 1 in SCR. SCI status check and ID check: read SSR, check that the RDRF flag is set to 1, then read Set MPIE bit to 1 in SCR...
  • Page 377 Error handling ORER = 1? Overrun error handling FER = 1? Break? Framing error handling Clear RE bit to 0 in SCR Clear ORER and FER flags to 0 in SSR Figure 11-12 Sample Flowchart for Receiving Multiprocessor Serial Data (2)
  • Page 378 Figure 11-13 shows an example of SCI receive operation using a multiprocessor format. Start Stop Start Stop Data (ID1) Data (data1) Idle (mark) state MPIE RDRF RDR value RXI request RXI handler reads Not own ID, so No RXI request, (multiprocessor RDR data and clears MPIE bit is set...
  • Page 379: Synchronous Operation

    11.3.4 Synchronous Operation In synchronous mode, the SCI transmits and receives data in synchronization with clock pulses. This mode is suitable for high-speed serial communication. The SCI transmitter and receiver share the same clock but are otherwise independent, so full duplex communication is possible.
  • Page 380 Transmitting and Receiving Data SCI Initialization (Synchronous Mode): Before transmitting or receiving, clear the TE and RE bits to 0 in SCR, then initialize the SCI as follows. When changing the communication mode or format, always clear the TE and RE bits to 0 before following the procedure given below.
  • Page 381 Transmitting Serial Data (Synchronous Mode): Figure 11-16 shows a sample flowchart for transmitting serial data and indicates the procedure to follow. SCI initialization: the transmit data output function Initialize of the TxD pin is selected automatically. SCI status check and transmit data write: read SSR, check that the TDRE flag is 1, then write transmit Start transmitting data in TDR and clear the TDRE flag to 0.
  • Page 382 In transmitting serial data, the SCI operates as follows. • The SCI monitors the TDRE flag in SSR. When the TDRE flag is cleared to 0 the SCI recognizes that TDR contains new data, and loads this data from TDR into TSR. •...
  • Page 383 Figure 11-17 shows an example of SCI transmit operation. Transmit direction Serial clock Serial data Bit 0 Bit 1 Bit 7 Bit 0 Bit 1 Bit 6 Bit 7 TDRE TEND TXI interrupt handler request writes data in TDR request request and clears TDRE flag to 0...
  • Page 384 Receiving Serial Data (Synchronous Mode): Figure 11-18 shows a sample flowchart for receiving serial data and indicates the procedure to follow. When switching from asynchronous mode to synchronous mode, make sure that the ORER, PER, and FER flags are cleared to 0. If the FER or PER flag is set to 1 the RDRF flag will not be set and both transmitting and receiving will be disabled.
  • Page 385 Error handling Overrun error handling Clear ORER flag to 0 in SSR Figure 11-18 Sample Flowchart for Serial Receiving (2) In receiving, the SCI operates as follows. • The SCI synchronizes with serial clock input or output and initializes internally. •...
  • Page 386 Figure 11-19 shows an example of SCI receive operation. Serial clock Serial data Bit 7 Bit 0 Bit 7 Bit 0 Bit 1 Bit 6 Bit 7 RDRF ORER RXI interrupt handler request reads data in RDR and request Overrun error, clears RDRF flag to 0 ERI request 1 frame...
  • Page 387 SCI initialization: the transmit data output function of the TxD pin and Initialize receive data input function of the RxD pin are selected, enabling Start transmitting and receiving simultaneous transmitting and receiving. SCI status check and transmit data write: read SSR, check that Read TDRE flag in SSR the TDRE flag is 1, then write transmit data in TDR and clear...
  • Page 388: Sci Interrupts

    11.4 SCI Interrupts The SCI has four interrupt request sources: TEI (transmit-end interrupt), ERI (receive-error interrupt), RXI (receive-data-full interrupt), and TXI (transmit-data-empty interrupt). Table 11-12 lists the interrupt sources and indicates their priority. These interrupts can be enabled and disabled by the TIE, RIE, and TEIE bits in SCR.
  • Page 389: Usage Notes

    11.5 Usage Notes Note the following points when using the SCI. TDR Write and TDRE Flag: The TDRE flag in SSR is a status flag indicating the loading of transmit data from TDR into TSR. The SCI sets the TDRE flag to 1 when it transfers data from TDR to TSR.
  • Page 390 Break Detection and Processing: Break signals can be detected by reading the RxD pin directly when a framing error (FER) is detected. In the break state the input from the RxD pin consists of all 0s, so the FER flag is set and the parity error flag (PER) may also be set. In the break state the SCI receiver continues to operate, so if the FER flag is cleared to 0 it will be set to 1 again.
  • Page 391 16 clocks 8 clocks 15 0 15 0 Internal base clock Receive data Start bit (RxD) Synchronization sampling timing Data sampling timing Figure 11-21 Receive Data Sampling Timing in Asynchronous Mode The receive margin in asynchronous mode can therefore be expressed as shown in equation (1). | D –...
  • Page 392 TDRE Continuous transmission Note: Make sure that t is at least 5 states. Figure 11-22 Transmission in Synchronous Mode (Example) Restrictions when Switching from SCK Pin to Port Function in Synchronous SCI: 1. Problem in Operation After setting DDR and DR to 1 and using synchronous SCI clock output, when the SCK pin is switched to the port function at the end of transmission, a low-level signal is output for one half- cycle before the port output state is established.
  • Page 393 2. Usage Note The procedure shown below should be used to prevent low-level output when switching from the SCK pin function to the port function. As this procedure temporarily places the SCK pin in the input state, the SCK/port pin should be pulled up beforehand with an external circuit.With DDR = 1, DR = 1, C/A = 1, CKE1 = 0, CKE0 = 0, and TE = 1, make the following settings in the order shown.
  • Page 394: Section 12 Smart Card Interface

    Switching between the normal serial communication interface and the Smart Card interface is carried out by means of a register setting. 12.1.1 Features Features of the Smart Card interface supported by the H8/3022 Series are as follows. • Asynchronous mode  Data length: 8 bits  Parity bit generation and checking ...
  • Page 395: Block Diagram

    12.1.2 Block Diagram Figure 12-1 shows a block diagram of the Smart Card interface. Internal Module data bus data bus SCMR ø ø/4 Baud rate generator ø/16 Transmission/ ø/64 reception control Parity generation Clock Parity check Legend : Smart Card mode register SCMR : Receive shift register : Receive data register...
  • Page 396: Pin Configuration

    12.1.3 Pin Configuration Table 12-1 shows the Smart Card interface pin configuration. Table 12-1 Smart Card Interface Pins Pin Name Abbreviation Function Serial clock pin 0 Output clock output Receive data pin 0 Input receive data input Transmit data pin 0 Output transmit data output 12.1.4...
  • Page 397: Register Descriptions

    12.2 Register Descriptions Registers added with the Smart Card interface and bits for which the function changes are described here. 12.2.1 Smart Card Mode Register (SCMR) — — — — SDIR SINV — SMIF Initial value Read/Write — — — —...
  • Page 398 Bit 2—Smart Card Data Invert (SINV): Specifies inversion of the data logic level. This function is used together with the SDIR bit for communication with an inverse convention card. The SINV bit does not affect the logic level of the parity bit. For parity-related setting procedures, see section 12.3.4, Register Settings.
  • Page 399: Serial Status Register (ssr)

    12.2.2 Serial Status Register (SSR) TDRE RDRF ORER TEND MPBT Initial value R/(W) R/(W) R/(W) R/(W) R/(W) Transmit end Status flag indicating end of transmission Error signal status Status flag indicating that an error signal has been received Note: * Only 0 can be written to bits 7 to 3, to clear these flags. Bit 4 of SSR has a different function in Smart Card interface mode.
  • Page 400 Bits 3 to 0—Operate in the same way as for the normal SCI. For details, see section 11.2.7, Serial Status Register (SSR). However, the setting conditions for the TEND bit are as shown below. Bit 2 TEND Description Transmission is in progress [Clearing condition] (Initial value) When 0 is written to TDRE after reading TDRE = 1...
  • Page 401: Operation

    12.3 Operation 12.3.1 Overview The main functions of the Smart Card interface are as follows. • One frame consists of 8-bit and plus a parity bit. • In transmission, a guard time of at least 2 etu (Elementary Time Unit: the time for transfer of one bit) is left between the end of the parity bit and the start of the next frame.
  • Page 402 Data line Clock line Px (port) H8/3022 Series Reset line IC card Chip Connected equipment Figure 12-2 Schematic Diagram of Smart Card Interface Pin Connections Note: If an IC card is not connected, and the TE and RE bits are both set to 1, closed...
  • Page 403: Data Format

    12.3.3 Data Format Figure 12-3 shows the Smart Card interface data format. In reception in this mode, a parity check is carried out on each frame, and if an error is detected an error signal is sent back to the transmitting end, and retransmission of the data is requested.
  • Page 404 The operation sequence is as follows. [1] When the data line is not in use it is in the high-impedance state, and is fixed high with a pull- up resistor. [2] The transmitting station starts a date transfer of one frame. The data frame starts with a start bit (Ds, low-level).
  • Page 405: Register Settings

    12.3.4 Register Settings Table 12-3 shows a bit map of the registers used by the smart card interface. Bits indicated as 0 or 1 must be set to the value shown. The setting of other bits is described below. Table 12-3 Smart Card Interface Register Settings Register Bit 7 Bit 6...
  • Page 406 The parity bit is 0, corresponding to state Z, since even parity is stipulated for the Smart Card. With the H8/3022 Series, inversion specified by the SINV bit applies only to the data bits, D7 to D0. For parity bit inversion, the O/E bit in SMR is set to odd parity mode (the same applies...
  • Page 407: Clock

    12.3.5 Clock Only an internal clock generated by the on-chip baud rate generator can be used as the transmit/receive clock for the smart card interface. The bit rate is set with BRR and the CKS1 and CKS0 bits in SMR. The formula for calculating the bit rate is as shown below. Table 12-5 shows some sample bit rates.
  • Page 408 The method of calculating the value from the operating frequency and bit rate, on the other hand, is shown below. N is an integer, 0 ≤ N ≤ 255, and the smaller error is specified. ø × 10 – 1 1488 ×...
  • Page 409: Data Transfer Operations

    12.3.6 Data Transfer Operations Initialization: Before transmitting and receiving data, initialize the SCI as described below. Initialization is also necessary when switching from transmit mode to receive mode, or vice versa. [1] Clear the TE and RE bits in SCR to 0. [2] Clear the error flags ERS, PER, and ORER in SSR to 0.
  • Page 410 Serial Data Transmission: As data transmission in smart card mode involves error signal sampling and retransmission processing, the processing procedure is different from that for the normal SCI. Figure 12-4 shows an example of the transmission processing flow, and figure 12-5 shows the relation between a transmit operation and the internal registers.
  • Page 411 Start Initialization Start transmission ERS=0? Error processing TEND=1? Write data to TDR, and clear TDRE flag in SSR to 0 All data transmitted? ERS=0? Error processing TEND=1? Clear TE bit to 0 Figure 12-4 Example of Transmission Processing Flow...
  • Page 412 (shift register) (1) Data write Data 1 (2) Transfer from Data 1 Data 1 ; Data remains in TDR TDR to TSR Data 1 I/O signal line output (3) Serial data output Data 1 In case of normal transmission: TEND flag is set In case of transmit error: ERS flag is set Steps (2) and (3) above are repeated until the TEND flag is set...
  • Page 413 Serial Data Reception: Data reception in Smart Card mode uses the same processing procedure as for the normal SCI. Figure 12-6 shows an example of the transmission processing flow. [1] Perform Smart Card interface mode initialization as described above in Initialization. [2] Check that the ORER flag and PER flag in SSR are cleared to 0.
  • Page 414 With the above processing, interrupt servicing is possible. If reception ends and the RDRF flag is set to 1 while the RIE bit is set to 1 and interrupt requests are enabled, a receive data full interrupt (RXI) request will be generated. If an error occurs in reception and either the ORER flag or the PER flag is set to 1, a transfer error interrupt (ERI) request will be generated.
  • Page 415: Usage Note

    12.4 Usage Note The following points should be noted when using the SCI as a smart card interface. Receive Data Sampling Timing and Reception Margin in Smart Card Interface Mode: In smart card interface mode, the SCI operates on a basic clock with a frequency of 372 times the transfer rate.
  • Page 416 Thus the reception margin in smart card interface mode is given by the following formula.  D – 0.5 (1 + F) × 100% M = (0.5 – ) – (L – 0.5) F – Where M: Reception margin (%) N: Ratio of bit rate to clock (N = 372) D: Clock duty (D = 0 to 1.0) L: Frame length (L = 10)
  • Page 417 Transfer nth transfer frame Retransferred frame frame n+1 (DE) D0 D1 D2 D3 D4 D5 D6 D7 Dp DE Ds D0 D1 D2 D3 D4 D5 D6 D7 Dp Ds D0 D1 D2 D3 D4 RDRF Figure 12-8 Retransfer Operation in SCI Receive Mode •...
  • Page 418: Section 13 A/d Converter

    Section 13 A/D Converter 13.1 Overview The H8/3022 Series includes a 10-bit successive-approximations A/D converter with a selection of up to eight analog input channels. When the A/D converter is not used, it can be halted independently to conserve power. For details see section 17.6, Module Standby Function.
  • Page 419: Block Diagram

    13.1.2 Block Diagram Figure 13-1 shows a block diagram of the A/D converter. Internal Module data bus data bus 10-bit D/A – ø/8 Comparator Analog Control circuit multi- plexer Sample-and- ø/16 hold circuit interrupt ADTRG Legend ADCR: A/D control register ADCSR: A/D control/status register ADDRA:...
  • Page 420: Pin Configuration

    13.1.3 Pin Configuration Table 13-1 summarizes the A/D converter’s input pins. The eight analog input pins are divided into two groups: group 0 (AN to AN ), and group 1 (AN to AN ). AV and AV are the power supply for the analog circuits in the A/D converter.
  • Page 421: Register Configuration

    13.1.4 Register Configuration Table 13-2 summarizes the A/D converter’s registers. Table 13-2 A/D Converter Registers Address* Name Abbreviation Initial Value H'FFE0 A/D data register A (high) ADDRAH H'00 H'FFE1 A/D data register A (low) ADDRAL H'00 H'FFE2 A/D data register B (high) ADDRBH H'00 H'FFE3...
  • Page 422: Register Descriptions

    13.2 Register Descriptions 13.2.1 A/D Data Registers A to D (ADDRA to ADDRD) ADDRn — — — — — — Initial value Read/Write (n = A to D) A/D conversion data Reserved bits 10-bit data giving an A/D conversion result The four A/D data registers (ADDRA to ADDRD) are 16-bit read-only registers that store the results of A/D conversion.
  • Page 423: A/d Control/status Register (adcsr)

    13.2.2 A/D Control/Status Register (ADCSR) ADIE ADST SCAN Initial value Read/Write R/(W) Channel select 2 to 0 These bits select analog input channels Clock select Selects the A/D conversion time Scan mode Selects single mode or scan mode A/D start Starts or stops A/D conversion A/D interrupt enable Enables and disables A/D end interrupts...
  • Page 424 Bit 7—A/D End Flag (ADF): Indicates the end of A/D conversion. Bit 7 Description [Clearing condition] (Initial value) Cleared by reading ADF while ADF = 1, then writing 0 in ADF [Setting conditions] Single mode: A/D conversion ends Scan mode: A/D conversion ends in all selected channels Bit 6—A/D Interrupt Enable (ADIE): Enables or disables the interrupt (ADI) requested at the end of A/D conversion.
  • Page 425 Bit 4—Scan Mode (SCAN): Selects single mode or scan mode. For further information on operation in these modes, see section 13.4, Operation. Clear the ADST bit to 0 before switching the conversion mode. Bit 4 SCAN Description Single mode (Initial value) Scan mode Bit 3—Clock Select (CKS): Selects the A/D conversion time.
  • Page 426: A/d Control Register (adcr)

    13.2.3 A/D Control Register (ADCR) TRGE — — — — — — — Initial value Read/Write — — — — — — — Reserved bits Trigger enable Enables or disables external triggering of A/D conversion ADCR is an 8-bit readable/writable register that enables or disables external triggering of A/D conversion.
  • Page 427: Cpu Interface

    13.3 CPU Interface ADDRA to ADDRD are 16-bit registers, but they are connected to the CPU by an 8-bit data bus. Therefore, although the upper byte can be be accessed directly by the CPU, the lower byte is read through an 8-bit temporary register (TEMP). An A/D data register is read as follows.
  • Page 428: Operation

    13.4 Operation The A/D converter operates by successive approximations with 10-bit resolution. It has two operating modes: single mode and scan mode. 13.4.1 Single Mode (SCAN = 0) Single mode should be selected when only one A/D conversion on one channel is required. A/D conversion starts when the ADST bit is set to 1 by software, or by external trigger input.
  • Page 429 Figure 13-3 Example of A/D Converter Operation (Single Mode, Channel 1 Selected)
  • Page 430: Scan Mode (scan = 1)

    13.4.2 Scan Mode (SCAN = 1) Scan mode is useful for monitoring analog inputs in a group of one or more channels. When the ADST bit is set to 1 by software or external trigger input, A/D conversion starts on the first channel in the group (AN when CH2 = 0, AN when CH2 = 1).
  • Page 431 Figure 13-4 Example of A/D Converter Operation (Scan Mode, Channels AN to AN Selected)
  • Page 432: Input Sampling And A/d Conversion Time

    13.4.3 Input Sampling and A/D Conversion Time The A/D converter has a built-in sample-and-hold circuit. The A/D converter samples the analog input at a time t after the ADST bit is set to 1, then starts conversion. Figure 13-5 shows the A/D conversion timing.
  • Page 433: External Trigger Input Timing

    Table 13-4 A/D Conversion Time (Single Mode) CKS = 0 CKS = 1 Symbol Synchronization delay — — Input sampling time — — — — A/D conversion time — — CONV Note: Values in the table are numbers of states. 13.4.4 External Trigger Input Timing A/D conversion can be externally triggered.
  • Page 434: Interrupts

    13.5 Interrupts The A/D converter generates an interrupt (ADI) at the end of A/D conversion. The ADI interrupt request can be enabled or disabled by the ADIE bit in ADCSR. 13.6 Usage Notes The following points should be noted when using the A/D converter. Setting Range of Analog Power Supply and Other Pins: (1) Analog input voltage range The voltage applied to analog input pins AN...
  • Page 435 If a filter capacitor is connected as shown in figure 13-7, the input currents at the analog input pins to AN ) are averaged, and so an error may arise. Also, when A/D conversion is performed frequently, as in scan mode, if the current charged and discharged by the capacitance of the sample-and-hold circuit in the A/D converter exceeds the current input via the input impedance ), an error will arise in the analog input pin voltage.Therefore careful consideration is required when deciding the circuit constants.
  • Page 436 20 pF Note: Values are reference values. Figure 13-8 Analog Input Pin Equivalent Circuit A/D Conversion Precision Definitions: H8/3022 Series A/D conversion precision definitions are given below. • Resolution The number of A/D converter digital output codes • Offset error...
  • Page 437 • Absolute precision The deviation between the digital value and the analog input value. Includes the offset error, full-scale error, quantization error, and nonlinearity error. Digital output Ideal A/D conversion characteristic Quantization error Analog input voltage Figure 13-9 A/D Conversion Precision Definitions (1)
  • Page 438 Figure 13-10 A/D Conversion Precision Definitions (2) Permissible Signal Source Impedance: H8/3022 Series analog input is designed so that conversion precision is guaranteed for an input signal for which the signal source impedance is 5 kΩ or less. This specification is provided to enable the A/D converter’s sample-and-hold circuit input capacitance to be charged within the sampling time;...
  • Page 439 GND may adversely affect absolute precision. Be sure to make the connection to an electrically stable GND such as AV Care is also required to insure that filter circuits do not communicate with digital signals on the mounting board, thus acting as antennas. H8/3022 Series A/D converter equivalent circuit Sensor output impedance 10 kΩ...
  • Page 440: Section 14 Ram

    Section 14 RAM 14.1 Overview The H8/3022 has 8 kbytes of on-chip static RAM, H8/3021 has 8 kbytes, and H8/3020 has 4kbytes. The RAM is connected to the CPU by a 16-bit data bus. The CPU accesses both byte data and word data in two states, making the RAM suitable for rapid data transfer.
  • Page 441: Block Diagram

    SYSCR: System control register Note: * Lower 20 bits of the address Figure 14-1 RAM Block Diagram (H8/3022 in Modes 1, 5, 6 and 7) 14.1.2 Register Configuration The on-chip RAM is controlled by the system control register (SYSCR). Table 14-2 gives the address and initial value of SYSCR.
  • Page 442: System Control Register (syscr)

    14.2 System Control Register (SYSCR) SSBY STS2 STS1 STS0 NMIEG — RAME Initial value Read/Write — RAM enable bit Enables or disables on-chip RAM Reserved bit NMI edge select User bit enable Standby timer select 2 to 0 Software standby SYSCR is to enable or disable access to the on-chip RAM.
  • Page 443: Operation

    14.3 Operation When the RAME bit is set to 1, the on-chip RAM is enabled. This LSI can access the on-chip RAM when addressing the addresses shown in Table 4-1 in each operation mode. When the RAME bit is cleared to 0 in modes 1, 3, 5, and 6 (expanded modes), external address space is accessed.
  • Page 444: Section 15 Rom

    Section 15 ROM 15.1 Features The H8/3022 Series has 256 kbytes of on-chip flash memory. The features of the flash memory are summarized below. • Four flash memory operating modes  Program mode  Erase mode  Program-verify mode  Erase-verify mode •...
  • Page 445: Overview

    15.2 Overview 15.2.1 Block Diagram Internal address bus Internal data bus (16 bits) FLMCR1 FLMCR2 Operating FWE pin Bus interface/controller mode Mode pin EBR1 EBR2 RAMER Flash memory (256 kbytes) Legend FLMCR1: Flash memory control register 1 FLMCR2: Flash memory control register 2 EBR1: Erase block register 1 EBR2:...
  • Page 446: Mode Transitions

    15.2.2 Mode Transitions When the mode pins and the FWE pin are set in the reset state and a reset-start is executed, the microcomputer enters an operating mode as shown in figure 15-2. In user mode, flash memory can be read but not programmed or erased. The boot, user program and PROM modes are provided as modes to write and erase the flash memory.
  • Page 447: On-board Programming Modes

    The old program version or data remains written When boot mode is entered, the boot program in in the flash memory. The user should prepare the the H8/3022 (originally incorporated in the chip) programming control program and new is started and the programming control program application program beforehand in the host.
  • Page 448 Host Host Programming/ erase control program New application New application program program H8/3022 H8/3022 Boot program Boot program Flash memory Flash memory FWE assessment FWE assessment program program...
  • Page 449: Flash Memory Emulation In Ram

    15.2.4 Flash Memory Emulation in RAM In the H8/3022F, flash memory programming can be emulated in real time by overlapping the flash memory with part of RAM (overlap RAM). When the emulation block set in RAMER is accessed while the emulation function is being executed, data written in the overlap RAM is read. Emulation should be performed in user mode or user program mode.
  • Page 450: Differences Between Boot Mode And User Program Mode

    Flash memory Programming data Overlap RAM Application program (programming data) Programming control program execution state Figure 15-4 Writing Overlap RAM Data in User Program Mode 15.2.5 Differences between Boot Mode and User Program Mode Boot Mode User Program Mode Total erase Block erase Programming control program* Boot program is initiated,...
  • Page 451: Block Configuration

    15.2.6 Block Configuration The flash memory is divided into three 64 kbytes blocks, one 32 kbytes block, and eight 4 kbytes blocks. Erasing can be carried out using these block units. Address H'00000 4 kbytes × 8 32 kbytes 64 kbytes 256 kbytes 64 kbytes 64 kbytes...
  • Page 452: Register Configuration

    15.4 Register Configuration The registers * used to control the on-chip flash memory when enabled are shown in table 15-2. Table 15-2 Register Configuration Address * Register Name Abbreviation Initial Value FLMCR1 * H'00 * Flash memory control register 1 H'FF40 FLMCR2 * Flash memory control register 2...
  • Page 453 2. Transitions are made to program mode, erase mode, program-verify mode, and erase- verify mode according to the settings in this register. When reading flash memory as normal on-chip ROM, bits 6 to 0 in this register must be cleared. Bit: Initial value: —*...
  • Page 454 Bit 4—Program Setup Bit (PSU): Prepares for a transition to program mode. Do not set the SWE, ESU, EV, PV, E, or P bit at the same time. Bit 4 Description Program setup cleared (Initial value) Program setup [Setting condition] When FWE = 1 and SWE = 1 Bit 3—Erase-Verify (EV): Selects erase-verify mode transition or clearing.
  • Page 455: Flash Memory Control Register 2 (flmcr2)

    Bit 0—Program (P): Selects program mode transition or clearing. Do not set the SWE, PSU, ESU, EV, PV, or E bit at the same time. Bit 0 Description Program mode cleared (Initial value) Transition to program mode* [Setting condition] When FWE = 1, SWE = 1, and PSU = 1 Note: * Do not access flash memory while the P bit is set to 1.
  • Page 456: Erase Block Register 1 (ebr1)

    Bit 7 FLER Description Flash memory is operating normally (Initial value) Flash memory program/erase protection (error protection) is disabled [Clearing condition] RES pin reset, WDT reset, or hardware standby mode An error has occurred during flash memory programming/erasing Flash memory program/erase protection (error protection) is enabled [Setting condition] •...
  • Page 457: Erase Block Register 2 (ebr2)

    15.5.4 Erase Block Register 2 (EBR2) EBR2 is an 8-bit register that specifies the flash memory erase area block by block. EBR2 is initialized to H'00 by a power-on reset, in hardware standby mode and software standby mode, when a low level is input to the FWE pin. Bit 0 will be initialized to 0 if bit SWE of FLMCR1 is not set, even though a high level is input to pin FWE.
  • Page 458: Ram Emulation Register (ramer)

    15.5.5 RAM Emulation Register (RAMER) RAMER specifies the area of flash memory to be overlapped with part of RAM when emulating real-time flash memory programming. RAMER initialized to H'F0 by a power-on reset and in hardware standby mode. It is not initialized in software standby mode. RAMER settings should be made in user mode or user program mode.
  • Page 459 Bits 2 to 0—Flash Memory Area Selection: These bits are used together with bit 3 to select the flash memory area to be overlapped with RAM. (See table 15-4.) Table 15-4 Flash Memory Area Divisions Addresses Block Name RAMS RAM2 RAM1 RAM0 H'FFFFE000–H'FFFFEFFF...
  • Page 460: Differences From H8/3039 F-ztat Series

    15.5.6 Differences from H8/3039 F-ZTAT Series Table 15-5 Comparison of H8/3039F and H8/3022F H8/3039F H8/3022F Size 128 kbytes 256 kbytes Program/erase voltage Supplied from V Supplied from V Programming Programming 32-byte simultaneous 128-byte simultaneous unit programming programming 150 µs × 4 + 500 µs × 399 30 µs ×...
  • Page 461: On-board Programming Modes

    H8/3039F H8/3022F PROM mode Use of PROM programmer Use of PROM programmer supporting Hitachi micro- supporting Hitachi micro- computer device type with 128 computer device type with 256 kbytes on-chip flash memory kbytes on-chip flash memory (FZTAT128) (FZTAT256) Notes: 1. See section 15.7, Programming/Erasing Flash Memory, for details of the H8/3022F program/erase algorithms.
  • Page 462: Boot Mode

    15.6.1 Boot Mode When boot mode is used, the flash memory programming control program must be prepared in the host beforehand. The SCI channel to be used is set to asynchronous mode. When a reset-start is executed after the LSI’s pins have been set to boot mode, the boot program built into the LSI is started and the programming control program prepared in the host is serially transmitted to the LSI via the SCI.
  • Page 463 Start Set pins to boot program mode and execute reset-start Host transfers data (H'00) continuously at prescribed bit rate H8/3022F measures low period of H'00 data transmitted by host H8/3022F calculates bit rate and sets value in bit rate register After bit rate adjustment, H8/3022F transmits one H'00 data byte to host to indicate end of adjustment Host confirms normal reception of bit rate adjustment...
  • Page 464 Notes: 1. Use a host bit rate setting of 4800, 9600, or 19200 bps only. No other setting should be used. 2. Although the H8/3022 may also perform automatic bit rate adjustment with bit rate and system clock combinations other than those shown in table 15.7, a degree of error will arise between the bit rates of the host and the H8/3022, and subsequent transfer will not be performed normally.
  • Page 465 Figure 15-8 RAM Areas in Boot Mode (Mode 6) Notes on Use of Boot Mode 1. When the H8/3022 comes out of reset in boot mode, it measures the low period of the input at the SCI’s RXD pin. The reset should end with RXD high.
  • Page 466 3. See section 4.2.2, Reset Sequence, and section 15.11, Flash Memory Programming and Erasing Precautions. The reset period during operation is a minimum of 10 system clock cycles for the H8/3022, H8/3021, and H8/3020 mask ROM versions, but a minimum of 20 system clock cycles for the H8/3022 flash memory version.
  • Page 467 15.6.2 User Program Mode When set to the user program mode, this LSI can erase and program its flash memory by executing a user program. Therefore, on-chip flash memory on-board programming can be performed by providing a means of controlling FWE and supplying the write data on the board and providing a write program in a part of the program area.
  • Page 468: User Program Mode

    <Procedure> The user writes a program that executes steps 3 to 8 in advance to MD = 101, 110, 111 as shown below . Sets the mode pin to an on-chip ROM enable mode (mode 5, 6, or 7). Reset start Starts the CPU via reset.
  • Page 469: Programming/erasing Flash Memory

    15.7 Programming/Erasing Flash Memory A software method, using the CPU, is employed to program and erase flash memory in the on- board programming modes. There are four flash memory operating modes: program mode, erase mode, program-verify mode, and erase-verify mode. Transitions to these modes are made by setting the PSU, ESU, P, E, PV, and EV bits in FLMCR1.
  • Page 470: Program Mode

    E = 1 Erase setup Erase mode state E = 0 ESU = 1 Normal mode ESU = 0 FWE = 1 FWE = 0 Erase-verify EV = 1 mode On-board SWE = 1 Software EV = 0 programming mode programming Software programming enable...
  • Page 471: Program-verify Mode

    Next, the watchdog timer is set to prevent overprogramming in the event of program runaway, etc. ) µs. After this, preparation for Set a WDT overflow period greater than (t spsu cpsu program mode (program setup) is carried out by setting the PSU bit in FLMCR1, and after the ) µs or more, the operating mode is switched to program mode by setting the P bit in elapse of (t spsu...
  • Page 472 128-byte data transfer is necessary even when writing fewer than 128 bytes of data. H'FF data must be written to the extra addresses. 3. Verify data is read in word units. 4. The write pulse is applied and a flash memory write executed while the P bit in FLMCR1 is set.
  • Page 473 Table 15-8 Wait Time after P Bit Setting Item Symbol Symbol Wait time after P bit setting When reprogramming loop count (n) sp30 is 1 to 6 When reprogramming loop count (n) sp200 is 7 or more In case of additional programming sp10 processing* Note: * Additional programming processing is necessary only when the reprogramming loop count...
  • Page 474 Table 15-10 Additional-Programming Data Computation Table Result of Verify-Read after Write Pulse Result of (X') Application (V) Operation Comments Programming by write pulse application judged to be completed: additional programming processing to be executed Programming by write pulse application incomplete: additional programming processing not to be executed Programming already completed: additional programming processing not to be executed...
  • Page 475 Write pulse application subroutine Start of programming Programming must be executed Write Pulse subroutine Start in the erased state. Do not Enable WDT perform additional programming Set SWE bit in FLMCR1 on addresses that have already ) µs Set PSU bit in FLMCR1 Wait (t sswe been programmed.
  • Page 476: Erase Mode

    15.7.4 Erase Mode To erase an individual flash memory block, follow the erase/erase-verify flowchart (single-block erase) shown in figure 15.12. To perform data or program erasure, make a 1-bit setting for the flash memory area to be erased in ) µs after setting the SWE bit to 1 in flash erase block register 1 or 2 (EBR1, EBR2) at least (t sswe memory control register 1 (FLMCR1).
  • Page 477 Start Erasing must be performed in block units. Set SWE bit in FLMCR1 ) µs Wait (t sswe n = 1 Set EBR1 or EBR2 Enable WDT Set ESU bit in FLMCR1 ) µs Wait (t sesu Start erase Set E bit in FLMCR1 Wait (t ) ms Clear E bit in FLMCR1...
  • Page 478: Protection

    15.8 Protection There are three kinds of flash memory program/erase protection: hardware protection, software protection, and error protection. 15.8.1 Hardware Protection Hardware protection refers to a state in which programming/erasing of flash memory is forcibly disabled or aborted. Hardware protection is reset by settings in flash memory control register 1 (FLMCR1), erase block register 1 (EBR1), and erase block register 2 (EBR2).
  • Page 479: Software Protection

    Notes: 1. Two modes: program-verify and erase-verify. 2. Excluding a RAM area overlapping flash memory. 3. All blocks are unerasable and block-by-block specification is not possible. 4. For details see section 15.11, Notes on Flash Memory Programming and Erasing. 5. See section 4.2.2, Reset Sequence, and section 15.11, Notes on Flash Memory Programming and Erasing.
  • Page 480: Error Protection

    15.8.3 Error Protection In error protection, an error is detected when H8/3022 Series runaway occurs during flash memory programming/erasing* , or operation is not performed in accordance with the program/erase algorithm, and the program/erase operation is aborted. Aborting the program/erase operation prevents damage to the flash memory due to overprogramming or overerasing.
  • Page 481 Figure 15-13 shows the flash memory state transition diagram. Memory read verify mode RD VF PR ER FLER= 0 P= 1 or E= 1 P= 0 E= 0 Reset or standby Program mode (hardware protection) Erase mode Reset or hardware standby RD VF PR ER INIT FLER= 0 RD VF PR ER FLER= 0 Error...
  • Page 482: Nmi Input Disable Conditions

    programming or erroneous erasing state at the point of transition to this protection mode, or where programming or erasing is not properly carried out because of an abort. In cases such as these, a forced recovery (program rewrite) must be executed using boot mode. However, it may also happen that boot mode cannot be normally initiated because of overprogramming or overerasing.
  • Page 483: Flash Memory Emulation In Ram

    15.9 Flash Memory Emulation in RAM Making a setting in the RAM emulation register (RAMER) enables part of RAM to be overlapped onto the flash memory area so that data to be written to flash memory can be emulated in RAM in real time.
  • Page 484 This area can be accessed from both the RAM area and flash memory area H'00000 H'01000 H'02000 H'03000 H'04000 H'05000 H'06000 H'07000 H'08000 H'FDF10 H'FE000 H'FEFFF Flash memory EB8 to EB11 On-chip RAM H'FFF0F H'3FFFF Figure 15-15 Example of RAM Overlap Operation Example in which Flash Memory Block Area EB0 is Overlapped 1.
  • Page 485: Flash Memory Prom Mode

    The H8/3022F has a PROM mode as well as the on-board programming modes for programming and erasing flash memory. In PROM mode, the on-chip ROM can be freely programmed using a general-purpose PROM programmer that supports the Hitachi microcomputer device type with 256-kbyte on-chip flash memory (FZTAT256).
  • Page 486: Notes On Use Of Prom Mode

    3. The memory is initially in the erased state when the device is shipped by Hitachi. For samples for which the erasure history is unknown, it is recommended that erasing be executed to check and correct the initialization (erase) level.
  • Page 487: Notes On Flash Memory Programming/erasing

    1. Program/erase with the specified voltage and timing. Applied voltages in excess of the rating can permanently damage the device. Use a PROM programmer that supports Hitachi microcomputer device type F-ZTAT256V3 with 256-kbyte on-chip flash memory. Do not set the PROM programmer at the HN28F101. If the PROM programmer is set to the HN28F101 by mistake, a high level can be input to the FWE pin and the LSI can be destroyed.
  • Page 488 setup time (t ) relative to the reset clear timing. The mode programming setup time is necessary for RES reset timing even in transition from the boot mode to another mode. In reset during operation, the RES pin must be held at a low level for at least 20 system clocks.
  • Page 489 8. Do not perform additional programming. Reprogram flash memory after erasing. With on-board programming, program to 128-byte programming unit blocks one time only. Program to 128-byte programming unit blocks one time only even in the PROM mode. Erase all the programming unit blocks before reprogramming. 9.
  • Page 490 Programming Wait time: and erase Wait time: possible φ Min. 0 µs OSC1 Min. 0 µs Min. 200 ns to MD clear SWE bit Flash memory access disabled period (x: Wait time after SWE setting, y: Wait time after SWE clearing) Flash memory reprogrammable period (Flash memory program execution and data read, other than verify, are disabled.) Notes: 1.
  • Page 491 Programming Wait time: and erase Wait time: possible φ Min. 0 µs OSC1 to MD clear SWE bit Flash memory access disabled period (x: Wait time after SWE setting, y: Wait time after SWE clearing) Flash memory reprogrammable period (Flash memory program execution and data read, other than verify, are disabled.) Notes: 1.
  • Page 492 φ OSC1 Min 0 µs to MD RESW SWE set SWE clear SWE bit Mode switching Boot mode Mode User User program mode User User switching mode mode program mode Flash memory access disabled time (x: Wait time after SWE setting, y: Wait time after SWE clearing) Flash memory reprogammable period (Flash memory program execution and data read, other than verify, are disabled.) Notes: 1.
  • Page 493: Overview Of Mask Rom

    Figure 15-20 shows a block diagram of the ROM. Internal data bus (upper 8 bits) Internal data bus (lower 8 bits) H'00000 H'00001 H'00002 H'00003 On-chip ROM H'3FFFE H'3FFFF Even addresses Odd addresses Figure 15-20 Block Diagram of ROM (H8/3022)
  • Page 494: Notes On Ordering Mask Rom Version Chips

    15.13 Notes on Ordering Mask ROM Version Chips When ordering chips with mask ROM, note the following. 1. When ordering through an EPROM, use a 512-kbyte one. 2. Fill all unused addresses with H'FF as shown in figure 15-21 to make the ROM data size the same as for the 512-kbyte version.
  • Page 495: Notes When Converting The F-ztat Application Software To The Mask-rom Versions

    15.14 Notes when Converting the F-ZTAT Application Software to the Mask-ROM Versions Please note the following when converting the F-ZTAT application software to the mask-ROM versions. The values read from the internal registers for the flash ROM or the mask-ROM version and F-ZTAT version differ as follows.
  • Page 496: Section 16 Clock Pulse Generator

    Section 16 Clock Pulse Generator 16.1 Overview This LSI has a built-in clock pulse generator (CPG) that generates the system clock (ø) and other internal clock signals (ø/2 to ø/4096). After duty adjustment, a frequency divider divides the clock frequency to generate the system clock (ø). The system clock is output at the ø pin* and furnished as a master clock to prescalers that supply clock signals to the on-chip supporting modules.
  • Page 497: Block Diagram

    16.1.1 Block Diagram Figure 16-1 shows a block diagram of the clock pulse generator. XTAL Duty Frequency adjustment Oscillator Prescalers divider circuit EXTAL Division control register ø ø/2 to ø/4096 Data bus Figure 16-1 Block Diagram of Clock Pulse Generator...
  • Page 498: Oscillator Circuit

    16.2 Oscillator Circuit Clock pulses can be supplied by connecting a crystal resonator, or by input of an external clock signal. 16.2.1 Connecting a Crystal Resonator Circuit Configuration: A crystal resonator can be connected as in the example in figure 16-2. The damping resistance Rd should be selected according to table 16-1.
  • Page 499 Table 16-2 Crystal Resonator Parameters (Preliminary) Frequency (MHz) Rs max (Ω) (pF) 7 pF max Use a crystal resonator with a frequency equal to the system clock frequency (ø). Notes on Board Design: When a crystal resonator is connected, the following points should be noted: Other signal lines should be routed away from the oscillator circuit to prevent induction from interfering with correct oscillation.
  • Page 500: External Clock Input

    16.2.2 External Clock Input Circuit Configuration: An external clock signal can be input as shown in the examples in figure 16-5. In example b, the clock should be held high in standby mode. If the XTAL pin is left open, the stray capacitance should not exceed 10 pF. EXTAL External clock input XTAL...
  • Page 501 External Clock: The external clock frequency should be equal to the system clock frequency (ø). Table 16-3 and figure 16-6 indicate the clock timing. Table 16-3 Clock Timing 3.0 V to 3.6 V Item Symbol Unit Test Conditions External clock rise time —...
  • Page 502 Table 16-4 and Figure 16-7 show the timing for the external clock output stabilization delay time. The oscillator and duty correction circuit have the function of regulating the waveform of the external clock input to the EXTAL pin. When the specified clock signal is input to the EXTAL pin, internal clock signal output is confirmed after the elapse of the external clock output stabilization delay time (t ).
  • Page 503: Duty Adjustment Circuit

    16.3 Duty Adjustment Circuit When the oscillator frequency is 5 MHz or higher, the duty adjustment circuit adjusts the duty cycle of the clock signal from the oscillator to generate the system clock (ø). 16.4 Prescalers The prescalers divide the system clock (ø) to generate internal clocks (ø/2 to ø/4096). 16.5 Frequency Divider The frequency divider divides the duty-adjusted clock signal to generate the system clock (ø).
  • Page 504: Division Control Register (divcr)

    16.5.2 Division Control Register (DIVCR) DIVCR is an 8-bit readable/writable register that selects the division ratio of the frequency divider. — — — — — — DIV1 DIV0 Initial value Read/Write — — — — — — Reserved bits Divide bits 1 and 0 These bits select the frequency division ratio DIVCR is initialized to H'FC by a reset and in hardware standby mode.
  • Page 505: Section 17 Power-down State

    Section 17 Power-Down State 17.1 Overview This LSI has a power-down state that greatly reduces power consumption by halting CPU functions, and a module standby function that reduces power consumption by selectively halting on-chip modules. The power-down state includes the following three modes: •...
  • Page 507: Register Configuration

    17.2 Register Configuration This LSI has a system control register (SYSCR) that controls the power-down state, and a module standby control register (MSTCR) that controls the module standby function. Table 17-2 summarizes this register. Table 17-2 Register Configuration Address* Name Abbreviation Initial Value H'FFF2...
  • Page 508 Bit 7—Software Standby (SSBY): Enables transition to software standby mode. When software standby mode is exited by an external interrupt, this bit remains set to 1 after the return to normal operation. To clear this bit, write 0. Bit 7 SSBY Description SLEEP instruction causes transition to sleep mode...
  • Page 509: Module Standby Control Register (mstcr)

    17.2.2 Module Standby Control Register (MSTCR) MSTCR is an 8-bit readable/writable register that controls output of the system clock (ø). It also controls the module standby function, which places individual on-chip supporting modules in the standby state. Module standby can be designated for the ITU, SCI0, SCI1, and A/D converter modules.
  • Page 510 Bit 4—Module Standby 4 (MSTOP4): Selects whether to place SCI0 in standby. Bit 4 MSTOP4 Description SCI0 operates normally (Initial value) SCI0 is in standby state Bit 3—Module Standby 3 (MSTOP3): Selects whether to place SCI1 in standby. Bit 3 MSTOP3 Description SCI1 operates normally...
  • Page 511: Sleep Mode

    17.3 Sleep Mode 17.3.1 Transition to Sleep Mode When the SSBY bit is cleared to 0 in the system control register (SYSCR), execution of the SLEEP instruction causes a transition from the program execution state to sleep mode. Immediately after executing the SLEEP instruction the CPU halts, but the contents of its internal registers are retained.
  • Page 512: Software Standby Mode

    17.4 Software Standby Mode 17.4.1 Transition to Software Standby Mode To enter software standby mode, execute the SLEEP instruction while the SSBY bit is set to 1 in SYSCR. In software standby mode, current dissipation is reduced to an extremely low level because the CPU, clock, and on-chip supporting modules all halt.
  • Page 513: Selection Of Oscillator Waiting Time After Exit From Software Standby Mode

    17.4.3 Selection of Oscillator Waiting Time after Exit from Software Standby Mode Bits STS2 to STS0 in SYSCR, and its DIV1 and DIV0 in DIVCR should be set as follows. Crystal Resonator: Set STS2 to STS0, and DIV1 and DIV0 so that the waiting time (for the clock to stabilize) is at least 7 ms.
  • Page 514: Sample Application Of Software Standby Mode

    17.4.4 Sample Application of Software Standby Mode Figure 17-1 shows an example in which software standby mode is entered at the fall of NMI and exited at the rise of NMI. With the NMI edge select bit (NMIEG) cleared to 0 in SYSCR (selecting the falling edge), an NMI interrupt occurs.
  • Page 515: Transition To Hardware Standby Mode

    17.5 Hardware Standby Mode 17.5.1 Transition to Hardware Standby Mode Regardless of its current state, the chip enters hardware standby mode whenever the STBY pin goes low. Hardware standby mode reduces power consumption drastically by halting all functions of the CPU and on-chip supporting modules. All modules are reset except the on-chip RAM. As long as the specified voltage is supplied, on-chip RAM data is retained.
  • Page 516: Module Standby Function

    17.6 Module Standby Function 17.6.1 Module Standby Timing The module standby function can halt several of the on-chip supporting modules (the ITU, SCI0, SCI1, and A/D converter) independently of the power-down state. This standby function is controlled by bits MSTOP5 to MSTOP3 and MSTOP0 in MSTCR. When one of these bits is set to 1, the corresponding on-chip supporting module is placed in standby and halts at the beginning of the next bus cycle after the MSTCR write cycle.
  • Page 517: System Clock Output Disabling Function

    17.7 System Clock Output Disabling Function Output of the system clock (ø) can be controlled by the PSTOP bit in MSTCR. When the PSTOP bit is set to 1, output of the system clock halts and the ø pin is placed in the high-impedance state. Figure 17-3 shows the timing of the stopping and starting of system clock output.
  • Page 518: Section 18 Electrical Characteristics

    Section 18 Electrical Characteristics 18.1 Electrical characteristics of Masked ROM Version 18.1.1 Absolute Maximum Ratings Table 18-1 lists the absolute maximum ratings. Table 18-1 Absolute Maximum Ratings Item Symbol Value Unit Power supply voltage –0.3 to +4.3 Input voltage (except port 7) –0.3 to V +0.3 Input voltage (port 7)
  • Page 519: Dc Characteristics

    18.1.2 DC Characteristics Table 18-2 lists the DC characteristics. Table 18-3 lists the permissible output currents. Table 18-2 DC Characteristics Conditions: = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V,V = AV = 0 V* = –20°C to +75°C Test Item Symbol...
  • Page 520 Test Item Symbol Uni t Conditions µA STBY, NMI, Input leakage — — = 0.5 to RES, MD current – 0.5 V , MD µA Port 7 — — = 0.5 to – 0.5 V µA Three-state Ports 1, 2, 3, 5, —...
  • Page 521 Table 18-3 Permissible Output Currents Conditions: = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V, V = AV = 0 V, = –20°C to +75°C Item Symbol Unit Permissible output Ports 1, 2, 5 and B —...
  • Page 522 2 kΩ Port Darlington pair Figure 18-1 Darlington Pair Drive Circuit (Example) Ports 600Ω Figure 18-2 LED Drive Circuit (Example)
  • Page 523: Ac Characteristics

    18.1.3 AC Characteristics Bus timing parameters are listed in table 18-4. Control signal timing parameters are listed in table 18-5. Timing parameters of the on-chip supporting modules are listed in table 18-6. Table 18-4 Bus Timing Conditions: = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V, V = AV = 0 V,...
  • Page 524 Item Symbol Unit Test Conditions Write data delay time — Figure 18-7, Write data setup time 1 — Figure 18-8 WDS1 Write data setup time 2 –10 — WDS2 Write data hold time — Read data access time 1 — ACC1 Read data access time 2 —...
  • Page 525 OSC2 in software standby (crystal) Note: * The reset time during operation is a minimum of 10 system clock cycles in the H8/3022, H8/3021, and H8/3020 mask ROM versions, but the H8/3022 flash memory version requires a minimum of 20 system clock cycles.
  • Page 526 Table 18-6 Timing of On-Chip Supporting Modules Conditions: = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V, V = AV = 0 V, ø = 2 MHz to 18 MHz, T = –20°C to +75°C Test Item Symbol Unit...
  • Page 527 C = 90 pF: ports 1, 2, 3, 5, 6, 8, ø C = 30 pF: ports 9, A, B This LSI output pin Ω R = 2.4 k Ω R = 12 k Input/output timing measurement levels • Low: 0.8 V •...
  • Page 528: A/d Conversion Characteristics

    18.1.4 A/D Conversion Characteristics Table 18-7 lists the A/D conversion characteristics. Table 18-7 A/D Converter Characteristics Conditions: = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V, V = AV = 0 V, ø = 2 MHz to 18 MHz, T = –20°C to +75°C Item Unit...
  • Page 529: Electrical Characteristics Of Flash Memory Version

    18.2 Electrical characteristics of Flash Memory Version 18.2.1 Absolute Maximum Ratings Table 18-8 lists the absolute maximum ratings. Table 18-8 Absolute Maximum Ratings Item Symbol Value Unit Power supply voltage –0.3 to + 4.3 Input voltage (except port 7) –0.3 to V +0.3 Input voltage (port 7) –0.3 to AV...
  • Page 530: Dc Characteristics

    18.2.2 DC Characteristics Table 18-9 lists the DC characteristics. Table 18-10 lists the permissible output currents. Table 18-9 DC Characteristics (1) Conditions: = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V, V = AV = 0 V* = –20°C to +75°C (Programming/Erasing Conditions: T = 0°C to +75°C)
  • Page 531 Test Item Symbol Uni t Conditions µA Three-state Ports 1, 2, 3, — — = 0.5 V to leakage current 5, 6, 8 to B – 0.5 V (off state) µA Input pull-up Ports 2 and 5 –I — = 0 V MOS current NMI, RES Input...
  • Page 532 Table 18-10 Permissible Output Currents Conditions: = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V, V = AV = 0 V, = –20°C to +75°C Item Symbol Unit Permissible output low Ports 1, 2, 5 and B —...
  • Page 533 2 kΩ Port Darlington pair Figure 18-4 Darlington Pair Drive Circuit (Example) Ports 600Ω Figure 18-5 LED Drive Circuit (Example)
  • Page 534: Ac Characteristics

    18.2.3 AC Characteristics Bus timing parameters are listed in table 18-11. Control signal timing parameters are listed in table 18-12. Timing parameters of the on-chip supporting modules are listed in table 18-13. Table 18-11 Bus Timing Conditions: V = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V, V = AV = 0 V,...
  • Page 535 Item Symbol Unit Test Conditions Write data delay time — Figure 18-7, Write data setup time 1 — Figure 18-8 WDS1 Write data setup time 2 –10 — WDS2 Write data hold time — Read data access time 1 — ACC1 Read data access time 2 —...
  • Page 536 Table 18-12 Control Signal Timing Condition A: V = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V, V = AV = 0 V, ø = 2 to 18 MHz, = –20°C to +75°C Item Symbol Min Unit Test Conditions RES setup time...
  • Page 537 Table 18-13 Timing of On-Chip Supporting Modules Conditions: V = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V, V = AV = 0 V, ø = 2 to 18 MHz, = –20°C to +75°C Test Item Symbol Unit Conditions...
  • Page 538 C = 90 pF: ports 1, 2, 3, 5, 6, 8, ø This LSI C = 30 pF: ports 9, A, B output pin Ω R = 2.4 k Ω R = 12 k Input/output timing measurement levels • Low: 0.8 V •...
  • Page 539: A/d Conversion Characteristics

    18.2.4 A/D Conversion Characteristics Table 18-14 lists the A/D conversion characteristics. Table 18-14 A/D Converter Characteristics Conditions: V = 3.0 V to 3.6 V, AV = 3.6 V to 5.5 V, V = AV = 0 V, ø = 2 to 18 MHz, = –20°C to +75°C Item Unit...
  • Page 540: Flash Memory Characteristics

    18.2.5 Flash Memory Characteristics Table 18-15 shows the flash memory characteristics. Table 18-15 Flash Memory Characteristics Conditions: =3.0 V to 3.6 V, AV =3.6 V to 5.5 V, V = 0°C to +75°C (program/erase operating temperature range) Item Symbol Unit Comments Programming time* —...
  • Page 541: Operational Timing

    Notes: 1. Set the times according to the program/erase algorithms. 2. Programming time per 128 bytes (Shows the total time the P bit in the flash memory control register 1 (FLMCR1) is set. It does not include the programming verification time.) 3.
  • Page 542 ø to A ACC3 ACC3 (read) ACC1 to D (read) WR (write) WSW1 WDS1 to D (write) Figure 18-7 Basic Bus Cycle: Two-State Access...
  • Page 543 ø to A ACC4 ACC4 RD (read) ACC2 to D (read) WSW2 WR (write) WDS2 to D (write) Figure 18-8 Basic Bus Cycle: Three-State Access...
  • Page 544 ø to A RD (read) to D (read) WR (write) to D (write) WAIT Figure 18-9 Basic Bus Cycle: Three-State Access with One Wait State...
  • Page 545: Control Signal Timing

    18.3.2 Control Signal Timing Control signal timing is shown as follows: • Reset input timing Figure 18-10 shows the reset input timing. • Reset output timing Figure 18-11 shows the reset output timing. • Interrupt input timing Figure 18-12 shows the interrupt input timing for NMI and IRQ , IRQ , IRQ , and IRQ...
  • Page 546 ø NMIS NMIH NMIS NMIH NMIS IRQ : Edge-sensitive IRQ : Level-sensitive IRQ (i = 0, 1, 4, and 5) NMIW (j = 0, 1) Figure 18-12 Interrupt Input Timing...
  • Page 547: Clock Timing

    18.3.3 Clock Timing Clock timing is shown below. • Oscillator settling timing Figure 18-13 shows the oscillator settling timing. ø STBY OSC1 OSC1 Figure 18-13 Oscillator Settling Timing 18.3.4 TPC and I/O Port Timing TPC and I/O port timing is shown below. ø...
  • Page 548: Itu Timing

    18.3.5 ITU Timing ITU timing is shown as follows: • ITU input/output timing Figure 18-15 shows the ITU input/output timing. • ITU external clock input timing Figure 18-16 shows the ITU external clock input timing. ø TOCD Output compare TICS Input capture Notes: 1.
  • Page 549: Sci Input/output Timing

    18.3.6 SCI Input/Output Timing SCI timing is shown as follows: • SCI input clock timing Figure 18-17 shows the SCI input clock timing. • SCI input/output timing (synchronous mode) Figure 18-18 shows the SCI input/output timing in synchronous mode. SCKr SCKf SCKW Scyc...
  • Page 550: Appendix A Instruction Set

    Appendix A Instruction Set A.1 Instruction List Operand Notation Symbol Description General destination register* General source register* General register* General destination register (address register or 32-bit register) General source register (address register or 32-bit register) General register (32-bit register) (EAd) Destination operand (EAs) Source operand...
  • Page 551 Condition Code Notation Symbol Description Changed according to execution result Undetermined (no guaranteed value) Cleared to 0 Set to 1 — Not affected by execution of the instruction ∆ Varies depending on conditions, described in notes...
  • Page 552: Data Transfer Instructions

    Table A-1 Instruction Set Data transfer instructions Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z #xx:8 → Rd8 MOV.B #xx:8, Rd — — 0 — Rs8 → Rd8 MOV.B Rs, Rd — — 0 —...
  • Page 553 Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z W @aa:24 → Rd16 MOV.W @aa:24, Rd — — 0 — W Rs16 → @ERd MOV.W Rs, @ERd — — 0 — W Rs16 → @(d:16, ERd) MOV.W Rs, @(d:16, —...
  • Page 554: Arithmetic Instructions

    PUSH.L ERn 4 — — 0 — ERn32 → @SP MOVFPE @aa:16, Cannot be used in the Cannot be used in the H8/3022 H8/3039 Series Series MOVTPE Rs, Cannot be used in the Cannot be used in the H8/3022 @aa:16...
  • Page 555 Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z ERd32+1 → ERd32 INC.L #1, ERd — — — ERd32+2 → ERd32 INC.L #2, ERd — — — DAA Rd Rd8 decimal adjust — * * —...
  • Page 556 Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z W ERd32 ÷ Rs16 →ERd32 DIVXU. W Rs, ERd — — (6) (7) — — (Ed: remainder, Rd: quotient) (unsigned division) Rd16 ÷ Rs8 → Rd16 DIVXS.
  • Page 557 Logic instructions Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z Rd8∧#xx:8 → Rd8 AND.B #xx:8, Rd — — 0 — Rd8∧Rs8 → Rd8 AND.B Rs, Rd — — 0 — W Rd16∧#xx:16 → Rd16 AND.W #xx:16, Rd —...
  • Page 558 Shift instructions Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z SHAL.B Rd — — SHAL.W Rd — — SHAL.L ERd — — SHAR.B Rd — — SHAR.W Rd — — SHAR.L ERd —...
  • Page 559: Bit Manipulation Instructions

    Bit manipulation instructions Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z (#xx:3 of Rd8) ← 1 BSET #xx:3, Rd — — — — — — (#xx:3 of @ERd) ← 1 BSET #xx:3, @ERd —...
  • Page 560 Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z (#xx:3 of @ERd) → C BLD #xx:3, @ERd — — — — — (#xx:3 of @aa:8) → C BLD #xx:3, @aa:8 — — — — — ¬...
  • Page 561 Branching instructions Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z BRA d:8 (BT d:8) — Always — — — — — — If condition is true then BRA d:16 (BT d:16) — —...
  • Page 562 Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z Z ∨ (N ⊕ V) BLE d:8 — — — — — — — If condition is true then BLE d:16 — — — — — — — PC ←...
  • Page 563 System control instructions Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z — PC → @–SP TRAPA #x:2 1 — — — — — CCR → @–SP <vector> → PC — CCR ← @SP+ PC ←...
  • Page 564 Block transfer instructions Addressing Mode and No. of Instruction Length (bytes) States Condition Code Mnemonic Operation H N Z — if R4L ≠ 0 then 8+4n *2 EEPMOV. B 4 — — — — — — repeat @R5 → @R6 R5+1 →...
  • Page 568: Number Of States Required For Execution

    A.3 Number of States Required for Execution The tables in this section can be used to calculate the number of states required for instruction execution by the H8/300H CPU. Table A-3 indicates the number of states required per cycle according to the bus size. Table A-4 indicates the number of instruction fetch, data read/write, and other cycles occurring in each instruction.
  • Page 569 Table A-3 Number of States per Cycle Access Conditions External Device On-Chip Sup- porting Module 8-Bit Bus 16-Bit Bus On-Chip 8-Bit 16-Bit 2-State 3-State 2-State 3-State Cycle Memory Access Access Access Access Instruction fetch 6 + 2m 2 3 + m Branch address read Stack operation Byte data access...
  • Page 570 Table A-4 Number of Cycles per Instruction Instruction Branch Stack Byte Data Word Data Internal Fetch Addr. Read Operation Access Access Operation Instruction Mnemonic ADD.B #xx:8, Rd ADD.B Rs, Rd ADD.W #xx:16, Rd ADD.W Rs, Rd ADD.L #xx:32, ERd ADD.L ERs, ERd ADDS ADDS #1/2/4, ERd ADDX...
  • Page 571 Instruction Branch Stack Byte Data Word Data Internal Fetch Addr. Read Operation Access Access Operation Instruction Mnemonic BRA d:16 (BT d:16) BRN d:16 (BF d:16) BHI d:16 BLS d:16 BCC d:16 (BHS d:16) BCS d:16 (BLO d:16) BNE d:16 BEQ d:16 BVC d:16 BVS d:16 BPL d:16...
  • Page 572 Instruction Branch Stack Byte Data Word Data Internal Fetch Addr. Read Operation Access Access Operation Instruction Mnemonic BLD #xx:3, Rd BLD #xx:3, @ERd BLD #xx:3, @aa:8 BNOT BNOT #xx:3, Rd BNOT #xx:3, @ERd BNOT #xx:3, @aa:8 BNOT Rn, Rd BNOT Rn, @ERd BNOT Rn, @aa:8 BOR #xx:3, Rd BOR #xx:3, @ERd...
  • Page 573 Instruction Branch Stack Byte Data Word Data Internal Fetch Addr. Read Operation Access Access Operation Instruction Mnemonic CMP.B #xx:8, Rd CMP.B Rs, Rd CMP.W #xx:16, Rd CMP.W Rs, Rd CMP.L #xx:32, ERd CMP.L ERs, ERd DAA Rd DAS Rd DEC.B Rd DEC.W #1/2, Rd DEC.L #1/2, ERd DIVXS...
  • Page 574 Instruction Branch Stack Byte Data Word Data Internal Fetch Addr. Read Operation Access Access Operation Instruction Mnemonic LDC #xx:8, CCR LDC Rs, CCR LDC @ERs, CCR LDC @(d:16, ERs), CCR LDC @(d:24, ERs), CCR LDC @ERs+, CCR LDC @aa:16, CCR LDC @aa:24, CCR MOV.B #xx:8, Rd MOV.B Rs, Rd...
  • Page 575 Instruction Branch Stack Byte Data Word Data Internal Fetch Addr. Read Operation Access Access Operation Instruction Mnemonic MOV.W Rs, @aa:24 MOV.L #xx:32, ERd MOV.L ERs, ERd MOV.L @ERs, ERd MOV.L @(d:16, ERs), MOV.L @(d:24, ERs), MOV.L @ERs+, ERd MOV.L @aa:16, ERd MOV.L @aa:24, ERd MOV.L ERs, @ERd MOV.L ERs, @(d:16,...
  • Page 576 Instruction Branch Stack B yt e Data W ord Data Internal Fetch Addr. Read Operation A ccess A ccess Operation Instruction Mnemonic ORC #xx:8, CCR POP.W Rn POP.L ERn PUSH PUSH.W Rn PUSH.L ERn ROTL ROTL.B Rd ROTL.W Rd ROTL.L ERd ROTR ROTR.B Rd ROTR.W Rd...
  • Page 577 Instruction Branch Stack B yt e Data W ord Data Internal Fetch Addr. Read Operation A ccess A ccess Operation Instruction Mnemonic STC CCR, Rd STC CCR, @ERd STC CCR, @(d:16, ERd) STC CCR, @(d:24, ERd) STC CCR, @–ERd STC CCR, @aa:16 STC CCR, @aa:24 SUB.B Rs, Rd SUB.W #xx:16, Rd...
  • Page 578: Appendix B Internal I/o Register Field

    Appendix B Internal I/O Register Field B.1 Addresses Bit Names Address Register Data Bus (low) Name Width Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module Name H'1C H'1D H'1E H'1F H'20 —...
  • Page 579 Bit Names Address Register Data Bus (low) Name Width Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module Name H'3B — — — — — — — — — H'3C — — —...
  • Page 580 Bit Names Address Register Data Bus (low) Name Width Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module Name H'60 TSTR — — — STR4 STR3 STR2 STR1 STR0 H'61 TSNC — —...
  • Page 581 Bit Names Address Register Data Bus (low) Name Width Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module Name H'82 TCR3 — CCLR1 CCLR0 CKEG1 CKEG0 TPSC2 TPSC1 TPSC0 ITU channel 3 H'83 TIOR3 —...
  • Page 582 Bit Names Address Register Data Bus (low) Name Width Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module Name H'A0 TPMR — — — — G3NOV G2NOV G1NOV G0NOV TPC H'A1 TPCR G3CMS1 G3CMS0 G2CMS1 G2CMS0 G1CMS1 G1CMS0 G0CMS1 G0CMS0 H'A2 NDERB...
  • Page 583 Bit Names Address Register Data Bus (low) Name Width Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module Name H'B8 STOP CKS1 CKS0 SCI1 H'B9 H'BA MPIE TEIE CKE1 CKE0 H'BB H'BC TDRE RDRF ORER...
  • Page 584 Bit Names Address Register Data Bus (low) Name Width Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module Name H'DB P5PCR — — — — PCR P5 PCR P5 PCR P5 PCR Port 5 H'DC —...
  • Page 585: Function

    B.2 Function Register Register Address to which Name of on-chip acronym name the register is mapped supporting module TSTR Timer Start Register H'60 ITU (all channels) numbers Initial bit — — — STR4 STR3 STR2 STR1 STR0 values Initial value Names of the Read/Write —...
  • Page 586 FLMCR1—Flash Memory Control Register 1 H'40 Flash memory Initial value —* Read/Write Program mode Program mode cleared (Initial value) Transition to program mode [Setting condition] When FWE = 1, SWE = 1, and PSU = 1 Erase mode Erase mode cleared (Initial value) Transition to erase mode [Setting condition] When FWE = 1, SWE = 1, and ESU = 1...
  • Page 587 FLMCR2—Flash Memory Control Register 2 H'41 Flash memory FLER — — — — — — — Initial value Read/Write — — — — — — — Flash memory error Flash memory write/erase protection is disabled (Initial value) An error has occurred during flash memory writing/erasing Flash memory error protection is enabled Note : This register is used only in the flash memory versions.
  • Page 588 EBR2—Erase Block Register 2 H'43 Flash memory — — — — EB11 EB10 Initial value Read/Write Block 7 to 0 Block EB8 to EB11 is not selected (Initial value) Block EB8 to EB11 is selected Note: When not erasing, clear all EBR bits to 0. This register is used only in the flash memory versions.
  • Page 589 RAMER—RAM Emulation Register H'47 Flash Memory — — — — RAMS RAM2 RAM1 RAM0 Initial value RAM select, RAM2, RAM1, RAM0 Bit 3 Bit 2 Bit 1 Bit 0 RAM Area RAMS RAM2 RAM1 RAM0 H'FFFFE000 to H'FFFFEFFF H'00000000 to H'00000FFF H'00001000 to H'00001FFF H'00002000 to H'00002FFF H'00003000 to H'00003FFF...
  • Page 590 DIVCR—Division Control Register H'5D System control — — — — — — DIV1 DIV0 Initial value Read/Write — — — — — — Divide bits 1 and 0 Bit 1 Bit 0 Frequency Division Ratio DIV1 DIV0 1/1initial value...
  • Page 591 MSTCR—Module Standby Control Register H'5E System control PSTOP — MSTOP5 MSTOP4 MSTOP3 — — MSTOP0 Initial value Read/Write — Module standby 0 0 A/D converter operates normally (Initial value) 1 A/D converter is in standby state Module standby 3 0 SCI1 operates normally (Initial value) 1 SCI1 is in standby state Module standby 4 0 SCI0 operates normally (Initial value)
  • Page 592 TSTR—Timer Start Register H'60 ITU (all channels) — — — STR4 STR3 STR2 STR1 STR0 Initial value Read/Write — — — Counter start 0 0 TCNT0 is halted 1 TCNT0 is counting Counter start 1 0 TCNT1 is halted 1 TCNT1 is counting Counter start 2 0 TCNT2 is halted 1 TCNT2 is counting...
  • Page 593 TSNC—Timer Synchro Register H'61 ITU (all channels) — — — SYNC4 SYNC3 SYNC2 SYNC1 SYNC0 Initial value Read/Write — — — Timer sync 0 0 TCNT0 operates independently 1 TCNT0 is synchronized Timer sync 1 0 TCNT1 operates independently 1 TCNT1 is synchronized Timer sync 2 0 TCNT2 operates independently 1 TCNT2 is synchronized...
  • Page 594 TMDR—Timer Mode Register H'62 ITU (all channels) — FDIR PWM4 PWM3 PWM2 PWM1 PWM0 Initial value Read/Write — PWM mode 0 0 Channel 0 operates normally 1 Channel 0 operates in PWM mode PWM mode 1 0 Channel 1 operates normally 1 Channel 1 operates in PWM mode PWM mode 2 0 Channel 2 operates normally...
  • Page 595 TFCR—Timer Function Control Register H'63 ITU (all channels) — — CMD1 CMD0 BFB4 BFA4 BFB3 BFA3 Initial value Read/Write — — Buffer mode A3 0 GRA3 operates normally 1 GRA3 is buffered by BRA3 Buffer mode B3 0 GRB3 operates normally 1 GRB3 is buffered by BRB3 Buffer mode A4 0 GRA4 operates normally...
  • Page 596 TCR0—Timer Control Register 0 H'64 ITU0 — CCLR1 CCLR0 CKEG1 CKEG0 TPSC2 TPSC1 TPSC0 Initial value Read/Write — Timer prescaler 2 to 0 Bit 2 Bit 1 Bit 0 TPSC2 TPSC1 TPSC0 TCNT Clock Source Internal clock: ø Internal clock: ø/2 Internal clock: ø/4 Internal clock: ø/8 External clock A: TCLKA input...
  • Page 597 TIOR0—Timer I/O Control Register 0 H'65 ITU0 — IOB2 IOB1 IOB0 — IOA2 IOA1 IOA0 Initial value Read/Write — — I/O control A2 to A0 Bit 2 Bit 1 Bit 0 IOA2 IOA1 IOA0 GRA Function GRA is an output No output at compare match compare register 0 output at GRA compare match...
  • Page 598 TIER0—Timer Interrupt Enable Register 0 H'66 ITU0 — — — — — OVIE IMIEB IMIEA Initial value Read/Write — — — — — Input capture/compare match interrupt enable A 0 IMIA interrupt requested by IMFA is disabled 1 IMIA interrupt requested by IMFA is enabled Input capture/compare match interrupt enable B 0 IMIB interrupt requested by IMFB is disabled 1 IMIB interrupt requested by IMFB is enabled...
  • Page 599 TSR0—Timer Status Register 0 H'67 ITU0 — — — — — IMFB IMFA Initial value Read/Write — — — — — R/(W) R/(W) R/(W) Input capture/compare match flag A 0 [Clearing condition] Read IMFA when IMFA = 1, then write 0 in IMFA 1 [Setting conditions] TCNT = GRA when GRA functions as a compare match register.
  • Page 600 TCNT0 H/L—Timer Counter 0 H/L H'68, H'69 ITU0 Initial value Read/Write Up-counter GRA0 H/L—General Register A0 H/L H'6A, H'6B ITU0 Initial value Read/Write Output compare or input capture register GRB0 H/L—General Register B0 H/L H'6C, H'6D ITU0 Initial value Read/Write Output compare or input capture register TCR1—Timer Control Register 1 H'6E...
  • Page 601 TIOR1—Timer I/O Control Register 1 H'6F ITU1 — IOB2 IOB1 IOB0 — IOA2 IOA1 IOA0 Initial value Read/Write — — Note: Bit functions are the same as for ITU0. TIER1—Timer Interrupt Enable Register 1 H'70 ITU1 — — — — —...
  • Page 602 GRA1 H/L—General Register A1 H/L H'74, H'75 ITU1 Initial value Read/Write Note: Bit functions are the same as for ITU0. GRB1 H/L—General Register B1 H/L H'76, H'77 ITU1 Initial value Read/Write Note: Bit functions are the same as for ITU0. TCR2—Timer Control Register 2 H'78 ITU2...
  • Page 603 TIOR2—Timer I/O Control Register 2 H'79 ITU2 — IOB2 IOB1 IOB0 — IOA2 IOA1 IOA0 Initial value Read/Write — — Notes: 1. Bit functions are the same as for ITU0. Channel 2 does not have a compare match toggle output function. If this setting is used, 1 output will be selected automatically.
  • Page 604 TIER2—Timer Interrupt Enable Register 2 H'7A ITU2 — — — — — OVIE IMIEB IMIEA Initial value Read/Write — — — — — Note: Bit functions are the same as for ITU0. TSR2—Timer Status Register 2 H'7B ITU2 — — —...
  • Page 605 GRA2 H/L—General Register A2 H/L H'7E, H'7F ITU2 Initial value Read/Write Note: Bit functions are the same as for ITU0. GRB2 H/L—General Register B2 H/L H'80, H'81 ITU2 Initial value Read/Write Note: Bit functions are the same as for ITU0. TCR3—Timer Control Register 3 H'82 ITU3...
  • Page 606 TIER3—Timer Interrupt Enable Register 3 H'84 ITU3 — — — — — OVIE IMIEB IMIEA Initial value Read/Write — — — — — Note: Bit functions are the same as for ITU0. TSR3—Timer Status Register 3 H'85 ITU3 — — —...
  • Page 607 GRA3 H/L—General Register A3 H/L H'88, H'89 ITU3 Initial value Read/Write Output compare or input capture register (can be buffered) GRB3 H/L—General Register B3 H/L H'8A, H'8B ITU3 Initial value Read/Write Output compare or input capture register (can be buffered) BRA3 H/L—Buffer Register A3 H/L H'8C, H'8D ITU3...
  • Page 608 TOER—Timer Output Enable Register H'90 ITU (all channels) — — EXB4 EXA4 Initial value Read/Write — — Master enable TIOCA 0 TIOCA output is disabled regardless of TIOR3, TMDR, and TFCR settings 1 TIOCA is enabled for output according to TIOR3, TMDR, and TFCR settings Master enable TIOCA 0 TIOCA output is disabled regardless of TIOR4, TMDR, and TFCR settings 1 TIOCA is enabled for output according to TIOR4, TMDR, and TFCR settings...
  • Page 609 TOCR—Timer Output Control Register H'91 ITU (all channels) XTGD — — — — — OLS4 OLS3 Initial value Read/Write — — — — — Output level select 3 0 TIOCB , TOCXA , and TOCXB outputs are inverted 1 TIOCB , TOCXA , and TOCXB outputs are not inverted Output level select 4 0 TIOCA , TIOCA , and TIOCB outputs are inverted 1 TIOCA , TIOCA , and TIOCB outputs are not inverted...
  • Page 610 TCR4—Timer Control Register 4 H'92 ITU4 — CCLR1 CCLR0 CKEG1 CKEG0 TPSC2 TPSC1 TPSC0 Initial value Read/Write — Note: Bit functions are the same as for ITU0. TIOR4—Timer I/O Control Register 4 H'93 ITU4 — IOB2 IOB1 IOB0 — IOA2 IOA1 IOA0 Initial value...
  • Page 611 TCNT4 H/L—Timer Counter 4 H/L H'96, H'97 ITU4 Initial value Read/Write Note: Bit functions are the same as for ITU3. GRA4 H/L—General Register A4 H/L H'98, H'99 ITU4 Initial value Read/Write Note: Bit functions are the same as for ITU3. GRB4 H/L—General Register B4 H/L H'9A, H'9B ITU4...
  • Page 612 BRB4 H/L—Buffer Register B4 H/L H'9E, H'9F ITU4 Initial value Read/Write Note: Bit functions are the same as for ITU3. TPMR—TPC Output Mode Register H'A0 — — — — G3NOV G2NOV G1NOV G0NOV Initial value Read/Write — — — — Group 0 non-overlap 0 Normal TPC output in group 0 Output values change at compare match A in the selected ITU channel...
  • Page 613 TPCR—TPC Output Control Register H'A1 G3CMS1 G3CMS0 G2CMS1 G2CMS0 G1CMS1 G1CMS0 G0CMS1 G0CMS0 Initial value Read/Write Group 0 compare match select 1 and 0 Bit 1 Bit 0 G0CMS1 G0CMS0 ITU Channel Selected as Output Trigger TPC output group 0 (TP to TP ) is triggered by compare match in ITU channel 0 TPC output group 0 (TP to TP ) is triggered by compare match in ITU channel 1 TPC output group 0 (TP to TP ) is triggered by compare match in ITU channel 2 TPC output group 0 (TP to TP ) is triggered by compare match in ITU channel 3...
  • Page 614 NDERB—Next Data Enable Register B H'A2 NDER15 NDER14 NDER13 NDER12 NDER11 NDER10 NDER9 NDER8 Initial value Read/Write Next data enable 15 to 8 Bits 7 to 0 NDER15 to NDER8 Description TPC outputs TP to TP * are disabled (NDR15 to NDR8 are not transferred to PB to PB ) TPC outputs TP to TP * are enabled (NDR15 to NDR8 are transferred to PB to PB )
  • Page 615 NDRB—Next Data Register B H'A4/H'A6 • Same output trigger for TPC output groups 2 and 3 Address H'FFA4 NDR15 NDR14 NDR13 NDR12 NDR11 NDR10 NDR9 NDR8 Initial value Read/Write Next output data for Next output data for TPC output group 3* TPC output group 2 Address H'FFA6 —...
  • Page 616 NDRA—Next Data Register A H'A5/H'A7 • Same output trigger for TPC output groups 0 and 1 Address H'FFA5 NDR7 NDR6 NDR5 NDR4 NDR3 NDR2 NDR0 NDR1 Initial value Read/Write Next output data for Next output data for TPC output group 1 TPC output group 0 Address H'FFA7 —...
  • Page 617 TCSR—Timer Control/Status Register H'A8 — — CKS2 CKS1 CKS0 Initial value Read/Write R/(W) — — Timer enable Clock select 2 to 0 TCNT is initialized to H'00 and halted CKS2 CKS1 CKS0 Description ø/2 TCNT is counting ø/32 Timer mode select ø/64 0 Interval timer: requests interval timer interrupts ø/128...
  • Page 618 TCNT—Timer Counter H'A9 (read), H'A8 (write) Initial value Read/Write Count value RSTCSR—Reset Control/Status Register H'AB (read), H'AA (write) WRST RSTOE — — — — — — Initial value Read/Write R/(W) — — — — — — Reset output enable 0 Reset signal is not output externally 1 Reset signal is output externally Watchdog timer reset 0 [Clearing condition]...
  • Page 619 SMR—Serial Mode Register H'B0 SCI0 STOP CKS1 CKS0 Initial value Read/Write Clock select 1 and 0 Bit 1 Bit 0 CKS1 CKS0 Clock Source ø clock Multiprocessor mode ø/4 clock 0 Multiprocessor function disabled ø/16 clock 1 Multiprocessor format selected ø/64 clock Stop bit length 0 One stop bit...
  • Page 620 BRR—Bit Rate Register H'B1 SCI0 Initial value Read/Write Serial communication bit rate setting...
  • Page 621 SCR—Serial Control Register H'B2 SCI0 MPIE TEIE CKE1 CKE0 Initial value Read/Write Clock enable 1 and 0 Bit 1 Bit 2 CKE1 CKE2 Clock Selection and Output Asynchronous mode Internal clock, SCK pin available for generic input/output Synchronous mode Internal clock, SCK pin used for serial clock output Asynchronous mode Internal clock, SCK pin used for clock output Synchronous mode...
  • Page 622 TDR—Transmit Data Register H'B3 SCI0 Initial value Read/Write Serial transmit data...
  • Page 623 SSR—Serial Status Register H'B4 SCI0 TDRE RDRF ORER TEND MPBT Initial value Read/Write R/(W) R/(W) R/(W) R/(W) R/(W) Multiprocessor bit Multiprocessor bit transfer Multiprocessor bit value in Multiprocessor bit value in receive data is 0 transmit data is 0 Multiprocessor bit value in Multiprocessor bit value in receive data is 1 transmit data is 1...
  • Page 624 RDR—Receive Data Register H'B5 SCI0 Initial value Read/Write Serial receive data SCMR—Smart Card Mode Register H'B6 SCI0 — — — — SDIR SINV — SMIF Initial value Read/Write — — — — — Smart card interface mode select 0 Smart card interface function is disabled (Initial value) 1 Smart card interface function is enabled Smart card data invert...
  • Page 625 SMR—Serial Mode Register H'B8 SCI1 STOP CKS1 CKS0 Initial value Read/Write Note: Bit functions are the same as for SCI0. BRR—Bit Rate Register H'B9 SCI1 Initial value Read/Write Note: Bit functions are the same as for SCI0. SCR—Serial Control Register H'BA SCI1 MPIE...
  • Page 626 RDR—Receive Data Register H'BD SCI1 Initial value Read/Write Note: Bit functions are the same as for SCI0. P1DDR—Port 1 Data Direction Register H'C0 Port 1 P1 DDR P1 DDR P1 DDR P1 DDR P1 DDR P1 DDR P1 DDR P1 DDR Initial value Modes 1 and 3...
  • Page 627 P1DR—Port 1 Data Register H'C2 Port 1 Initial value Read/Write Data for port 1 pins P2DR—Port 2 Data Register H'C3 Port 2 Initial value Read/Write Data for port 2 pins P3DDR—Port 3 Data Direction Register H'C4 Port 3 P3 DDR P3 DDR P3 DDR P3 DDR...
  • Page 628 P3DR—Port 3 Data Register H'C6 Port 3 Initial value Read/Write Data for port 3 pins P5DDR—Port 5 Data Direction Register H'C8 Port 5 — — — — P5 DDR P5 DDR P5 DDR P5 DDR Initial value Modes 1 and 3 Read/Write —...
  • Page 629 P6DDR—Port 6 Data Direction Register H'C9 Port 6 — — P6 DDR P6 DDR P6 DDR — — P6 DDR Initial value Read/Write — Port 6 input/output select 0 Generic input 1 Generic output P5DR—Port 5 Data Register H'CA Port 5 —...
  • Page 630 P8DDR—Port 8 Data Direction Register H'CD Port 8 — — — — — — P8 DDR P8 DDR Initial value Read/Write — — — Port 8 input/output select 0 Generic input 1 Generic output P7DR—Port 7 Data Register H'CE Port 7 Initial value —...
  • Page 631 P9DDR—Port 9 Data Direction Register H'D0 Port 9 — — P9 DDR P9 DDR P9 DDR Initial value Read/Write — — Port 9 input/output select 0 Generic input 1 Generic output PADDR—Port A Data Direction Register H'D1 Port A PA DDR PA DDR PA DDR PA DDR...
  • Page 632 PADR—Port A Data Register H'D3 Port A Initial value Read/Write Data for port A pins PBDDR—Port B Data Direction Register H'D4 Port B PB DDR — PB DDR PB DDR PB DDR PB DDR PB DDR PB DDR Initial value Read/Write Port B input/output select 0 Generic input...
  • Page 633 P2PCR—Port 2 Input Pull-Up MOS Control Register H'D8 Port 2 P2 PCR P2 PCR P2 PCR P2 PCR P2 PCR P2 PCR P2 PCR P2 PCR Initial value Read/Write Port 2 input pull-up control 7 to 0 0 Input pull-up transistor is off 1 Input pull-up transistor is on Note: Valid when the corresponding P2DDR bit is cleared to 0 (designating generic input).
  • Page 634 ADDRB H/L—A/D Data Register B H/L H'E2, H'E3 — — — — — — Initial value Read/Write ADDRBH ADDRBL A/D conversion data 10-bit data giving an A/D conversion result ADDRC H/L—A/D Data Register C H/L H'E4, H'E5 — — — —...
  • Page 635 ADCR—A/D Control Register H'E9 TRGE — — — — — — — Initial value Read/Write — — — — — — — Trigger enable 0 A/D conversion cannot be externally triggered 1 A/D conversion starts at the fall of the external trigger signal ( ADTRG...
  • Page 636 ADCSR—A/D Control/Status Register H'E8 ADIE ADST SCAN Initial value Read/Write R/(W) Clock select 0 Conversion time = 266 states (maximum) 1 Conversion time = 134 states (maximum) Channel select 2 to 0 Group Channel Selection Selection Description Single Mode Scan Mode Scan mode AN , AN 0 Single mode...
  • Page 637 ASTCR—Access State Control Register H'ED Bus controller AST7 AST6 AST5 AST4 AST3 AST2 AST1 AST0 Initial value Read/Write Area 7 to 0 access state control Bits 7 to 0 AST7 to AST0 Number of States in Access Cycle Areas 7 to 0 are two-state access areas Areas 7 to 0 are three-state access areas WCR—Wait Control Register H'EE...
  • Page 638 WCER—Wait Controller Enable Register H'EF Bus controller WCE7 WCE6 WCE5 WCE4 WCE3 WCE2 WCE1 WCE0 Initial value Read/Write Wait state controller enable 7 to 0 0 Wait-state control is disabled (pin wait mode 0) 1 Wait-state control is enabled MDCR—Mode Control Register H'F1 System control —...
  • Page 639 SYSCR—System Control Register H'F2 System control SSBY STS2 STS1 STS0 NMIEG — RAME Initial value Read/Write — RAM enable 0 On-chip RAM is disabled 1 On-chip RAM is enabled NMI edge select 0 An interrupt is requested at the falling edge of NMI 1 An interrupt is requested at the rising edge of NMI User bit enable 0 CCR bit 6 (UI) is used as an interrupt mask bit...
  • Page 640 ADRCR—Address Control Register H'F3 Bus controller — — — — — Modes Initial value 1 and Read/Write — — — — — — — 5 to 7 Initial value Mode 3 Read/Write — — — — Address 23 to 21 enable 0 Address output 1 I/O pins other than the above...
  • Page 641 ISCR—IRQ Sense Control Register H'F4 Interrupt controller — — IRQ5SC IRQ4SC — — IRQ1SC IRQ0SC Initial value Read/Write IRQ , IRQ , IRQ and IRQ sense control 0 Interrupts are requested when IRQ , IRQ , IRQ , and IRQ inputs are low 1 Interrupts are requested by falling-edge input at IRQ , IRQ , IRQ and IRQ...
  • Page 642 ISR—IRQ Status Register H'F6 Interrupt controller — — IRQ5F IRQ4F — — IRQ1F IRQ0F Initial value Read/Write R/(W) * — — R/(W) * R/(W) * , IRQ , IRQ and IRQ flags Bits 5, 4, 1 and 0 IRQ5F IRQ4F IRQ1F IRQ0F Setting and Clearing Conditions...
  • Page 643 IPRA—Interrupt Priority Register A H'F8 Interrupt controller IPRA7 IPRA6 — IPRA4 IPRA3 IPRA2 IPRA1 IPRA0 Initial value Read/Write Priority level A7, A6, A4 to A0 0 Priority level 0 (low priority) 1 Priority level 1 (high priority) • Interrupt sources controlled by each bit Bit 7 Bit 6 Bit 5...
  • Page 644: Appendix C I/o Block Diagrams

    Appendix C I/O Block Diagrams C.1 Port 1 Block Diagram Software standby Modes 6 and 7 Hardware standby Modes 1, 3, and 5 Reset WP1D Modes 6 and 7 Reset Modes 1, 3, and 5 WP1D: Write to P1DDR WP1: Write to port 1 RP1: Read port 1...
  • Page 645: Port 2 Block Diagram

    C.2 Port 2 Block Diagram Reset Modes Software standby RP2P 6 and 7 WP2P Hardware standby Modes 1 and 3 Reset WP2D Modes 6 and 7 Reset Modes 1, 3, and 5 WP2P: Write to P2PCR RP2P: Read P2PCR WP2D: Write to P2DDR WP2: Write to port 2...
  • Page 646: Port 3 Block Diagram

    C.3 Port 3 Block Diagram Reset Hardware Modes 6 and 7 standby Write to external address WP3D Reset Modes 6 and 7 Modes 1, 3, and 5 Read external address WP3D: Write to P3DDR WP3: Write to port 3 RP3: Read port 3 n = 0 to 7 Figure C-3 Port 3 Block Diagram...
  • Page 647: Port 5 Block Diagram

    C.4 Port 5 Block Diagram Reset Software standby Modes RP5P 6 and 7 Hardware standby WP5P Modes 1 and 3 Reset WP5D Modes 6 and 7 Reset Modes 1, 3, and 5 WP5P: Write to P5PCR RP5P: Read P5PCR WP5D: Write to P5DDR WP5: Write to port 5...
  • Page 648: Port 6 Block Diagrams

    C.5 Port 6 Block Diagrams Reset Bus controller Modes 6 and 7 WP6D WAIT Reset input enable Bus controller WAIT output WP6D: Write to P6DDR WP6: Write to port 6 RP6: Read port 6 Figure C-5 (a) Port 6 Block Diagram (Pin P6...
  • Page 649 Software standby Modes 6 and 7 Hardware standby Reset WP6D Reset Modes 6 and 7 Modes 1, 3, and 5 AS output RD output WR output WP6D: Write to P6DDR WP6: Write to port 6 RP6: Read port 6 n = 3 to 5 Figure C-5 (b) Port 6 Block Diagram (Pins P6 to P6...
  • Page 650: Port 7 Block Diagram

    C.6 Port 7 Block Diagram A/D converter Input enable Analog input RP7: Read port 7 n = 0 to 7 Figure C-6 Port 7 Block Diagram...
  • Page 651: Port 8 Block Diagrams

    C.7 Port 8 Block Diagrams Reset WP8D Reset Interrupt controller input WP8D: Write to P8DDR WP8: Write to port 8 RP8: Read port 8 Figure C-7(a) Port 8 Block Diagram (Pin P8...
  • Page 652 Reset WP8D Reset Modes 6 and 7 Modes 1, 3, and 5 Interrupt controller input WP8D: Write to P8DDR WP8: Write to port 8 RP8: Read port 8 Figure C-7 (b) Port 8 Block Diagram (Pin P8...
  • Page 653: Port 9 Block Diagrams

    C.8 Port 9 Block Diagrams Reset WP9D Reset SCI0 Output enable Serial transmit data Guard time WP9D: Write to P9DDR WP9: Write to port 9 RP9: Read port 9 Figure C-8 (a) Port 9 Block Diagram (Pin P9...
  • Page 654 Reset WP9D Reset SCI1 Output enable Serial transmit data WP9D: Write to P9DDR WP9: Write to port 9 RP9: Read port 9 Figure C-8 (b) Port 9 Block Diagram (Pin P9...
  • Page 655 Reset WP9D Input enable Reset Serial receive data WP9D: Write to P9DDR WP9: Write to port 9 RP9: Read port 9 n = 2 or 3 Figure C-8 (c) Port 9 Block Diagram (Pins P9 and P9...
  • Page 656 Reset WP9D Clock input enable Reset Clock output enable Clock output Clock input WP9D: Write to P9DDR WP9: Write to port 9 Interrupt controller RP9: Read port 9 n = 4 or 5 input Figure C-8 (d) Port 9 Block Diagram (Pins P9 and P9...
  • Page 657: Port A Block Diagrams

    C.9 Port A Block Diagrams Reset WPAD Reset TPC output enable Next data Output trigger Counter input clock WPAD: Write to PADDR WPA: Write to port A RPA: Read port A n = 0 or 1 Figure C-9 (a) Port A Block Diagram (Pins PA and PA...
  • Page 658 Reset WPAD Reset TPC output enable Next data Output trigger Output enable Compare match output Input capture input Counter input clock WPAD: Write to PADDR WPA: Write to port A RPA: Read port A n = 2 or 3 Figure C-9 (b) Port A Block Diagram (Pins PA and PA...
  • Page 659 Software standby Address output enable Mode 3 Reset WPAD TPC output Reset enable Next data Output trigger Output enable Compare match output Input capture input WPAD: Write to PADDR WPA: Write to port A RPA: Read port A n = 4 to 7 Note: PA address output enable is fixed at 1 in mode 3.
  • Page 660: Port B Block Diagrams

    C.10 Port B Block Diagrams Reset WPBD Reset TPC output enable Next data Output trigger Output enable Compare match output Input capture input WPBD: Write to PBDDR WPB: Write to port B RPB: Read port B n = 0 to 3 Figure C-10 (a) Port B Block Diagram (Pins PB to PB...
  • Page 661 Reset WPBD Reset TPC output enable Next data Output trigger Output enable Compare match output WPBD: Write to PBDDR WPB: Write to port B RPB: Read port B n = 4 or 5 Figure C-10 (b) Port B Block Diagram (Pins PB and PB...
  • Page 662 Reset WPBD Reset TPC output enable Next data Output trigger A/D converter ADTRG input WPBD: Write to PBDDR WPB: Write to port B RPB: Read port B Figure C-10 (c) Port B Block Diagram (Pin PB...
  • Page 663: Appendix D Pin States

    Appendix D Pin States D.1 Port States in Each Mode Table D-1 Port States Hardware Software Program Standby Standby Execution State Pin Name Mode Reset State Mode Mode Sleep Mode ø — Clock output Clock output RESO* RESO — to P1 1, 3 to A 5, 6...
  • Page 664 Hardware Software Program Standby Standby Execution State Pin Name Mode Reset State Mode Mode Sleep Mode 1, 3, 5, 6 keep I/O port keep I/O port 1, 3, 5, 6 [DDR = 0] [DDR = 0] Input port [DDR = 1] [DDR = 1] keep I/O port...
  • Page 665: Pin States At Reset

    D.2 Pin States at Reset Reset in T1 State: Figure D-1 is a timing diagram for the case in which RES goes low during the T1 state of an external memory access cycle. As soon as RES goes low, all ports are initialized to the input state.
  • Page 666 Reset in T2 State: Figure D-2 is a timing diagram for the case in which RES goes low during the T2 state of an external memory access cycle. As soon as RES goes low, all ports are initialized to the input state. AS, RD, and WR go high, and the data bus goes to the high-impedance state. The address bus is initialized to the low output level 0.5 state after the low level of RES is sampled.
  • Page 667 Reset in T3 State: Figure D-3 is a timing diagram for the case in which RES goes low during the state of an external memory access cycle. As soon as RES goes low, all ports are initialized to the input state. AS, RD, and WR go high, and the data bus goes to the high-impedance state. The address bus outputs are held during the T state.The same timing applies when a reset occurs in the state of an access cycle to a two-state-access area.
  • Page 668: Appendix E Timing Of Transition To And Recovery From Hardware Standby Mode

    Appendix E Timing of Transition to and Recovery from Hardware Standby Mode Timing of Transition to Hardware Standby Mode (1) To retain RAM contents with the RAME bit set to 1 in SYSCR, drive the RES signal low 10 system clock cycles before the STBY signal goes low, as shown below. RES must remain low until STBY goes low (minimum delay from STBY low to RES high: 0 ns).
  • Page 669: Appendix F Product Code Lineup

    Appendix F Product Code Lineup Table F-1 H8/3022 Series Product Code Lineup Package Product Type Product Code Mark Code (Hitachi Package Code) H8/3022 F-ZTAT version HD64F3022F HD64F3022F 80-pin QFP (FP-80A) HD64F3022TE HD64F3022TE 80-pin TQFP (TFP-80C) Mask ROM version HD6433022F HD6433022(***)F...
  • Page 670: Appendix G Package Dimensions

    Appendix G Package Dimensions Figures G-1 and G-2 show the H8/3022 Series FP-80A and TFP-80C package dimensions. 17.2 ± 0.3 Unit: mm *0.32 ± 0.08 0.12 M 0.30 ± 0.06 0.83 0° – 8° 0.8 ± 0.3 0.10 Hitachi Code...
  • Page 671 14.0 ± 0.2 Unit: mm *0.22 ± 0.05 0.10 0.20 ± 0.04 1.25 0° – 8° 0.5 ± 0.1 0.10 Hitachi Code TFP-80C JEDEC — EIAJ Conforms *Dimension including the plating thickness Weight (reference value) 0.4 g Base material dimension...
  • Page 672: Appendix H Comparison Of H8/300h Series Product Specifications

    Appendix H Comparison of H8/300H Series Product Specifications Differences between H8/3039F and H8/3022F Table H-1 Differences between H8/3039F and H8/3022F H8/3039F H8/3022F Operating Operating 4.5 V to 5.5 V 3.0 V to 5.5 V 3.0 V to 3.6 V range power supply voltage Operating...
  • Page 673 4,800bps modes PROM mode Use of PROM programmer Use of PROM programmer supporting Hitachi micro- supporting Hitachi micro- computer device type with 128- computer device type with 256- kbyte on-chip flash memory kbyte on-chip flash memory (FZTAT128) (FZTAT256)
  • Page 674 Publication Date: 1st Edition, December 1999 Published by: Electronic Devices Sales & Marketing Group Semiconductor & Integrated Circuits Hitachi, Ltd. Edited by: Technical Documentation Group Hitachi Kodaira Semiconductor Co., Ltd. Copyright © Hitachi, Ltd., 1999. All rights reserved. Printed in Japan.

This manual is also suitable for:

H8/3021H8/3020H8/3022 f-ztat

Comments to this Manuals

Symbols: 0
Latest comments: