• Malkyboy
In summary, the conversation is about creating a roaming 7-day alarm for college using a PLC program. The alarm must trigger a lamp after the input has been pressed 10 consecutive times in a 7-day period. The user has tried using various components such as timers, counters, and counter resets, but has not been successful. The solution suggested is to use 11 timer blocks, each with a 7-day timer, to keep track of the latest 10 input pulses. The input pulse counter should only count to 10 and the timer blocks should activate and reset each other in a cyclic manner.

## Homework Statement

Ive been asked to create a roaming 7 day alarm for college. This alarm must trigger a lamp (output), after the input, which i am using to simulate an alarm, has been pressed 10 consecutive times in a 7 day period. if it is pressed less than 10 timesin a week, then any alarm that is older than 7 days must not be counted, but all other alarms that are younger than 7 days kept.

I am using N/o, N/C contacts,as well as timers, (various types i.e. off delay, on pulse one shot etc) counters and counter resets and I am getting absolutly nowhere.

## Homework Equations

I am using the Zelio programme if anyone is aware of this.
I cannot use 7 day clocks or shift registers.

## The Attempt at a Solution

i have tried to use timers to trigger off by a pulse, then count for 7 days, and if another pulse come into trigger the next timer off, and so on for 10 timers, but i can seem to get it to work.

Ive been at this for at least 10 hours oveer a 3 day period now, and I am getting fustrated!

Any help would be much appreciated.

You need to know for each event how much time has passed since, or better how many time we have until expiry. This means as many counters.
You need a logic to find a unused counter, and count them.

However I would use a microcontroller for this type of task.
An ATtiny comes to mind. It is packaged in SOT23-6 . Yes, 6 legs.
Needs no extra circuitry for this task (other than a switch, the lamp, and e.g. a FET to drive the lamp).
And it is dirt cheap. I would guess cheaper than the circuitry you would need for implement the logic.

Last edited:
Do you have up/down counters and if not what is the maximum up count?

i have counters that can up count and down count, and also have resets for these(outputs).

I pretty much only know the theoretical basis of PLC and I surely do not know what you have already tried, but perhaps you are able to use parts of this idea:

Counting input pulses and turning on the output after 10 with a counter is easy. The tricky part is directing each input pulse to a separate timer that after 7 days will count the counter down. One idea could be to have a 11 of what we could call timer blocks.

Each timer block is associated with a logical 7 day timer (will come back to that) and one register bit indicating if the block is active. Each block has an input guard that only triggers if there is an input pulse and this block is inactive and the previous block is active, and as output it starts its 7-day timer and sets it active bit and resets the next timer block. The previous block for the first block should be the last block and the next block for the last block should be the first block so that the 11 blocks activate and reset each other in a cyclic manner. When the 7-day timer triggers, it result in count down of the event counter and a reset of this timer block. Initially all blocks are inactive and the first timer block should activate on the first input pulse, so you probably need some initialization or special bits to handle this situation.

Each block then has a 7-day timer that is build from a counter that, when the timer block is active, count pulses from a single shared timer (or a timer with one or more counters if you have low word length) that act as clock sending out pulses, say, every hour. The limit of the timer block counter is set to make it trigger after 7 days (i.e. count 168 if your clock pulse is one hour). The timer block counter is reset when the block is reset.

The idea of all that is to only remember the latest 10 input pulses and in case of "overflow" the latest pulse will just "overwrite" the 10th timer without making a count down of the counter. For this to work we also need to filter the input pulse counter to only count to 10 (it should only count up if alarm output is not on).

Please note, that this is just "loose thoughts" that, even if it would work in principle, most likely require a lot more details in order to work as you like. Or maybe it would never work or has some serious flaw and make your PLC blow up. You have been warned :)

Last edited:

## 1. What is relay ladder logic?

Relay ladder logic is a programming language used in the field of industrial automation to control and monitor the operation of electromechanical machinery. It is based on the concept of relay circuits, where different inputs and outputs are connected through a series of logical steps to control the operation of the machinery.

## 2. How does relay ladder logic work?

In relay ladder logic, a series of instructions are written in the form of ladder diagrams, consisting of horizontal rungs and vertical rails. These instructions are executed sequentially, one after the other, to control the functioning of the machinery. The inputs and outputs are connected through the rungs of the ladder, and the logical operations are performed using relays or other digital logic elements.