Help w/ speaker for 16F690 and SOUND command


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Posts
    6

    Default Help w/ speaker for 16F690 and SOUND command

    I'm just trying to test the SOUND command with a 16F690. Unfortunately, I'm not getting any sound, but I'm pretty sure it's not on the sofware side of things, but the hardware side. The PICBASIC compiler manual shows a capacitor in series with a speaker. I input an alternating tone with the sound command where it should alternate tone/silence/tone/silence and I hear a faint "clicking" sound so I think it's trying to work.

    Does anyone have experience with more specifics as to the speaker/capacitor arrangement that would work.

    I also tried to directly drive a piezo element I had in an old parts bin, but that didn't work either.

    TIA

    Brad

  2. #2
    Join Date
    Aug 2008
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Have you connected the polarity of the speaker correctly?
    What do you see on that pin using oscilloscope?
    Make sure you have disable analog pin and chg it to digital output (if applicable).

  3. #3
    Join Date
    Feb 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Good thoughts, but speaker is connected correctly. Pin is outputting. I can see activity on an LED, but I don't have a scope to be able to verify that the output is oscillating at some frequency. My old HP scope died a couple years ago and I never had a need to replace it.

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    It will not work without the capacitor. The book says and I concur 10µf.
    Last edited by Archangel; - 14th March 2009 at 04:43.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Code:
    sound portB.6, [120,20]
    keep first number below 125, second number is duration. If you are using the Microchip low pin count demo board, be advised the black plastic header does not necessarily go to the pins they appear to.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Feb 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    I removed the sound command from my main program just so I could focus on that. The only line of code I have now is:

    sound portc.0, [100,100]

    the LED tied to portc.0 lights up, but all I get is an initial click from the speaker. I've tried 6-10 different capacitors and that doesn't help either.

    Anyone have any other thoughts? I've tried changing the tone from 1 to 127 and no change. When I use one of the "white noise" tones, say 157, then I do see the LED flicker and the speaker crackles with the LED flicker.

    I wish I had a scope, but I don't.

    Any other thoughts?

Similar Threads

  1. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  2. Replies: 4
    Last Post: - 10th November 2006, 07:37
  3. SOUND command not working
    By RUBiksCUbe in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th December 2005, 22:41
  4. question about SOUND command
    By bartman in forum General
    Replies: 7
    Last Post: - 1st December 2005, 13:50
  5. Re: quick fix for sound command?
    By Melanie in forum Code Examples
    Replies: 0
    Last Post: - 9th July 2004, 01:44

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts