View previous topic :: View next topic |
Author |
Message |
McGregor Guest
|
Sounds Generation . |
Posted: Tue Feb 04, 2003 9:18 am |
|
|
Hi All !
I am just starting use CCS C Compiler and i took
a look samples routines.
Does anybody have some idea to generate sounds
using it?
I am developing a baterry charger using switched
in high frequency rectifier and i'd like to put some beeps
alarms with it .
Any idea will be very appreciated and will be my pleasure to show in here the complete program for discussion.
Thnx !
___________________________
This message was ported from CCS's old forum
Original Post ID: 11267 |
|
|
Shane Rowell Guest
|
Re: Sounds Generation . |
Posted: Tue Feb 04, 2003 10:38 am |
|
|
If you look at the ex_tones.c and tones.c files you will find one way to implement sound. These two files are used to play the Happy Birthday song. Just before Christmas I programmed a 16F877, attached a piezo (no built in oscillator), and was listening to an old favorite.
You can also use one of the PWM outputs and play with the period and duty if you just want to find a sutable tone for an alarm.
Good luck,
Shane
:=
:= Hi All !
:=
:= I am just starting use CCS C Compiler and i took
:=a look samples routines.
:= Does anybody have some idea to generate sounds
:= using it?
:= I am developing a baterry charger using switched
:= in high frequency rectifier and i'd like to put some beeps
:= alarms with it .
:= Any idea will be very appreciated and will be my pleasure to show in here the complete program for discussion.
:=
:= Thnx !
___________________________
This message was ported from CCS's old forum
Original Post ID: 11269 |
|
|
Harold
Joined: 16 Feb 2004 Posts: 1
|
Re: Sounds Generation . |
Posted: Mon Feb 16, 2004 9:05 am |
|
|
[quote="Shane Rowell"]
<<I programmed a 16F877, attached a piezo (no built in oscillator), and was listening to an old favorite. You can also use one of the PWM outputs ..
Where did you attach the piezo speaker? Ex_tones.c says:
Connect the positive wire of the speaker to pin 47 (B0)
Connect the negative wire of the speaker to pin 27 (Gnd)
On my just purchased 16F877a prototype board, I see no such pin in the terminal block or elsewhere.
Thanks |
|
|
smrowell
Joined: 16 Feb 2004 Posts: 3
|
|
Posted: Mon Feb 16, 2004 6:29 pm |
|
|
I just used a 16F877 in a 40 pin dip package on a breadboard with a 40MHz clock. Pin B0 is the lowest bit of Port B.
If you read the code you can change which pins are used. I do not recommend using this for anything other than playing around. if you want to make a product sound, add a driver transistor for the piezo.
Shane |
|
|
neil
Joined: 08 Sep 2003 Posts: 128
|
40MHz?! |
Posted: Tue Feb 17, 2004 5:49 am |
|
|
A 16F877 at 40MHz? Are you sure? They are only supposed to operate at 20 max! Did you mean 4MHz? |
|
|
smrowell
Joined: 16 Feb 2004 Posts: 3
|
|
Posted: Tue Feb 17, 2004 9:55 am |
|
|
Thanks Neil,
Sorry, it should say 20MHz. So many parts, so many speeds.
Shane |
|
|
|