Help with Microcontroller Technology Project

Status
Not open for further replies.

arsenal_wth

New Member
I'm doing a research on buzzer and I have some questions to ask to clear my doubts.

1) How to generate a beep sound on the buzzer?

2) How to generate a tone of certain frequency (using C program statements)?

3) How to generate a tone of certain frequency continuously for a certain duration (using C program statements)?

4) How to generate different frequency tones (using C program statements)?

5) Which port to connect the buzzer to on the PIC18f4520 (using the images attached below)?

Below are the schematic diagram for my buzzer and PIC18f4520 port.

**broken link removed**

**broken link removed**

Your help is appreciated.
 
1.) By continously bit-toggling a port. Use Timers in Interrupt if possible.

2.) For example, to generate a 2000Hz frequency, you need to get the High time which is 0.25ms and Low time which is 0.25ms, for one period. Use a calculator, a pencil and a paper too.

3.) Again, use delays here, or timer, example, a 256Hz note played for 0.5 seconds.

4.) Refer to (2).

5.) Any Ports from Port A to the last port as long as it's a digital (A/D not enabled) and its tri-state registers are set to outputs.
 
I do not understand your connection to the speaker. What is the idea here. Perhaps I am not looking at it the right way.
 
1) How to generate a beep sound on the buzzer?

2) How to generate a tone of certain frequency (using C program statements)?

3) How to generate a tone of certain frequency continuously for a certain duration (using C program statements)?

4) How to generate different frequency tones (using C program statements)?

5) Which port to connect the buzzer to on the PIC18f4520 (using the images attached below)?

Below are the schematic diagram for my buzzer and PIC18f4520 port.

Hi,

For Question 2 to 4 , you may consider about pwm as it can do as what littletransistor said.Check out how to do PWM and implement it into your buzzer.

For your doubt, What little transistor mean is , you can use any PORT to do the connection (refer back to your datasheet) as long as it's not a A/D pin enable..which A/D pin enable it not treated as a digital (high or low) pin anymore.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…