Simple question about "Sound" command


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Simple question about "Sound" command

    I'm thinking this must be in a larger loop structure to keep returning to the routine.

    How about this as an idea only:

    Code:
    If Temperature > Temp_Up then           ' Above Target temperature
      PORTA.2=0                             ' Deactivate Warm output
      PORTA.3=1                             ' Activate   Cold Output
    SOUND PortA.7, [107,50]
    temp_up = temp_up +5                     'or 10 or whatever
    endif                                    'as long as reset elsewhere

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default Re: Simple question about "Sound" command

    You need a flag to remember that you've already sounded the alarm.

    Code:
    AlarmDone VAR BIT
    
    IF Temperature > TempUp THEN
      PortA.2 = 0
      PortA.3 = 1
      IF AlarmDone = 0 THEN          ' Only activate alarm if not already activated.
        SOUND PortA.7, [107, 50]
        AlarmDone = 1                   ' Alarm has been activated.
      ENDIF
    ELSE
      AlarmDone = 0                   ' Temperature is not over the limit, rearm the alarm.
    ENDIF

  3. #3
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Simple question about "Sound" command

    Thanks for reply !
    The second variant work verry fine. THANK YOU, Mr.Henrik ! As usual, You're a Great Gentleman !
    Last edited by fratello; - 10th July 2012 at 11:13.

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