• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: 急救.....請大家幫忙一下.....
#8
新會員
新會員


查看用戶資訊
先解決切換頻率問題吧! 這方面你先用固定duty方式try看看, 參考datasheet設定, 各參數試調一下, 應該很快可以試出來! 如果你要以16kHz先試也可以: 建sin table, 將一個週期的sin值分成266 or 267點皆可(16kHz/60Hz=266.67), 之後再一點一點丟! 你原本程式中的MAX_HALF_DUTY 就是在設定弦波之比較振幅 (modulation index)的值, 這個值要與counter相匹配, 這樣應該就可以得到open loop 60Hz的sin PWM波型!

發表於: 2007/6/13 11:29
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 急救.....請大家幫忙一下.....
#7
新會員
新會員


查看用戶資訊
我是需要60Hz的 sin PWM....
不過我量測出來的PWM頻率卻是1.32kHz....
我設定的切換頻率是20kHz.....
不過量測出來大約是16kHz....
那請問一下....
第一.....
如果是外頻的問題....
那想請教震盪器怎麼設計.....
第二.....
counter周期計算錯誤....
那是不是只要更改就可以達到呢???

發表於: 2007/6/11 15:35
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 急救.....請大家幫忙一下.....
#6
新會員
新會員


查看用戶資訊
你的問題很奇怪, 60Hz PWM是PWM為60Hz, 1.32kHz又是啥?
還是你需要60Hz的sin PWM? 如果是,請告知你的PWM 頻率是多少? 假設你希望的PWM是20kHz, 而量出來是1.32kHz, 有可能的原因是:1.外頻與你的程式搭配錯誤 2.counter的週期計算錯誤.

發表於: 2007/6/11 14:37
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 急救.....請大家幫忙一下.....
#5
新會員
新會員


查看用戶資訊
我不是要做 six step
只是想讓PWM達到自動調變作用....
目前有做出自動調變....
不過不知道是不是程式哪邊有問題....
還是說外部震盪器沒有完全震盪起來....
我原本設定的是60Hz的PWM信號....
出來卻是1.32kHz的信號.....
所以想請教各位高手....
是不是我的外部震盪器的關係....
還是說我程式內部有問題...
我用的是dspic 30F2010....

發表於: 2007/6/11 8:47
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 急救.....請大家幫忙一下.....
#4
新會員
新會員


查看用戶資訊
你是要做six step嗎?

發表於: 2007/6/9 11:45
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 急救.....請大家幫忙一下.....
#3
新會員
新會員


查看用戶資訊
不是ㄧPO在PO....而是問題沒解決阿...
所以想在請教不同的問題阿....

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


Re: 急救.....請大家幫忙一下.....
#2
高級會員
高級會員


查看用戶資訊
...

沒有必要一PO再PO吧

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


急救.....請大家幫忙一下.....
#1
新會員
新會員


查看用戶資訊
各位高手.....
可以請教一下....
我要60Hz的PWM信號.....

程式如下....
#define __dsPIC30F2010__

#include <uart.h>
#include <adc12.h>
#include <timer.h>
#include <math.h>
#include <p30F2010.h>
#include <uart.h>
#include <stdio.h>
//#include "APP009V2_LCD.h"

#define pi 3.1415926
#define FCY 7372800 * 2

#define MAX_HALF_DUTY 730 // Max Duty is 180 , but multiplex with 100

#define Volt0 736

void Initial_Timer1( void ) ;
void Initial_CAN( void ) ;
void DelayNmSec(unsigned int ) ;
void InitADC10(void);
void MotPWM_Initial(void);


//---------------------------------------------------------------------------
// Configuration bits

_FOSC(CSW_FSCM_OFF & XT_PLL8); //XT with 8xPLL oscillator, Failsafe clock off
_FWDT(WDT_OFF); //Watchdog timer disabled
_FBORPOR(PBOR_OFF & MCLR_EN); //Brown-out reset disabled, MCLR reset enabled
_FGS(CODE_PROT_OFF); //Code protect disabled

typedef struct tagLEDBITS {

unsigned :8;
unsigned LED_Val:8;
} PORTDBITSS;
extern volatile PORTDBITSS LED_Ctrl __attribute__((__near__));


unsigned char TxData[10] = {0,0,0,0,0,0,0,0,0,0} ;

unsigned int ValuePDC ;

int SinTable[92] ;
int LoopVar1 ;
int U_Degree ;
int V_Degree ;
int W_Degree ;
int T1IF_Flag ;
int T1IF_Counter ;

unsigned int Temp_Uint ;

