使用
void main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
initClock();
while(1);
}
#include "sys.h"
void SetVcoreUp(unsigned int level)
{
// Open PMM registers for write
PMMCTL0_H = PMMPW_H;
// Set SVS/SVM high side new level
SVSMHCTL = SVSHE + SVSHRVL0 * level + SVMHE + SVSMHRRL0 * level;
// Set SVM low side to new level
SVSMLCTL = SVSLE + SVMLE + SVSMLRRL0 * level;
// Wait till SVM is settled
while ((PMMIFG & SVSMLDLYIFG) == 0)
;
// Clear already set flags
PMMIFG &= ~(SVMLVLRIFG + SVMLIFG);
// Set VCore to new level
PMMCTL0_L = PMMCOREV0 * level;
// Wait till new level reached
if ((PMMIFG & SVMLIFG))
while ((PMMIFG & SVMLVLRIFG) == 0)
;
// Set SVS/SVM low side to new level
SVSMLCTL = SVSLE + SVSLRVL0 * level + SVMLE + SVSMLRRL0 * level;
// Lock PMM registers for write access
PMMCTL0_H = 0x00;
}
void initClock(void)
{
// Increase Vcore setting to level3 to support fsystem=25MHz
// NOTE: Change core voltage one level at a time..
SetVcoreUp(0x01);
SetVcoreUp(0x02);
SetVcoreUp(0x03);
UCSCTL3 = SELREF_2; // Set DCO FLL reference = REFO
UCSCTL4 |= SELA_2; // Set ACLK = REFO
__bis_SR_register(SCG0); // Disable the FLL control loop
UCSCTL0 = 0x0000; // Set lowest possible DCOx, MODx
UCSCTL1 = DCORSEL_7; // Select DCO range 50MHz operation
UCSCTL2 = FLLD_0 + 762; // Set DCO Multiplier for 25MHz
// (N + 1) * FLLRef = Fdco
// (762 + 1) * 32768 = 25MHz
// Set FLL Div = fDCOCLK/2
__bic_SR_register(SCG0); // Enable the FLL control loop
// Worst-case settling time for the DCO when the DCO range bits have been
// changed is n x 32 x 32 x f_MCLK / f_FLL_reference. See UCS chapter in 5xx
// UG for optimization.
// 32 x 32 x 25 MHz / 32,768 Hz ~ 780k MCLK cycles for DCO to settle
__delay_cycles(782000);
// Loop until XT1,XT2 & DCO stabilizes - In this case only DCO has to stabilize
do
{
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);
// Clear XT2,XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
} while (SFRIFG1 & OFIFG); // Test oscillator fault flag
}
上一篇:基于MSP430FF449D单片机低功耗、智能化的电子血压计设计
下一篇:单片机 MSP430 G2553 launchpad LCD1602 显示 连线
推荐阅读最新更新时间:2024-10-29 16:35
设计资源 培训 开发板 精华推荐
- STM32Demo_Pro
- AM2F-0507SZ 7.2V 2 瓦 DC-DC 转换器的典型应用
- STC89C52RC/STC12核心板
- NCP2811BDTBRGEVB:双音频电源评估板
- 基于PAM2804的单LED恒流驱动
- 使用 Analog Devices 的 LTC3526LEDC 的参考设计
- 具有热降额功能的 LT3756IUD 30W 白光 LED 前照灯驱动器的典型应用电路
- LD2980CM50TR SOT23-5L 与低 ESR 抑制输出电容器兼容的超低压降稳压器的典型应用
- LPC4350-DB1,带有 LPC4350FET256 ARM Cortex-M4 数字信号控制器和 Cortex-M0 协处理器的评估板
- 声控led灯