下面是一个MSP430F149常用的时钟配置子函数,BCSCTL2|=SELM1+SELS;我在查了手册和头文件名后有个疑惑,头文件说:#define SELM1 (0x80) /* MCLK Source Select 1 */
#define SELS (0x08) /* SMCLK Source Select 0:DCOCLK /
手册上说的:
SELMx Bits
7-6
Select MCLK. These bits select the MCLK source.
00 DCOCLK
01 DCOCLK
10 XT2CLK when XT2 oscillator present on-chip. LFXT1CLK when XT2
oscillator not present on-chip.
11 LFXT1CLK
DIVMx BitS
5-4
Divider for MCLK
00 /1
01 /2
10 /4
11 /8
SELS Bit 3 Select SMCLK. This bit selects the SMCLK source.
0 DCOCLK
1 XT2CLK when XT2 oscillator present on-chip. LFXT1CLK when XT2
oscillator not present on-chip.
DIVSx BitS
2-1
Divider for SMCLK
00 /1
01 /2
10 /4
11 /8
不是说明我的MCLK是8M(假如XT2为8M),我的SMCLK也是8M.可我做下来的实验怎么是MCLK是8M,SMCLK是1M?请问谁能帮忙解答一下,谢谢~
void int_clk()
{
uchar i;
BCSCTL1&=~XT2OFF; //打开XT振荡器
BCSCTL2|=SELM1+SELS;//MCLK 8M and SMCLK 1M
do
{
IFG1 &= ~OFIFG; //清除振荡错误标志
for(i = 0; i < 100; i++)
_NOP(); //延时等待
}
while ((IFG1 & OFIFG) != 0); //如果标志为1继续循环等待
IFG1&=~OFIFG;
}
此帖出自
小平头技术问答
我试一下,谢谢你~
一周热门 更多>