• 検索結果がありません。

Run Modes

ドキュメント内 pic18f45k50unlocked (ページ 53-56)

PIC18(L)F2X/45K50 MICROCONTROLLERS

REGISTER 3-4: ACTCON: ACTIVE CLOCK TUNING (ACT) CONTROL REGISTER

4.2 Run Modes

In the Run modes, clocks to both the core and peripherals are active. The difference between these modes is the clock source.

4.2.1 PRI_RUN MODE

The PRI_RUN mode is the normal, full-power execution mode of the microcontroller. This is also the default mode upon a device Reset, unless Two-Speed Start-up is enabled (see Section 3.12 “Two-Speed Clock Start-up Mode” for details). In this mode, the device is operated off the oscillator defined by the FOSC<3:0> bits of the CONFIG1H Configuration register.

4.2.2 SEC_RUN MODE

In SEC_RUN mode, the CPU and peripherals are clocked from the secondary external oscillator. This gives users the option of lower power consumption while still using a high accuracy clock source.

SEC_RUN mode is entered by setting the SCS<1:0>

bits to ‘01’. When SEC_RUN mode is active, all of the following are true:

• The device clock source is switched to the SOSC oscillator (see Figure 4-1)

• The primary oscillator is shut down

• The SOSCRUN bit (OSCCON2<6>) is set

• The OSTS bit (OSCCON<3>) is cleared

On transitions from SEC_RUN mode to PRI_RUN mode, the peripherals and CPU continue to be clocked from the SOSC oscillator, while the primary clock is started. When the primary clock becomes ready, a clock switch back to the primary clock occurs (see

Figure 4-2). When the clock switch is complete, the SOSCRUN bit is cleared, the OSTS bit is set and the primary clock is providing the clock. The IDLEN and SCS bits are not affected by the wake-up and the SOSC oscillator continues to run.

4.2.3 RC_RUN MODE

In RC_RUN mode, the CPU and peripherals are clocked from the internal oscillator block using the INTOSC multiplexer. In this mode, the primary clock is shut down. When using the INTRC source, this mode provides the best power conservation of all the Run modes, while still executing code. It works well for user applications which are not highly timing-sensitive or do not require high-speed clocks at all times. If the primary clock source is the internal oscillator block – either INTRC or HFINTOSC – there are no distinguishable differences between the PRI_RUN and RC_RUN modes during execution. Entering or exiting RC_RUN mode, however, causes a clock switch delay.

Therefore, if the primary clock source is the internal oscillator block, using RC_RUN mode is not recommended.

This mode is entered by setting the SCS1 bit to ‘1’. To maintain software compatibility with future devices, it is recommended that the SCS0 bit also be cleared, even though the bit is ignored. When the clock source is switched to the INTOSC multiplexer (see Figure 4-1), the primary oscillator is shut down and the OSTS bit is cleared. The IRCF<2:0> bits (OSCCON<6:4>) may be modified at any time to immediately change the clock speed.

When the IRCF bits and the INTSRC bit are all clear, the INTOSC output (HFINTOSC) is not enabled and the HFIOFS bit will remain clear. There will be no indi-cation of the current clock source. The INTRC source is providing the device clocks.

If the IRCF bits are changed from all clear (thus, enabling the INTOSC output) or if INTSRC is set, then the HFIOFS bit is set after the INTOSC output becomes stable. For details, see Table 4-2.

Clocks to the device continue while the INTOSC source stabilizes after an interval of TIOBST.

If the IRCF bits were previously at a non-zero value, or if INTSRC was set before setting SCS1 and the INTOSC source was already stable, then the HFIOFS bit will remain set.

Note: The secondary external oscillator should already be running prior to entering SEC_RUN mode. If the SOSCGO bit or any of the SOSCEN bits are not set when the SCS<1:0> bits are set to ‘01’, entry to SEC_RUN mode will not occur until the SOSCGO bit is set and secondary external oscillator is ready.

PIC18(L)F2X/45K50

On transitions from RC_RUN mode to PRI_RUN mode, the device continues to be clocked from the INTOSC multiplexer while the primary clock is started. When the primary clock becomes ready, a clock switch to the pri-mary clock occurs (see Figure 4-3). When the clock switch is complete, the HFIOFS bit is cleared, the OSTS bit is set and the primary clock is providing the device clock. The IDLEN and SCS bits are not affected by the switch. The INTRC source will continue to run if either the WDT or the Fail-Safe Clock Monitor is enabled.

FIGURE 4-1: TRANSITION TIMING FOR ENTRY TO SEC_RUN MODE

FIGURE 4-2: TRANSITION TIMING FROM SEC_RUN MODE TO PRI_RUN MODE (HSPLL)

Q4 Q3 Q2

OSC1

Peripheral Program

Q1 SOSCI

Q1

Counter Clock CPU Clock

PC + 2 PC

1 2 3 n-1 n

Clock Transition(1)

Q4 Q3

Q2 Q1 Q2 Q3

PC + 4 Note 1: Clock transition typically occurs within 2-4 TOSC.

Q1 Q3 Q4

OSC1

Peripheral

Program PC

SOSC

PLL Clock

Q1

PC + 4 Q2

Output

Q3 Q4 Q1

CPU Clock

PC + 2 Clock

Counter

Q2 Q2 Q3

Note 1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.

2: Clock transition typically occurs within 2-4 TOSC. SCS<1:0> bits Changed

TPLL(1)

1 2 n-1 n

Clock

OSTS bit Set

Transition(2) TOST(1)

PIC18(L)F2X/45K50

FIGURE 4-3: TRANSITION TIMING FROM RC_RUN MODE TO PRI_RUN MODE TABLE 4-2: INTERNAL OSCILLATOR FREQUENCY STABILITY BITS

IRCF<2:0> INTSRC Selected Oscillator Selected Oscillator Stable when:

000 0 INTRC LFIOFS = 1

000 1 HFINTOSC HFIOFS = 1

001-111 x HFINTOSC HFIOFS = 1

Q1 Q3 Q4

OSC1

Peripheral

Program PC

INTOSC

PLL Clock

Q1

PC + 4 Q2

Output

Q3 Q4 Q1

CPU Clock

PC + 2 Clock

Counter

Q2 Q2 Q3

Note 1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.

2: Clock transition typically occurs within 2-4 TOSC. SCS<1:0> bits Changed

TPLL(1)

1 2 n-1 n

Clock

OSTS bit Set

Transition(2) Multiplexer

TOST(1)

PIC18(L)F2X/45K50

ドキュメント内 pic18f45k50unlocked (ページ 53-56)