智能车制作

标题: 那位大蝦幫忙看看這程序出什麽問題了!舵機沒反應啊! [打印本页]

作者: ywtao    时间: 2011-9-30 14:16
标题: 那位大蝦幫忙看看這程序出什麽問題了!舵機沒反應啊!
#include <hidef.h>      /* common defines and macros */
#include "derivative.h"      /* derivative-specific definitions */

void PLL_init(){
  REFDV=1;                 //&Euml;&oslash;&Iuml;à&raquo;·&Ecirc;±&Ouml;&Oacute;=2*16*&pound;¨SYNR+1)/(REFDV+1)=48M
  SYNR=2;                  //×&Uuml;&Iuml;&szlig;&Ecirc;±&Ouml;&Oacute;=48/2=24
  while(!(CRGFLG&0X08))
  CLKSEL=0x80;
}
void PWM_dj_init() {
  PWME_PWME1=0x00;
  PWMCTL_CON01=1;      //0&ordm;&Iacute;1&frac14;&para;&Aacute;&ordf;
  PWMPRCLK=0x33;       //&para;&Ocirc;CLKA&frac12;&oslash;&ETH;&ETH;8·&Ouml;&AElig;&micro; A=3M&pound;&not;&para;&Ocirc;CLKB&frac12;&oslash;&ETH;&ETH;8·&Ouml;&AElig;&micro; A=3M
  PWMSCLA=150;          //CLKSA=A/2/PWMSCLA=3M/2/15=10KHz
  PWMCLK_PCLK1=1;      //&Ntilde;&iexcl;&Ocirc;&ntilde;CLKSA×÷&Icirc;&ordf;&Ecirc;±&Ouml;&Oacute;&Ocirc;&acute;
  PWMPOL=0xff;      //&Iuml;&Egrave;&Ecirc;&auml;&sup3;&ouml;&cedil;&szlig;&micro;&ccedil;&AElig;&frac12;&pound;&not;&frac14;&AElig;&Ecirc;&yacute;&micro;&frac12;DTY&Ecirc;±&pound;&not;·&shy;×&ordf;&micro;&ccedil;&Ntilde;&sup1;
  PWMCAE_CAE1=0;       //&Iuml;ò×ó&para;&Ocirc;&AElig;&euml;&micro;&Auml;&Ecirc;&auml;&sup3;&ouml;&Auml;&pound;&Ecirc;&frac12;
  PWMPER1=200;        //&Ouml;&Uuml;&AElig;&Uacute;&Icirc;&ordf;20ms&pound;&not;&AElig;&micro;&Acirc;&Ecirc;&Icirc;&ordf;50Hz
  PWMDTY1=15;       //&Ecirc;&auml;&sup3;&ouml;&cedil;&szlig;&micro;&ccedil;&AElig;&frac12;&Ecirc;±&frac14;&auml;&Icirc;&ordf;1.5ms
  PWMCNT01=0;          //&frac14;&AElig;&Ecirc;&yacute;&AElig;÷&Ccedil;&aring;&Aacute;&atilde;
  PWME_PWME1=1;
}   

void main(void) {

  PLL_init();
  PWM_dj_init();
for(;;) {
  _FEED_COP(); /* feeds the dog */
  } /* loop forever */
  /* please make sure that you never leave main */
}
作者: 凌心    时间: 2011-9-30 16:25
我怎么没找到你的控制代码呢?




欢迎光临 智能车制作 (http://111.231.132.190/) Powered by Discuz! X3.2