中级会员
 
- 积分
- 214
- 威望
- 192
- 贡献
- 22
- 兑换币
- 0
- 注册时间
- 2008-2-26
- 在线时间
- 0 小时
|
< >#include <hidef.h> /* common defines and macros */<BR>#include <mc9s12dg128.h> /* derivative information */<BR>#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"</P><P>void main(){<BR> int i;<BR> PWME=0X00;<BR> PWMCTL=0X10; //0 1 通道级联<BR> PWMPRCLK =0X03; //分频系数8 8M/8<BR> PWMCLK=0X00; // 选择 CLOCA<BR> //PWMSCLA=50;<BR> //PWMSCLB=50; <BR> PWMPOL=0XFF;<BR> PWMCAE=0X00;<BR> PWMPER01=20000;//周期 20000*1us=20ms<BR> PWMDTY01=1000; //占空比 1000*1us=1ms<BR> PWME=0X02; //通道1 输出信号<BR> while(1){<BR> <BR> }<BR>}</P><P> </P><P>接上电源和信号线之后 舵机里一直响,但是输出轴没有转动 占空比我设置了几个不同的值分别实验,但是都没有反应</P> |
|