中级会员
- 积分
- 385
- 威望
- 253
- 贡献
- 68
- 兑换币
- 46
- 注册时间
- 2009-2-12
- 在线时间
- 32 小时
|
void vSciInit(void)
{
SCI1CR2=0x2C;
SCI1BDH=0x00;
//SCI0BDL = (unsigned char)((32000000UL /* OSC freq */ / 2) / 9600 /* baud rate */ / 16 /*factor*/);
SCI1BDL=0x11; //PORTBM BUS_COLOCK,波特率为115200
}
void PLL_Init(void)
{ /*
CLKSEL=0X00; //disengage PLL to system
PLLCTL_PLLON=1; //turn on PLL
SYNR=0x05;
REFDV=0x01; //pllclock=2*osc*(1+SYNR)/(1+REFDV)=32MHz;
_asm(nop); //BUS CLOCK=16M
_asm(nop);
while(!(CRGFLG_LOCK==1)); //when pll is steady ,then use it;
CLKSEL_PLLSEL =1; //engage PLL to system;
*/
CLKSEL=0X00; // disengage PLL to system
PLLCTL_PLLON=1; // turn on PLL
SYNR =0x40 | 0x03; // pllclock=2*osc*(1+SYNR)/(1+REFDV)=64MHz;
REFDV=0x80 | 0x01;
POSTDIV=0x00;
_asm(nop); // BUS CLOCK=32M
_asm(nop);
while(!(CRGFLG_LOCK==1)); //when pll is steady ,then use it;
CLKSEL_PLLSEL =1;
} |
|