• 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: PWM不能動作
#2
管理員
管理員


查看用戶資訊
Hi ,

試試將 ECCPAS 暫存器的 bit 7 設為 0 看看吧 ! 它是 R/W bit , 而且當它為 1 時 , ECCP 會一直處於 Shutdown 的狀態 ( 如果 Auto Shutdown enabled ).

祝你順利 !

發表於: 2005/5/6 0:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PWM不能動作
#1
新會員
新會員


查看用戶資訊
//PIC18F1220
//全橋式輸出,INT0=0 then Autoshutdown
//檢查RB7還是INPIT
//ECCPASE 並未=1



IRCF0 = 1; // Used to set intrc speed to 8 MHz
IRCF1 = 1; // Used to set intrc speed to 8 MHz
IRCF2 = 1; // Used to set intrc speed to 8 MHz

TRISB = 0xff;
PR2 = 0x3F; // Sets PWM Period at 31.2 kHz
CCP1CON = 0b01001110; // Full bridge PWM forward,P1M0=1,
ECCPAS = 0b11001100; // INT0 pin low causes shutdown,Pins A/C=1,B/D=0
PWM1CON =0x0; // b7=0→clear ECCPASE ,b7=1→autorestart
TMR2IF = 0;
T2CON = 0; // TMR2 Off with no prescale
CCPR1L = 0x1F; // Sets Duty Cycle to
TMR2ON = 1; // Start Timer2
while(TMR2IF)
; // wait until TMR2 overflows(first period)

PORTA = 0;
TRISA = 0b00111111; // Set RA7 and RA6 as outputs
PORTB = 0;
TRISB = 0b00110011; // Set RB7,RB6,RB3,RB2 outputs
RBPU = 1; // RB pull up resister

ADCON0 = 1; // Use Vdd as Ref,Channel select AN0,ADON
ADCON1 = 0b11110000; // Configure AN0~AN3 as analog
ADCON2 = 0b10000101; // Right j


T0CS = 0; // Timer0 as timer not a counter
TMR0 = TMR0base; // Preload value
PSA = 0; // Prescaler to Timer0
T0PS0 = 0; // Prescale to 32 => 1024 Hz
T0PS1 = 0;
T0PS2 = 1;
INTCON = 0;
PIE1 = 0;
TMR0IE = 1; // Enable Timer0 int


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

教育訓練中心

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