标签:blog http io ar 使用 for sp on 2014
//芯片MSP430F149
#include "io430.h"
//定义使用主频
#define CPU_F ((double)8000000)
//定义延时函数
#define delay_us(x) __delay_cycles((long)(CPU_F*(double)x/1000000.0))
#define delay_ms(x) __delay_cycles((long)(CPU_F*(double)x/1000.0))
void main( void )
{
unsigned char i;
WDTCTL = WDTPW + WDTHOLD;
P2DIR |= 0x01;
P5DIR |= 0x70;
BCSCTL1 &= ~XT2OFF;
BCSCTL1 += 0x30;
do
{
IFG1 &= ~OFIFG;
for(i = 0xFF;i > 0;i--);
}
while(IFG1 & OFIFG);
BCSCTL2 |= SELM_2;
//MCLK(主系统时钟采用外部高频晶振)
//SMCLK(子系统时钟采用内部DCO振荡器)
//ACLK(辅助系统时钟采用外部低频晶振)
P5SEL = BIT4+BIT5+BIT6;
while(1)
{
P2OUT ^= 0x01;
delay_us(10);
}
}
测试结果:
标签:blog http io ar 使用 for sp on 2014
原文地址:http://www.cnblogs.com/360beida/p/4050984.html