![NEC 78K0S/K 1+ Series Application Note Download Page 6](http://html.mh-extra.com/html/nec/78k0s-k-1-series/78k0s-k-1-series_application-note_249252006.webp)
CHAPTER 3 SOFTWARE
Application Note U18752EJ2V0AN
6
3.2 Internal Peripheral Functions to Be Used
The following internal peripheral functions of the microcontroller are used in this sample program.
• Input ports (for switch inputs):
P40, P43
• Output ports (for lighting LEDs): P20, P21, P22
3.3 Initial Settings and Operation Overview
In this sample program, the selection of the clock frequency, setting of the I/O ports, and the like are performed in
the initial settings.
After completion of the initial settings, the lighting of the three LEDs (LED1, LED2, LED3) is controlled in
accordance with the combination of the two switch inputs (SW1, SW2).
The details are described in the state transition diagram shown below.
Switch input identification
Turning off all LEDs
Lighting only LED1
Lighting only LED2
Lighting only LED3
SW1: OFF,
SW2: OFF
Initial settings
SW1: ON,
SW2: ON
SW1: ON,
SW2: OFF
SW1: OFF,
SW2: ON
Option byte setting
• Selecting the high-speed internal oscillator as
the system clock source
• The low-speed internal oscillator can be stopped
by software.
• The P34/RESET pin is used as the RESET pin.
Stack pointer setting
Stopping watchdog timer operation
Setting the CPU clock frequency and peripheral
hardware clock frequency to 2 MHz
Stopping the oscillation of the low-speed internal
oscillator
Setting the I/O ports
•
•
•
•
•
•