• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   1 Anonymous Users






Re: 請問一下高手~~如何讓PWM停止
#2
新會員
新會員


查看用戶資訊
謝謝大家!!!
我已經會了!!

發表於: 2008/7/7 13:18
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請問一下高手~~如何讓PWM停止
#1
新會員
新會員


查看用戶資訊
請問一下高手~~如何讓PWM停止
以曾百由老師的書(DsPic數欸訊號控制氣原理與應用).
範例15-1程式: PWM控制設定

void Init_MCPWM(void)
{
/* Holds the PWM interrupt configuration value*/
unsigned int config;

/* Holds the value to be loaded into dutycycle register */
unsigned int period;

/* Holds the value to be loaded into special event compare register */
unsigned int sptime;

/* Holds PWM configuration value */
unsigned int config1;

/* Holds the value be loaded into PWMCON1 register */
unsigned int config2;

/* Holds the value to configure the special event trigger postscale and dutycycle */
unsigned int config3;

/* The value of ‘dutycyclereg’ determines the duty cycle register(PDCx) to be written */
unsigned int dutycyclereg;
unsigned int dutycycle;
unsigned char updatedisable;
/*以上為變數宣告設定*/
/***************************************/

/* Configure pwm interrupt enable/disable and set interrupt priorties */
config = (PWM_INT_DIS & PWM_FLTA_DIS_INT & PWM_INT_PR1& PWM_FLTA_INT_PR0);

ConfigIntMCPWM( config );

/* Configure PWM to generate square wave of 50% duty cycle */
dutycyclereg = 1;

dutycycle = 0x0059; //正轉...9.2US //DEAD TIME0.5US //反轉0.5US

updatedisable = 0;
SetDCMCPWM(dutycyclereg,dutycycle,updatedisable);

period = 0x002e;
sptime = 0x0;
DTCON1=0x00f;
/*以上為PWM工作週期設定*/
/***************************************/

config1 = (PWM_EN & PWM_IDLE_STOP & PWM_OP_SCALE16& PWM_IPCLK_SCALE16 &PWM_MOD_UPDN);

config2 = (PWM_MOD1_COMP &PWM_PDIS3H & PWM_PDIS2H & PWM_PEN1H & PWM_PDIS3L & PWM_PDIS2L & PWM_PEN1L);

config3 = (PWM_SEVOPS1 & PWM_OSYNC_PWM & PWM_UEN);

OpenMCPWM(period,sptime,config1,config2,config3);

}

因為大概知道在config1裡面做設定.可是我怎麼設定他都依然會有輸出訊號~~如何讓程式輸出(PWM1H.PWM1L)為0啊???
感謝指導新手!!!

發表於: 2008/7/7 10:54
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------