how building sound tone and runing other instructions in background


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: how building sound tone and runing other instructions in background

    I think there are several methods you ay use.

    You could have an interrupt routine that beeps for a short time, repeatedly. In the interrupt set a flag that increments with each very short beep until it has been on long enough then, disable the interrupt. Pseudo code:


    INTERRUPT:

    Flag = flag + 1
    Make short beep
    if flag = 100 then flag = 0 and turn off interrupt

    Main:
    If error then turn on interrupt
    code
    code
    goto Main

    Or, as an alternative, you could make or buy a buzzer module. When you need noise, turn it on with a single pin, when you don't - turn it off same way.

    Or, as you suggest your PWM pin is free, wire up the buzzer there. As PWM runs independently of code...
    Last edited by Amoque; - 15th January 2016 at 12:26.

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