SOUND command not working


Closed Thread
Results 1 to 4 of 4
  1. #1
    RUBiksCUbe's Avatar
    RUBiksCUbe Guest

    Default SOUND command not working

    I'm trying to generate a tone whenever a specific event occurs using the code:
    Code:
    SOUND PortA.1, [127, 255]
    I have tried this code with both a speaker (with and without 22 uf capacitor) and two different piezo-speakers and neither has produced a tone. When I run the program I hear a "click" coming from the speaker, but then silence. I have changed the code for this program to:
    Code:
    main:
    sound PortA.1, [127, 255]
    goto main
    But I still only hear a click. I have defined OSC as 20 (PIC 18F252) but still nothing is generating a tone. I even tried:
    Code:
    main:
    high PortA.1
    pauseus 30
    low PortA.1
    pauseus 30
    goto main
    But that also made a clicking noise, no tone. Shouldn't this work?

  2. #2
    MikeTamu's Avatar
    MikeTamu Guest


    Did you find this post helpful? Yes | No

    Default

    Are you sending the signal to an amplifier before it gets to the speaker? If not, what type of speaker do you have?

  3. #3
    Join Date
    Sep 2005
    Location
    Dayton, Ohio
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    1. Make sure PortA is configured as Digital I/O. The sound command will not work if it's configured as AtoD inputs.

    2. Try another frequency, 127 is the highest (10KHz). Try something lower.

    3. Try another pin on another Port (PortB maybe).

    4. Test the speaker(s) by putting another sound trough them (like a radio). Just to make SURE they work.

    Jim
    Jim Robertson
    "MilesTag" DIY Lasertag
    www.lasertagparts.com/mtdesign.htm
    Dayton, Ohio

  4. #4
    RUBiksCUbe's Avatar
    RUBiksCUbe Guest


    Did you find this post helpful? Yes | No

    Default

    I think I figured it out. I was sending inaudible stuff. The frequency was way to high. I changed the pauseus to 500 and got a nice tone.

Similar Threads

  1. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 06:28
  2. SOUND makes LCD quit working
    By jderson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th April 2008, 14:12
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. Sound and sound control with minimal parts
    By bartman in forum General
    Replies: 23
    Last Post: - 18th January 2005, 14:08
  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 : 1

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