Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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 think I downloaded from the swordfish site?
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
but I need to learn more about these little buggers
 
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:
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
Added FreqSetByTable() function
 
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?
 
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.
 
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:
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
Here some good reading about making sound with a pic
Experiment PIC16F628: Lab4: Sound Melody : Electronics-Microcontroller.Com
 
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
 
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.

Latest threads

New Articles From Microcontroller Tips

Back
Top