it seems you have to amplify the out put of PIC.
Below cricuit is very easy to build. tryout it. I'm unable to covert this ASM code to C, because I'm busy with my studies.
[ Post made via Mobile Device ]

You must be using a type with less sound. Try to find a piezo speaker similar to the one in the following image. This one is very loud and I'm trying to find a way to reduce the volumeSound of the Piezo speaker is very low
Have you any tutorial, to play wav files using PIC16F84A?SukhdeepMankoo wrote:I suggest you to play wave file on pic using PWM. where you can have music whatever you want to play.It is really good to start wave file player using microcontroller.
Do you have any code and cricuit for that if you have send me pleaseI suggest you to play wave file on pic using PWM. where you can have music whatever you want to play.It is really good to start wave file player using microcontroller.
Sukhdeep, though PWM is a piece of cake for you, it could be a little difficult for noviceI suggest you to play wave file on pic using PWM. where you can have music whatever you want to play.It is really good to start wave file player using microcontroller.
Code: Select all
// frequency table: periods in thousands of ms
#define NFREQ 7
const unsigned char t_period[NFREQ] = {132, 148, 165, 176, 198, 220, 247};
// s - Index of the sound in frequency table
// d - Duration of the sound in numbers of periods
// t - Duration of silence after the sound (to be multiplied by 10 ms)
void playSound (unsigned char s, unsigned char d, unsigned char t){
unsigned char i, t1;
t1 = t_period[s];
for (i = 0; i < d; i++){
RB0 ^= 1; // Toggle 1 and 0
Delay_us(t1);
}
// Turn loudspeaker off
RB0 = 0;
// Do the silence (if needed)
for (i = 0; i < t; i++){
delay10ms();
}
}
I m using HiTECH C compiler. i have one PIC 16F688 in spare so i m trying to generate sound through this pic. In 16F688 PWM is not present. and for that generating sound is low and not that extend i can use for doorbell.deepak, What's the C++ compiler you use for PIC?
By grounding one side of the speaker and a little change to code that operates on RB0, RB1, RB2 and RB3, I think you would be able to get your code working.