注册会员
- 积分
- 103
- 威望
- 172
- 贡献
- 21
- 兑换币
- 0
- 注册时间
- 2011-4-13
- 在线时间
- 14 小时
|
为什么我的激光分时加了总线时钟初始化就不工作了
unsigned char Data[15]={0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
void Delay(unsigned int Time)
{
unsigned char i;
DDRA=0xFF;
for(i=0; i<160; i++)
for( ; Time>0; Time--);
}
void liushui(void)
{
unsigned char i;
for(i=0;i<15;i++)
{
PORTA=Data[i];
Delay(50); //500us延时 50
}
} void SetBusCLK_32M(void)
{
CLKSEL=0X00; //disengage PLL to system
PLLCTL_PLLON=1; // on PLL
SYNR =0xc0 | 0x08;
REFDV=0x60 | 0x04;
POSTDIV=0x00; //pllclock=2*osc*(1+SYNR)/(1+REFDV)=64MHz;
_asm(nop); //BUS CLOCK=32M
_asm(nop);
while(!(CRGFLG_LOCK==1)); //when pll is steady ,then use it;
CLKSEL_PLLSEL =1; //engage PLL to system;
}
void main(void)
{ SetBusCLK_32M();
for(;;) { liushui();}} |
|