Re: DSpic33FJ256GP710 PWM問題(新)
|
||||
---|---|---|---|---|
資深會員
|
C30的部分,曾百由老師有出相關的書。可以去看看。
不過我是覺得這本寫的比較好。 電子制御・信号処理のための dsPIC活用ガイドブック 後閑 哲也 (著)
發表於: 2008/8/3 20:07
|
|||
不要問我哪裡來,我只是個流浪天涯的工程師
|
||||
|
Re: DSpic33FJ256GP710 PWM問題(新)
|
||||
---|---|---|---|---|
新會員
|
我的板子用的是C30 可是你推薦的課程是C18,他們差異不大嗎?
發表於: 2008/8/3 17:32
|
|||
|
Re: DSpic33FJ256GP710 PWM問題(新)
|
||||
---|---|---|---|---|
版主
|
到 Microchip 上 W401 C18 的基礎課程。右邊教育訓練有上課資料。
發表於: 2008/8/1 9:48
|
|||
|
Re: DSpic33FJ256GP710 PWM問題(新)
|
||||
---|---|---|---|---|
新會員
|
小的知了~先去研究c
發表於: 2008/7/31 0:29
|
|||
|
Re: DSpic33FJ256GP710 PWM問題(新)
|
||||
---|---|---|---|---|
資深會員
|
參照:
這不叫「c的基礎很糟糕」,而是完全不懂C語言。 隨便找本C語言入門書看一下。很多基本功得靠你自己去學。 若連一個C語言該有的基礎都不知道,其他人也很難幫到你....
發表於: 2008/7/30 21:36
|
|||
不要問我哪裡來,我只是個流浪天涯的工程師
|
||||
|
Re: DSpic33FJ256GP710 PWM問題(新)
|
||||
---|---|---|---|---|
新會員
|
可以說詳細一點嗎.....我c的基礎很糟糕..麻煩你了!!
發表於: 2008/7/30 21:21
|
|||
|
Re: DSpic33FJ256GP710 PWM問題(新)
|
||||
---|---|---|---|---|
版主
|
C 程式裡沒有 main( ) 函數叫啟動模組 crt0.o 去哪裡開始執行?
發表於: 2008/7/30 8:00
|
|||
|
DSpic33FJ256GP710 PWM問題(新)
|
||||
---|---|---|---|---|
新會員
|
以下是我PWM Output Compare的程式:請各位幫我看看哪有問題,小弟剛摸不久,所以問題可能有點蠢!我是按照他當初給的範例程式去模仿需要加入的部份(.c .h .gld),所以可能整體上會有問題,output compare 是參照講義貼上來的,後面都有說明
主程式:main.c #include "p33FJ256GP710.h" Init_pwm(); 副程式:pwm.c void Init_pwm(void) OC1CONbits.OCM = 0b000; // Turn off Output Compare 1 Module OC1R = 0x0026; // Initialize Compare Register1 with 0x0026 OC1RS = 0x0026; // Initialize Secondary Compare Register1 with 0x0026 OC1CONbits.OCM = 0b110; // Load new compare mode to OC1CON PR2 = 0x004C; // Initialize PR2 with 0x004C IPC1bits.T2IP = 1; // Setup Output Compare 1 interrupt for IFS0bits.T2IF = 0; // Clear Output Compare 1 interrupt flag IEC0bits.T2IE = 1; // Enable Output Compare 1 interrupts T2CONbits.TON = 1; // Start Timer2 with assumed settings // Example code for Timer2 ISR: void __attribute__ ((__interrupt__)) _T2Interrupt(void) { IFS0bits.T2IF = 0; } 另外還加入p33FJ256GP710.h 及 p33FJ256GP710.gld 但是我去build 都是Build Failed 以下是我Build的訊息: Clean: Deleting intermediary and output files. Clean: Deleted file "C:\test\main_rtc.o". Clean: Deleted file "C:\test\pwm.o". Clean: Done. Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=33FJ256GP710 -x c -c "main_rtc.c" -o"main_rtc.o" -g -Wall main_rtc.c:48: warning: type defaults to 'int' in declaration of 'Init_pwm' main_rtc.c:48: warning: data definition has no type or storage class Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=33FJ256GP710 -x c -c "pwm.c" -o"pwm.o" -g -Wall pwm.c: In function '_T2Interrupt': pwm.c:63: warning: PSV model not specified for '_T2Interrupt'; assuming 'auto_psv' this may affect latency Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=33FJ256GP710 "main_rtc.o" "pwm.o" -o"pwm.cof" -Wl,-L"C:\Program Files\Microchip\MPLAB C30\lib",--script="C:\test\p33FJ256GP710.gld",-Map="pwm.map",--report-mem Program Memory Usage section address length (PC units) length (bytes) (dec) ------- ------- ----------------- -------------------- .reset 0 0x4 0x6 (6) .ivt 0x4 0xfc 0x17a (378) .aivt 0x104 0xfc 0x17a (378) .text 0x200 0xce 0x135 (309) .dinit 0x2ce 0x2 0x3 (3) .isr 0x2d0 0x2 0x3 (3) Total program memory used (bytes): 0x435 (1077) <1% Data Memory Usage section address alignment gaps total length (dec) ------- ------- -------------- ------------------- Total data memory used (bytes): 0 (0) Dynamic Memory Usage region address maximum length (dec) ------ ------- --------------------- heap 0 0 (0) stack 0x800 0x7800 (30720) Maximum dynamic memory (bytes): 0x7800 (30720) c:/program files/microchip/mplab c30/bin/../lib\libpic30-coff.a(crt0.o)(.init+0xc):../support/inc/p30f2010.inc: undefined reference to `main' c:/program files/microchip/mplab c30/bin/../lib\libpic30-coff.a(crt0.o)(.init+0xe):../support/inc/p30f2010.inc: undefined reference to `main' Link step failed. BUILD FAILED: Tue Jul 29 21:22:33 2008 以上就是我Build失敗的訊息,小弟在這邊感謝你看完這麼一大堆的訊息 最後我附上我PWM程式!! Attach file: Link only for registered users
發表於: 2008/7/30 0:40
|
|||
|