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
Bookmarks