+ Reply to Thread
Results 1 to 6 of 6

Thread: Sound/Sound2 with no delay

  1. #1

    Default Sound/Sound2 with no delay

    Hi everyone.

    Hi, its great to see you visiting our forum. Why not try Proton Compiler for FREE?

    Download the FREE version of Proton Compiler, Its called Amicus18 and its available from HERE

    Already using proton Compiler??? Get rid of these pesky messages... get LICENSED USER STATUS




    I have a Buzzer connected to a CCP2 pin on a PIC.

    Currently i am using a standard "Sound" command to make it speak. But my problem is that the main program pauses every time a sound is made.

    Can i generate the same sound by using hardware features of the Controller? Something like HPWM ?


  2. If you're a Licensed user of PROTON DEVELOPMENT SUITE, apply for Licensed User Status to remove these pesky messages
     and get access to additional forum areas, Beta test downloads and more!

  3. #2


    Default Re: Sound/Sound2 with no delay

    Of course, hpwm very good for sound generation. But depends on sound content.

    if you want to play human voices, you need least 7-8kbytes per second

    Or you need simple alarm siren sound simple loop enough

  4. #3


    Default Re: Sound/Sound2 with no delay

    I am generating just an alarm so its a simple Loop. Thank you for the advice. I appreciate it.

  5. #4
    Licensed User Tim's Avatar
    Join Date
    Jan 2003
    Location
    london
    Posts
    6,950


    Default Re: Sound/Sound2 with no delay

    1 look up the peek freq sound output
    2 Use on of the tools around to work out the PWM settings for that freq I have used this site http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html
    3
    Select another freq with a good amplitude for the device
    4 toggle the freq as desired to get a 2 tone effect
    Tim

  6. #5


    Default Re: Sound/Sound2 with no delay

    Tnx Tim. Appreciate the info.

  7. #6


    Default Re: Sound/Sound2 with no delay

    My Buzzer is connected to CCP4 on the 18F8722 PIC at 40 MHz

    As i understand, HPWM does not support Channels 3 - 5 so i must enter the registers manually. I have checked the calculator and it was very useful however, i was using the "Sound" command and was producing several sound to create a tone.

    Is is possible for someone to help out with the formula on calculating the actual PR4 and CCPR4L values? My current configuration is as follows:

    Code:
     'CCP4 PWM (Buzzer) Declares
                Dim CCP4_Duty As byte 
                symbol CCP4_Period = PR4 
                    CCP4_Duty = 124
                    CCPR4l = CCP4_Duty
                    ccp4_period = 62
                clear trisg.3
                CCP4CON = %00011100                 'Set CCP4 for PWM Mode           
                T3CON.6 = 1                         'Timer3 and Timer4 are the clock sources for ECCP1, ECCP2, ECCP3, CCP4 and CCP5
                T3CON.3 = 1
                t3con.0 = 1
                T4CON = %00000111                   'Timer4 Prescaler 1:16, Timer ON
    For example i have the following command:

    Code:
    Sound Buzzer, [100,10,120,10]
    Based on the Calculator the values for tone "120" (Approx 9000 - 8000KHz) the values would be :

    PR4: 68
    CCPR4L & 2 bits from CCP4CON : 10001001 (137)

    But what formula is used to calculate these values?

+ Reply to Thread

Similar Threads

  1. Timers and Sound
    By pic-ignorant in forum The Lounge
    Replies: 6
    Last Post: 13th June 2010, 04:03
  2. SD to sound
    By Tim in forum The Lounge
    Replies: 5
    Last Post: 20th August 2009, 18:53
  3. PIC sound
    By robbertbd in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 21st February 2008, 19:17
  4. Sound command
    By garysw in forum The Lounge
    Replies: 2
    Last Post: 17th August 2005, 19:29
  5. TV sound
    By Richard in forum The Lounge
    Replies: 4
    Last Post: 20th July 2004, 18:06

Members who have read this thread since 7th March 2012, 09:38 : 4

Actions :  (Set Date)  (Clear Date)

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