"); //-->
//外部晶振
void Clock_Init( void )
{
/* Set fxh */
uchar temp_stabset, temp_stabwait;
OSTS = 0x05; /* 2^16/fx */
OSCCTL = 0x40|0x01; /* X1, X2 as crystal/ceramic resonator connection */ /* 10 MHz < fxh <= 20 MHz */
MSTOP = 0;
temp_stabset = 0x1f; /* 2^16/fx */
do{
temp_stabwait = OSTC;
temp_stabwait &= temp_stabset;
}while(temp_stabwait != temp_stabset);
/* Set fprs */
MCM = 0x05; /* fxp = fxh,fprs = fxh */
/* Set frh */
RSTOP = 1;
/* Set fsub */
XTSTART = 0;
/* Set fcpu */
PCC &= (uchar)~(0x07 | 0x10);
PCC |= 0x01; /* fcpu = fxp/2 (default) */
/* Set frl */
LSRSTOP = 0;
}
//内部晶振
void Clock_Init( void )
{
/* Set fxh */
OSCCTL = 0x00; /* X1, X2 as I/O port */
MSTOP = 1;
/* Set frh */
RSTOP = 0;
/* Set fprs */
MCM = 0x00; /* fxp = frh,fprs = frh */
/* Set fsub */
XTSTART = 0;
/* Set fcpu */
PCC &= (uchar)~(0x07 | 0x10);
PCC |= 0x01; /* fcpu = fxp/2 (default) */
/* Set frl */
LSRSTOP = 0;
}
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。