void __attribute__((__interrupt__)) _T1Interrupt(void)
{

U_Degree += 3;
if ( U_Degree > 360 ) U_Degree = 0 ;

{

if ( U_Degree <= 90 )
ValuePDC = ( SinTable[U_Degree]) + Volt0 ;

else if ( U_Degree > 90 && U_Degree <= 180 )
ValuePDC = ( SinTable[180 - U_Degree] )+ Volt0 ;

else if ( U_Degree > 180 && U_Degree <= 270 )
ValuePDC = Volt0 - ( SinTable[U_Degree - 180] ) ;

else if ( U_Degree > 270 && U_Degree <= 360 )
ValuePDC = Volt0 - ( SinTable[360-U_Degree] ) ;

PDC1 = ValuePDC ;
}

V_Degree = U_Degree + 180 ;
if ( V_Degree > 360 ) V_Degree = V_Degree - 360 ;

{
if ( V_Degree <= 90 )
ValuePDC = ( SinTable[V_Degree] )+ Volt0 ;

else if ( V_Degree > 90 && V_Degree <= 180 )
ValuePDC = ( SinTable[180 - V_Degree ] )+ Volt0 ;

else if ( V_Degree > 180 && V_Degree <= 270 )
ValuePDC = Volt0 - ( SinTable[V_Degree - 180]) ;

else if ( V_Degree > 270 && V_Degree <= 360 )
ValuePDC = Volt0 - ( SinTable[360-V_Degree] ) ;

PDC2 = ValuePDC ;
}

//W_Degree = U_Degree + 240 ;
//if ( W_Degree > 360 ) W_Degree = W_Degree - 360 ;

//{
//if ( W_Degree <= 90 )
//ValuePDC = ( SinTable[W_Degree] )+ Volt0 ;

//else if ( W_Degree > 90 && W_Degree <= 180 )
//ValuePDC = ( SinTable[180 - W_Degree ])+ Volt0 ;

//else if ( W_Degree > 180 && W_Degree <= 270 )
//ValuePDC = Volt0 - ( SinTable[W_Degree - 180]) ;

//else if ( W_Degree > 270 && W_Degree <= 360 )
//ValuePDC = Volt0 - ( SinTable[360-W_Degree]) ;

//PDC3 = ValuePDC ;
//}

}

void __attribute__((__interrupt__)) _PWMInterrupt(void)
{

IFS2bits.PWMIF = 0 ;
}


int main( void )

{


for ( LoopVar1 = 0 ; LoopVar1 < 91 ; LoopVar1 += 1)
{
SinTable[LoopVar1] = sin( (3.1415926 * LoopVar1) / (double)180 ) * MAX_HALF_DUTY ;
}

Initial_Timer1( ) ;
MotPWM_Initial( ) ;

TRISD &= 0x00ff ;
U_Degree = 0 ;

T1IF_Flag = 0 ;
T1IF_Counter = 0 ;

//putrsLCD("dsPIC30F2010 Dem") ;
//setcurLCD(0,1) ;
//putrsLCD("PWM Running ") ;

while (1)
{
}
}

void DelayNmSec(unsigned int N)
{
unsigned int j;
while(N--)
for(j=0;j < 1000;j++);
}


void Initial_Timer1( void )
{
ConfigIntTimer1( T1_INT_PRIOR_7 & T1_INT_ON ) ;
OpenTimer1( T1_ON & T1_IDLE_STOP & T1_GATE_OFF & T1_PS_1_1 & T1_SYNC_EXT_OFF & T1_SOURCE_INT ,
2048 ) ;
}

void MotPWM_Initial(void)
{
IEC2bits.PWMIE = 0 ; // Disable PWM Interrupt !!
IEC2bits.FLTAIE = 0 ;

OVDCON = 0xff00 ; // Inactive all PWM OUTPUT !!

TRISE = 0xffc0 ;
PTCON = 0xa000 ; // Configure as 0b1010 0000 0000 0000
// PWM Time Base OFF , PWM Time Base OP in free running Mode
PWMCON1 = 0x0077 ; // Configure as 0b0000000000010001
// PWM I/O in complementary Mode and only PWM1L/H as PWM output
PWMCON2 = 0x0000 ; // Configure as 0b0000000000000000

DTCON1 = 0x0101 ; // Configure as 0b0000001000000010 ;

FLTACON = 0x0000 ;

IPC9bits.PWMIP = 6 ;

// ---------------------------------------------------------------------------------
// The Switching Frequency !!
// PWM resolution >= 10 bits ,
// PDCx[1:15] compare with PTMR [0:14]
// PDCx(0) compare with MSB of prescaler counter
// So, PTPER is 9 bit if resolution of PDCx is 10 bit
// Setting PWM Frequency = 20K
// PTPER = ( (7372800*2)/ 20000 ) -1 = 736.28 = 736
// PWM Frequency will be Fcy/736 = 20.0K
// Formular !! PTPER = (Fcy/(FPWM*PTMR Prescaler)) - 1
// ---------------------------------------------------------------------------------
PTPER = 736 ; // PWM Time Base Period Register
ValuePDC = 0x00 ;

PDC1 = ValuePDC ;
PDC2 = ValuePDC ;
//PDC3 = ValuePDC ;

}

不過我的PWM信號....沒有60Hz....
我用的是dspic 30F2010
震盪器....6MHz....電容用15pF
不知道是不是沒有震盪起來....
造成輸出達到1.32kHz的PWM信號....
請教各位高手....
我的問題到底在哪???
還有怎樣才能達到60Hz的PWM信號輸出....

發表於: 2007/6/7 17:42
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... ]

教育訓練中心

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