EasyManua.ls Logo

Microchip Technology dsPIC30F - Oscillator Control Register (OSCCON)

Microchip Technology dsPIC30F
738 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
Loading...
dsPIC30F Family Reference Manual
DS70054C-page 7-6 © 2004 Microchip Technology Inc.
7.3.1 Clock Switching Mode Configuration Bits
The FCKSM<1:0> configuration bits (FOSC<15:14>) are used to enable/disable device clock
switching and the Fail-Safe Clock Monitor (FSCM). When these bits are unprogrammed (default),
clock switching and the FSCM are disabled.
7.4 Oscillator Control Register (OSCCON)
The OSCCON Control register provides control of clock switching and clock source status
information.
The COSC<1:0> status bits (OSCCON<13:12>) are read only bits that indicate the oscillator
source that the device is operating from. The COSC<1:0> bits are set to the FOS<1:0>
configuration bit values at a Power-on Reset and will change to indicate the new oscillator source
at the end of a clock switch operation.
The NOSC<1:0> status bits (OSCCON<9:8>) are control bits that select the new clock source
for a clock switch operation. The NOSC<1:0> bits are set to the FOS<1:0> configuration bit
values at a Power-on Reset or Brown-out Reset and are modified by the user software during a
clock switch operation.
The POST<1:0> control bits (OSCCON<8:7>) control the system clock divide ratio.
The LOCK status bit (OSCCON<5>) is read only and indicates the status of the PLL circuit.
The CF status bit (OSCCON<3>) is a readable/writable status bit that indicates a clock failure.
The LPOSCEN control bit (OSCCON<1>) is used to enable or disable the 32 kHz Low Power
Crystal oscillator.
The OSWEN control bit (OSCCON<0>) is used to initiate a clock switch operation. The OSWEN
bit is cleared automatically after a successful clock switch.
7.4.1 Protection Against Accidental Writes to OSCCON
A write to the OSCCON register is intentionally made difficult, because it controls clock switching
and clock scaling.
To write to the OSCCON low byte, the following code sequence must be executed without any
other instructions in between:
Byte Write 0x46 to OSCCONL
Byte Write 0x57 to OSCCONL
After this sequence, a byte write to OSCCONL is allowed for one instruction cycle. Write the
desired value or use a bit manipulation instruction.
To write to the OSCCON high byte, the following instructions must be executed without any other
instructions in between:
Byte Write 0x78 to OSCCONH
Byte Write 0x9A to OSCCONH
After this sequence, a byte write is allowed to OSCCONH for one instruction cycle. Write the
desired value or use a bit manipulation instruction.
Note: The OSCCON register is write protected because it controls the device clock
switching mechanism. The user software must execute a certain code sequence to
write to the register. See Section 7.4.1 “Protection Against Accidental Writes to
OSCCON” for further details.

Table of Contents

Other manuals for Microchip Technology dsPIC30F