Browsing this Thread:
1 Anonymous Users
訪客
|
PIC16F1829 蜂鳴器無法正常輸出聲音
|
|
各位大大好:
近期因為剛碰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; }
|
|
|
Re: PIC16F1829 蜂鳴器無法正常輸出聲音
|
|
版主
Joined
: 2004/4/30 10:53 最後登入時間
: 2021/11/30 18:11
From CAE, Microchip
Group:
站務管理者 註冊會員
Level : 75 HP : 744 / 1861 MP : 5367 / 108732 EXP : 45
|
蜂鳴器有兩種,一個是給電壓就會叫的,另一種是要送 2.4KHz 頻率的 。 請問你的蜂鳴器是那一種?
要花一些時間去對一下你的暫存器設定是否正確? Config. Words 的設定也很重要,有設定道嗎?
建議用 MCC 來設定周邊簡單又方便。
發表於: 2020/6/8 13:27
|
|
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.