• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






[請教]用dsPIC30F4011如何產生截波?
#1
初級會員
初級會員


查看用戶資訊
#define __dsPIC30F4011__

#include <p30f4011.h>

#define FCY 7372800*2 //one instruction frequency
//constract initial
_FOSC(CSW_FSCM_OFF & XT_PLL8);
_FWDT(WDT_OFF);
_FBORPOR(0x008300); //enable MCLR, PWMPIN=1(controlled by port at device reset),HPOL=1 and LPOL=1 active high output polarity
_FGS(CODE_PROT_OFF);

int main(void)
{
ADPCFG=0xFFFF;

initial_PWM();

while(1);
}

void initial_PWM(void)
{
PTCONbits.PTEN=0; //base timer close
IFS2bits.PWMIF=0; //PWM interrupt flag clear
IFS2bits.FLTAIF=0; //PWM fault interrupt clear
IEC2bits.FLTAIE=0; //disable PWM interrupt
IEC2bits.PWMIE=0; //disable PWM fault

PTCONbits.PTSIDL=1; //PWM halt when idle mode
PTCONbits.PTOPS=0x0; //interrupt 1:1 postscale
PTCONbits.PTCKPS=0x0; //1:1 prescale
PTCONbits.PTMOD=0x0; //operating in a free running mode

PTPERbits.PTPER=0x024D; //PWM time base period register
PDC1=0x024D; //PWM1 50%
PDC2=0x024D; //PWM2 50%

PWMCON1bits.PMOD1=1; //independent PWM 1H 1L output mode
PWMCON1bits.PMOD2=1; //independent PWM 2H 2L output mode
PWMCON1bits.PEN1H=1; //PWM1H enabled for PWM output
PWMCON1bits.PEN1L=1; //PWM1L enabled for PWM output
PWMCON1bits.PEN2H=1; //PWM2H enabled for PWM output
PWMCON1bits.PEN2L=1; //PWM2L enabled for PWM output

PWMCON2bits.SEVOPS=0x0; //special event trigger 1:1 postscale
PWMCON2bits.OSYNC=1; //overrides synchronous PWM time base
PWMCON2bits.UDIS=0; //enable updata duty cycle
PTCONbits.PTEN=1; //base timer open
}


這是我目前的程式
我想控制無刷馬達
請問OVDCON要如何設定
(放在哪個程式段)
才能得到講義上的波形?
(應該是說如何產生截波)
講義我已經下載看過了
都說要在獨立輸出模式
可是試了很久都弄不出來
不知該如何設定
還是我的程式有錯?


發表於: 2008/4/29 18:13
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... ]

教育訓練中心

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