• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users






訪客
PIC16F1829 蜂鳴器無法正常輸出聲音
#1
各位大大好:

近期因為剛碰PIC16F1829這顆MCU,我嘗試設定將RC3作為PWM輸出,但目前設置後發現Buzzer僅發出斷斷續續的雜音。

void buzzer(void){ //RC3

TRISCbits.TRISC3 =0; //output
ANSELCbits.ANSC3 = 0;
CCP2CONbits.P2M=01;
CCP2CONbits.CCP2M = 0b0000;
CCP2CONbits.DC2B = 01;
CCPTMRSbits.C2TSEL = 00;
PIR1bits.TMR2IF = 0;
T2CONbits.T2CKPS = 00;
T2CONbits.TMR2ON =1;
T2CONbits.T2OUTPS = 0b1111;
TRISCbits.TRISC3 =0; //output
ANSELCbits.ANSC3 = 0;
APFCON1bits.CCP2SEL = 0;
APFCON1bits.P1CSEL = 0;

PIE2bits.CCP2IE = 0;
PIR2bits.CCP2IF = 0;

}

Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC16F1829 蜂鳴器無法正常輸出聲音
#2
版主
版主


查看用戶資訊
蜂鳴器有兩種,一個是給電壓就會叫的,另一種是要送 2.4KHz 頻率的 。 請問你的蜂鳴器是那一種?

要花一些時間去對一下你的暫存器設定是否正確? Config. Words 的設定也很重要,有設定道嗎?

建議用 MCC 來設定周邊簡單又方便。

發表於: 2020/6/8 13:27
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... ]

教育訓練中心

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