EasyManuals Logo
Home>Renesas>Computer Hardware>RL78/G13

Renesas RL78/G13 Operation

Renesas RL78/G13
54 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #9 background imageLoading...
Page #9 background image
RL78/G13 Clock Generator (Clock Switching) CC-RL
R01AN2831EJ0100 Rev. 1.00 Page 9 of 51
May 28, 2015
5. Software Description
5.1 Operation Overview
The sample code covered in this application note switches its operating clock when the switch on the target board is
pressed.
(1) Initialize the clock generator.
The sample code initializes the I/O ports, clock generator, timer array unit 0 (TAU0), 12-bit interval timer, and external
interrupt input hardware. It enables interrupt processing after the initialization.
The LED blinks at the interval of the TAU0 interval interrupts corresponding to the selected operating clock.
(2) Get the switch state.
The sample code gets the switch state. It switches the operating clock when the press of the switch is detected. The
switch state is tested when an INTP0 external interrupt occurs. If the press of the switch is not detected, the sample
code places the CPU into the HALT mode.
(3) Switch the clock.
The CPU/peripheral hardware clock (f
CLK
) is switched when the switch is pressed.
The CPU/peripheral hardware clock (f
CLK
) is switched according to the sequence below.
1) HOCO clock (32 MHz) X1 oscillation clock (20 MHz)
2) X1 oscillation clock (20 MHz) XT1 oscillation clock (32.768 kHz)
3) XT1 oscillation clock (32.768 kHz) HOCO clock (32 MHz)
Subsequently, steps (1) to (3) are repeated.
(4) Get the clock status.
The sample code gets the clock status. If the clock status is found to have been changed, the sample code takes one of
the following actions according to the clock operating state:
When the high-speed on-chip oscillator clock (HOCO clock) operates: Stops the X1 oscillation clock.
When the X1 oscillation clock operates: Stops the HOCO clock.
When the XT1 oscillation clock operates: Stops the X1 oscillation clock and the HOCO clock.
The XT1 oscillation clock is always generated.
(5) Change the LED blinking period.
The sample code changes the TAU0 interrupt interval as follows according to the operating CPU/peripheral hardware
clock (f
CLK
):
LED blinking period of the HOCO clock (32 MHz): 0.5 seconds
LED blinking period of the X1 oscillation clock (20 MHz): 1 seconds
LED blinking period of the XT1 oscillation clock (32.768 kHz): 2 seconds
(6) Transition to the HALT mode.
The sample code transitions to the HALT mode. It returns from the HALT mode by TAU0 interval interrupt or external
interrupt generated by the switch. After returning from the HALT mode, the sample code performs step (2).
Subsequently, it repeats a cycle of steps (2) to (6).

Other manuals for Renesas RL78/G13

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Renesas RL78/G13 and is the answer not in the manual?

Renesas RL78/G13 Specifications

General IconGeneral
BrandRenesas
ModelRL78/G13
CategoryComputer Hardware
LanguageEnglish

Related product manuals