dspic33ev dead time 無法產生問題

作者 ccm1978 於 2017年04月08日 22:52:46
你好!
目前使用dsPIC33EV256GM104 PWM 功能時出現一些問題想請教.
1.pwm 的push pull模式 dead time 無法產生,基本上設定都和 "Section 14. High-Speed"14-7的設定一樣,週期&duty cycle調整都可調沒問題,就是dead time 暫存器 DTRX ALTDTRX 怎麼調整都無法產生 ,duty cycle 調到100%就會看到 PWMH & PWML 交互產生的方波,完全沒有dead time,PWM CODE如下, 請幫我看一下是否有錯誤,還是哪裡沒設定好.謝謝!


void System_Colck(void)
{
60MIPS
CLKDIVbits.PLLPRE = 0;
PLLFBDbits.PLLDIV = 65;
CLKDIVbits.PLLPOST = 0;120MHz
while (OSCCONbits.COSC!= 0b011)
while (OSCCONbits.LOCK!= 1) {};//PLL LOCK
}

void System_Init(void)
{
TRISB &= ~0xfc00;
IOCON1 = 0x0000;
ANSELB = 0x0000;
}
void PWM_Init(void)
{

asm volatile ("mov #0xabcd,w10");
asm volatile ("mov #0x4321,w11");
asm volatile ("mov #0x0003,w0");
asm volatile ("mov w10, PWMKEY");
asm volatile ("mov w11, PWMKEY");
asm volatile ("mov w0,FCLCON1");
asm volatile ("mov #0xabcd,w10");
asm volatile ("mov #0x4321,w11");
asm volatile ("mov #0xC800,w0");
asm volatile ("mov w10, PWMKEY");
asm volatile ("mov w11, PWMKEY");
asm volatile ("mov w0,IOCON1");

asm volatile ("mov #0xabcd,w10");
asm volatile ("mov #0x4321,w11");
asm volatile ("mov #0x0003,w0");
asm volatile ("mov w10, PWMKEY");
asm volatile ("mov w11, PWMKEY");
asm volatile ("mov w0,FCLCON2");
asm volatile ("mov #0xabcd,w10");
asm volatile ("mov #0x4321,w11");
asm volatile ("mov #0xC800,w0");
asm volatile ("mov w10, PWMKEY");
asm volatile ("mov w11, PWMKEY");
asm volatile ("mov w0,IOCON2");

asm volatile ("mov #0xabcd,w10");
asm volatile ("mov #0x4321,w11");
asm volatile ("mov #0x0003,w0");
asm volatile ("mov w10, PWMKEY");
asm volatile ("mov w11, PWMKEY");
asm volatile ("mov w0,FCLCON3");
asm volatile ("mov #0xabcd,w10");
asm volatile ("mov #0x4321,w11");
asm volatile ("mov #0xC800,w0");
asm volatile ("mov w10, PWMKEY");
asm volatile ("mov w11, PWMKEY");
asm volatile ("mov w0,IOCON3");

PTPER = 1500;//主控时基周期
PHASE1 = 0;
PHASE2 = 0;
PHASE3 = 0;
PDC1 = 1500;
PDC2 = 1500;
PDC3 = 1500;//PWM DUTY
DTR1 = DTR2 = DTR3 = 30;
ALTDTR1 = ALTDTR2 = ALTDTR3 = 30;
PWMCON1 = 0x0000;
PWMCON2 = 0x0000;
PWMCON3 = 0x0000;
PTCON2 = 0x0000;
PTCON = 0x8000;
}

附加檔案:



jpg  123.jpg (91.38 KB)
51891_58e8f4de5810e.jpg 657X735 px

來自: http://www.microchip.com.tw/newbb/viewtopic.php?forum=2&topic_id=20559&post_id=74794