# loacting file I lost??

Status
Not open for further replies.

#### MrDEB

##### Well-Known Member
last week I downloaded a simple prg that determines the componets/code to program a pic to generate different notes or frequencies
BUT I don't know where I put it or the name of the file.
I have the code that mike posted but this little program determines what the output frequency will be?
anyone recall such a program??
still playing with that deer chaser but going with a PIC

#### blueroomelectronics

##### Well-Known Member
Can you post the program or link?

#### be80be

##### Well-Known Member
It didn't get any easier then what I posted for you all you had to do is set the part that said 5000 to what ever you wanted That's sets output frequency to 5000khz Your looking for the pwm.bas

Last edited:

#### blueroomelectronics

##### Well-Known Member
Oh the pwm calc. There is also one on the Swordfish wiki page

#### 3v0

##### Coop Build Coordinator
Forum Supporter
Not exactly what you are looking for but
Google for PIC and "ring tones". You may
find it of interest.

#### be80be

##### Well-Known Member
Mrdeb That pwm2 module sets up a little harder then the first pwm module You have set
a lot more values with it. but you get this
Added support for 2 PWM outputs

#### MrDEB

##### Well-Known Member
thanks be80be

thats the one I was looking for
my plan is to intergrate the code you posted for me and add the info from the pwm cacl you just posted.
thanks again
noe I plan on ordering some parts from Mouser but which pic?
thinking to make it easier to understand just order some 18f1320's
only $3.45 each or was it$3.85??
along with some breadboard wires and an 8 ohm speaker or the piezo tweeters?

#### blueroomelectronics

##### Well-Known Member
The 18F1320 is a very handy PIC, I'd get a couple of spares. If you want to get into LED matrix's too then something with more pins. A 18F4620 is a big & powerful 40pin PDIP a good part to keep on hand for the big projects.
I'd stay away from any 8pin PICs till you get the hang of ASM, C, or PICBASIC Pro (supports 16F but not free) and all are much less user friendly than Swordfish.

Also any cheap; powered computer speaker should be easy to connect to the PWM output and louder than a small piezoelectric squeaker. Your local Goodwill probably has a few.

#### be80be

##### Well-Known Member
What i drawled you put out 3.125 Watts But it's not that loud I tried it today
could hardly hear it..

Last edited:

#### be80be

##### Well-Known Member
MrDEB This makes some sound you may run them deer off with this just hook the speaker
up like i show you before it's loud.

Code:
Device = 18F1320
Clock = 8 // tells the compiler the FOSC speed
Config OSC = INTIO2, WDT = OFF, LVP = OFF
Include "Utils.bas"
Dim out As PORTB.3
OSCCON = %01111111
SetAllDigital

Low (PORTB.3)
While true
high (portb.3)
DelayUS (700)   // justs change this to change sound
Low (PORTB.3)
delayus (700)  // and this to
Wend
Experiment PIC16F628: Lab4: Sound Melody : Electronics-Microcontroller.Com

#### be80be

##### Well-Known Member
This sounds like the telephone off the hook
Code:
 Low (PORTB.3)
While true
high (portb.3)
DelayUS (1300)   // justs change this to change sound
Low (PORTB.3)
delayus (1300)  // and this to
high (portb.3)
DelayUS (1200)   // justs change this to change sound
Low (PORTB.3)
delayus (1200)  // and this to
high (portb.3)
DelayUS (1100)   // justs change this to change sound
Low (PORTB.3)
delayus (1100)  // and this to
high (portb.3)
DelayUS (1000)   // justs change this to change sound
Low (PORTB.3)
delayus (1000)  // and this to
high (portb.3)
DelayUS (1100)   // justs change this to change sound
Low (PORTB.3)
delayus (1100)  // and this to
high (portb.3)
DelayUS (1200)   // justs change this to change sound
Low (PORTB.3)
delayus (1200)  // and this to
high (portb.3)
DelayUS (1300)   // justs change this to change sound
Low (PORTB.3)
delayus (1300)  // and this to
Wend

#### be80be

##### Well-Known Member
By playing with it like this you get some real good sounds
keep the speaker on longer and off less
Code:
 Low (PORTB.3)
While true
High (PORTB.3)
DelayUS (1600)   // justs change this to change sound
Low (PORTB.3)
DelayUS (700)  // and this to

Wend

Status
Not open for further replies.