![](http://datasheet.mmic.net.cn/Renesas-Electronics-America/UPD78F9222CS-CAC-A_datasheet_99864/UPD78F9222CS-CAC-A_11.png)
User’s Manual U16898EJ6V0UD
9
3.4.7
Stack addressing......................................................................................................................... 52
CHAPTER 4 PORT FUNCTIONS........................................................................................................... 53
4.1
Functions of Ports ..................................................................................................................... 53
4.2
Port Configuration ..................................................................................................................... 54
4.2.1
Port 2........................................................................................................................................... 55
4.2.2
Port 3........................................................................................................................................... 56
4.2.3
Port 4........................................................................................................................................... 58
4.2.4
Port 12......................................................................................................................................... 63
4.2.5
Port 13......................................................................................................................................... 65
4.3
Registers Controlling Port Functions...................................................................................... 65
4.4
Operation of Port Function ....................................................................................................... 70
4.4.1
Writing to I/O port ........................................................................................................................ 70
4.4.2
Reading from I/O port.................................................................................................................. 70
4.4.3
Operations on I/O port................................................................................................................. 70
CHAPTER 5 CLOCK GENERATORS.................................................................................................... 71
5.1
Functions of Clock Generators ................................................................................................ 71
5.1.1
System clock oscillators .............................................................................................................. 71
5.1.2
Clock oscillator for interval time generation ................................................................................. 71
5.2
Configuration of Clock Generators.......................................................................................... 72
5.3
Registers Controlling Clock Generators ................................................................................. 74
5.4
System Clock Oscillators.......................................................................................................... 77
5.4.1
High-speed internal oscillator ...................................................................................................... 77
5.4.2
Crystal/ceramic oscillator ............................................................................................................ 77
5.4.3
External clock input circuit ........................................................................................................... 79
5.4.4
Prescaler ..................................................................................................................................... 79
5.5
Operation of CPU Clock Generator.......................................................................................... 80
5.6
Operation of Clock Generator Supplying Clock to Peripheral Hardware ............................ 85
CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00............................................................................. 87
6.1
Functions of 16-bit Timer/Event Counter 00 ........................................................................... 87
6.2
Configuration of 16-bit Timer/Event Counter 00..................................................................... 88
6.3
Registers to Control 16-bit Timer/Event Counter 00 .............................................................. 92
6.4
Operation of 16-bit Timer/Event Counter 00 ........................................................................... 98
6.4.1
Interval timer operation................................................................................................................ 98
6.4.2
External event counter operation............................................................................................... 100
6.4.3
Pulse width measurement operations ....................................................................................... 103
6.4.4
Square-wave output operation .................................................................................................. 111
6.4.5
PPG output operations .............................................................................................................. 113
6.4.6
One-shot pulse output operation ............................................................................................... 116
6.5
Cautions Related to 16-bit Timer/Event Counter 00............................................................. 121
CHAPTER 7 8-BIT TIMER 80.............................................................................................................. 128
7.1
Function of 8-bit Timer 80 ....................................................................................................... 128
7.2
Configuration of 8-bit Timer 80 .............................................................................................. 129
7.3
Register Controlling 8-bit Timer 80........................................................................................ 131
7.4
Operation of 8-bit Timer 80 ..................................................................................................... 132