Rab asked:
In a Multi Tracking program with 4 Tasks and each task has the ability to turn on a (common) siren if in a trouble situation.How can I disable the siren output for a period (say 20 min) from a input and have the siren reset and be ready to operate again after the 20 minute period?
Rab,
The problem here is that you have allowed 4 different tasks to "own" the siren, so control of the siren resource has become diffuse and hard to manage.
Try making a separate task to control the siren. It receives requests from it's "clients" (the 4 existing tasks) when they want an alert. The requests can be in the form of semaphores. The siren task then looks at the requests plus the inhibit input and decides what to do.
By doing this you will have separated the two aspects of the problem:
- Deciding that an alarm condition exists, and
- Sounding or muting the siren
