Switching The Cpu Clock - Samsung S3C9228 User Manual

8-bit cmos microcontrollers
Table of Contents

Advertisement

CLOCK CIRCUITS

SWITCHING THE CPU CLOCK

Data loadings in the oscillator control register, OSCCON, determine whether a main or a sub clock is selected as
the CPU clock, and also how this frequency is to be divided by setting CLKCON. This makes it possible to switch
dynamically between main and sub clocks and to modify operating frequencies.
OSCCON.0 select the main clock (fx) or the sub clock (fxt) for the system clock. OSCCON .3 start or stop main
clock oscillation, and OSCCON.2 start or stop sub clock oscillation. CLKCON.4–.3 control the frequency divider
circuit, and divide the selected fxx clock by 1, 2, 8, or 16.
For example, you are using the default system clock (normal operating mode and a main clock of fx/16) and you
want to switch from the fx clock to a sub clock and to stop the main clock. To do this, you need to set OSCCON.0
to "1", take a delay, and OSCCON.3 to "1" sequently. This switches the clock from fx to fxt and stops main clock
oscillation.
The following steps must be taken to switch from a sub clock to the main clock: first, set OSCCON.3 to "0" to
enable main system clock oscillation. Then, after a certain number of machine cycles has elapsed, select the
main clock by setting OSCCON.0 to "0".
PROGRAMMING TIP — Switching the CPU clock
1. This example shows how to change from the main clock to the sub clock:
MA2SUB
OR
LD
CALL
OR
RET
2. This example shows how to change from sub clock to main clock:
SUB2MA
AND
CALL
AND
RET
DLY16
LD
DEL
NOP
DEC
JR
RET
7-6
CLKCON,#18H
OSCCON,#01H
DLY16
OSCCON,#08H
OSCCON,#0F7H
DLY16
OSCCON,#0FEH
R0,#20H
R0
NZ,DEL
; Non-divided clock for system clock
; Switches to the sub clock
; Delay 16ms
; Stop the main clock oscillation
; Start the main clock oscillation
; Delay 16 ms
; Switch to the main clock
S3C9228/P9228_UM_REV1.10

Advertisement

Table of Contents
loading

This manual is also suitable for:

S3p9228

Table of Contents