智能车制作
标题:
程序求解
[打印本页]
作者:
欲驰
时间:
2011-12-1 16:47
标题:
程序求解
我是新手,对下面的程序不是很明白,求各位前辈精讲一下,谢谢!
#include <hidef.h> /* common defines and macros */
#include <MC9S12XS128.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12xs128"
void PLLInit(void)
{
SYNR=0XC5;
REFDV=0XC1;
while(CRGFLG_LOCK==0);
CLKSEL_PLLSEL=1;
}
void delay(int t)
{ int i,j;
//i=t;
for(i=t;i>0;i--)
{
j=0x1300;
while(j--);
}
}
void PWMInit(void)
{
PWME=0x00;
PWMCTL_CON01=1;
PWMPRCLK=0X00;
PWMSCLA=0X00;
PWMSCLB=0X00;
PWMCLK=0X0FF;
PWMPOL=0X0FF;
PWMCAE=0X00;
PWMPER01=2000;
PWMDTY01=110;
PWME=0X0FF;
}
void main(void) {
/* put your own code here */
EnableInterrupts;
PLLInit();
PWMInit();
delay(1000);
for(;;)
{
PWMDTY01=153;
delay(8000);
PWMDTY01=110;
delay(8000);
PWMDTY01=77;
delay(8000);
PWMDTY01=110;
delay(8000);
} /* wait forever */
/* please make sure that you never leave this function */
}
欢迎光临 智能车制作 (http://dns.znczz.com/)
Powered by Discuz! X3.2