⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ce012_readme.txt

📁 一份学习微星公司出品的pic或dspic系列单片机或dsp芯片的源程序
💻 TXT
字号:

                              Readme File for Code Example:
              CE012 - Dynamic Clock Switching for Low-Power Operation
              --------------------------------------------------------

This file contains the following sections:
1. Code Example Description
2. Folder Contents
3. Suggested Development Resources
4. Reconfiguring the project for a different dsPIC30F device
5. Revision History

1. Description:
---------------
Microchip's dsPIC30F Digital Signal Controllers provide several means to reduce power consumption while the application is running. Power consumption is directly proportional to the operating MIPS. In certain applications, it may be possible to run the device at lower MIPS for a certain tasks and at higher MIPS for certain compute-intensive tasks. In such applications, one of the mechanisms available to the user to dynamically increase or decrease the system clock frequency is to switch the system clock source to either of the 32 KHz LP Oscillator, 512 KHz Internal LPRC oscillator, the 7.37 MHz Internal Fast RC oscillator or the Primary oscillator (crystal or canned oscillator). This run-time clock switching is performed by writng to the NOSC bits and the OSWEN bit in the OSCCON register.

The attached code example contains 2 C source files - main.c and clock_switch.c. The clock_switch.c file provides a clock switching function that may be used in your application to dynamically switch from one clock source to another. The function has the following prototype and description:

Function:       int clockSwitch (unsigned int)
Input:          int data type of a value chosen from OscillatorSystemCodes.h
                file Valid values are 0,1,2,3 and for devices featuring
                Oscillator System version 3, a value of 7 is also supported.
                Please read the dsPIC30F Family Reference Manual
                for further details.
Return:         RET_CODE_OSC_SUCCESS for a successful clock switch operation
                RET_CODE_OSC_ERROR for an illegal clock switch request
Description:    This subroutine performs an OSCCONH unlock and then writes the
                requested new oscillator source value to OSCCONH. Next, it
                unlocks OSCCONL and sets the OSWEN bit to initiate a clock-
                switch. The subroutine returns when OSWEN has been cleared by
                hardware to indicate a successful clock switch.

The main.c file simply calls the clockSwitch() routine to switch the system clock to the Low-Power RC (LPRC) oscillator. The configuration macros in the main.c file ensure the FOSC configuration register has been set up to enable run-time clock switching.

2. Folder Contents:
-------------------
This folder contains the following sub-folders:
a. gld
        This folder contains a linker script file for the example project.
        This file is used for building the project for a 30F6014A device.
        This file simply includes the relevant device linker script, 
        "p30F6014A.gld" and the relevant MPLAB

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -