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


Browsing this Thread:   1 Anonymous Users






Re: Debug mode and Programmer mode output 結果不一樣
#6
新會員
新會員


查看用戶資訊
I found the problem already. It turns out the GND is not clean enough.

After I put it the GND to truly ground, it solves the problem in no time.

Thanks.

Jack

發表於: 2005/7/12 2:43
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: Debug mode and Programmer mode output 結果不一樣
#5
新會員
新會員


查看用戶資訊
以下是我的code, 我用的晶片是PIC18F452, 基本上如果把 code 分別用debug 和 programmer mode 在MPLAB 7.10 上 run 一下, 然後量一下 RC2 (PortC Pin 腳 2) 在這兩個 modes 下的PWM輸出,我就可以看到波形的不一樣。

我是用PWM 通過 LPF 的訊號去控制一顆 npn的基極電流, 電流沒有過載的問題,謝謝。



#include <pic18.h>

__CONFIG(1,HSPLL&OSCSDIS);
__CONFIG(2,BORDIS&PWRTEN&WDTDIS);
__CONFIG(3,CCP2RC1);
__CONFIG(4,DEBUGEN&LVPDIS);

#define UPDATE_H 254
#define UPDATE_L 12

interrupt void ISR( ){
TMR1IF=0; // clear interrupt
TMR1H=UPDATE_H;
TMR1L=UPDATE_L; // timeout after 500 Tcyc
GODONE=1; // start ADC
}
void main( ){


//Timer 1 Initialization -- See Above
TMR1H=UPDATE_H;
TMR1L=UPDATE_L; // timeout after 500 Tcyc
TMR1IE=1; // enable Timer 1 interrutps, otherwise when rollover, it can not update CCP1L value.
//Timer 2 Initialization
PR2=0b11111111; // max count for 0.82 millisecond period. This register set up the PWM period.
T2CON=0b00000100; // Postscale 1:1, Timer 2 on, Prescale 1:1
// Prescaler 1:1 for Fpwm = 19.53 KHz
// Prescaler 1:4 for Fpwm = 4.88 KHz
// Prescaler 1:16 for Fpwm = 1.2 KHz
TMR2IE=0; // disable Timer 2 interrupts
//CCP Initialization
CCP1CON=0b00001100; // Duty cycle low bits 00, PWM mode
CCPR1L=0; // Duty cycle 0%
TRISD=0x00;
TRISC2=0; // PWM out as output
CCP1IE=0; // Disable CCP1 interrupts

ADCON1=0b00101110;

ADCON0=0b10000001;

ADIE=0; // disable interrupt from ADC
//Enable Interrupts and turn on interrupt source
PEIE=1;
GIE=1;
TMR1ON=1; //Turn on 100us spaced interrupts
endless:

while(GODONE); // wait for conversion to be done
PORTD=ADRESH; // the variable is case-sensitive. Xk1 is not equal to xk1.
CCPR1L=ADRESH;
goto endless;
}



發表於: 2005/7/12 0:49
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: Debug mode and Programmer mode output 結果不一樣
#4
版主
版主


查看用戶資訊
1、把程式弄簡單一點,只控制PWM就好,看有沒有問題。如還是不行,就把程式放上來看看,大家參詳參詳。

2、有關於推動馬達的問題:PIC的I/O腳多只能SINCK/SOURCE 25mA。您有沒有OVER SPEC.在用啊!

發表於: 2005/7/8 9:29
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: Debug mode and Programmer mode output 結果不一樣
#3
新會員
新會員


查看用戶資訊
CCP1CON=0b00001100; // Duty cycle low bits 00, PWM mode
TRISC2=0; // PWM out as output
ADCON1=0b00101110;
ADCON0=0b10000001;

以上是我的設定,只有在AN0 腳的地方是 analog input, 其它都是 digital mode. 但是我還是看不出問題在哪?

請指教,謝謝。

發表於: 2005/7/8 2:46
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: Debug mode and Programmer mode output 結果不一樣
#2
版主
版主


查看用戶資訊
在debug模式底下,MPLAB會把某些ANALOG 腳(以及COMPARATOR 腳)自動幫您設為DIGITAL MODE,以便ICD能正常運行。

但是在PROGRAMMER MODE時,MPLAB不會做這個修正。

建議查一下相關腳位是否設為DIGITAL MODE。

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


Debug mode and Programmer mode output 結果不一樣
#1
新會員
新會員


查看用戶資訊
我現在用一顆 PIC18F452 PICmicro 做 PWM 控制,不知為何在debug mode 下看到的 PWM output 是正確的 (漂亮的方波),但是等我用 programmer mode program chip 後,output 卻是不正確的 ( 怪怪的波形) 。

而且在接有 ICD-2 的情況下,Vdd 腳輸出的電壓才夠。如果沒接 ICD-2, Vdd 就不夠力去驅動馬達。

請指教~ 謝謝

Jack

發表於: 2005/7/3 3:48
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... ]

教育訓練中心

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