Timer question

Mikeyboi

Member
Join Date
Feb 2021
Location
Canada
Posts
2
I'm trying to program an output to go true immediately when I hold a maintained pushbutton but only go true for a scan then go false for 5 seconds then go true. This is to repeat until the pushbutton is depressed.
 
I'm trying to program an output to go true immediately when I hold a maintained pushbutton but only go true for a scan then go false for 5 seconds then go true. This is to repeat until the pushbutton is depressed.


Which PLC are you using? Ladder Logic? And the last part should be 'repeats until the pushbutton is released'?


Rockwell example



Comment - if input is on, and timer is not timing, turn on output

XIC input XIO timer.tt OTE output


Comment - if input is on and the timer is not done, run timer. Timer runs for 5 seconds, so it turns off the output in the rung above since it is timing for that 5 seconds. When the timer is done, the timing bit goes off so the output turns on for 1 scan, then the cycle repeats

XIC input XIO timer.dn TON timer 5sec 0



If this is an assignment, I hope you are not planning on a career in controls. I only learn by doing .. and the only way I learn is to try different stuff until I figure out how things behave ... but that's just my learning process. YMMV
 
Last edited:
That's what the ONS (one Shot ) is for
input button - ONS - output tag
the output tag will only be true for 1 program scan while the input button is held on
or you could write you own but why
 
Your description of the assignment isn't clear. Perhaps you could explain what you mean by "hold a maintained pushbutton" and when you release that pushbutton so that by depressing it again the output can stop being true for one scan every five seconds.
And while you're at it, what have you tried so far?
 
Here is one of many ways of creating a pulse every 5 seconds, there are many ways
When the button is pressed to on position a pulse is produced for one scan.
The button also drives a turn on timer, after 5 seconds the timer Q bit is true, on the next scan the NOT timer bit releases the pulse condition true ready for next scan, and also resets the timer enable ready for a true i.e. the push button.
This is a way of using the PLC scan to switch things on & off.
Before other posters go on about well it is not truly 5 seconds, does it matter, yes it will be 5 seconds plus at least one scan of the PLC and of course the timer accuracy Just saying.......

One Scan_ 5 Secs.png
 
I'm with @SteveB: e-reading the OP, it says "hold a maintained pushbutton" and "until the pushbutton is depressed."


I find this confusing: a maintained pushbutton (PB) changes (toggles) it's output each time it is actuated. However, the term "hold" suggests a momentary pushbutton.


I assume "hold" means "hold in," and holding a maintained PB is redundant because its output state has already changed and will not change again until the PB is released and actuated again; so hold should only refer to a momentary PB.


The term "is depressed" is also confusing, as in "repeat until the pushbutton is depressed:": if the button is being held (in), then it is already depressed, so how can it be depressed again?



Which is it?




Anyway, whichever way it is, @GaryS and @parky provided the answer: whenever the repeat is supposed to be running, use one-shot a.k.a. pulse logic.
 
Last edited:
That's what I thought, but in any case, hold it in or press again to release same scenario, however, as it was not clear the OP could mean toggle in that case would need toggle logic for it to work,
 
That's what I thought, but in any case, hold it in or press again to release same scenario, however, as it was not clear the OP could mean toggle in that case would need toggle logic for it to work,




Exactly.


BTW, sweet rungs! I fiddled with various schemes to get the one-shot output but nothing came out as clean as yours. Is that Mitsi? And Mitsi's PLS instruction does not require the coder to provide a storage bit, but provides its own internal storage with each PLS instantiation? Doubly sweet.
 
Yes Mitsubishi and Siemens have them, In Mitsubishi they have many instructions that are pulse driven for example move (movP), Equals (EQP)
I think there are probably 150 instructions that are duplicated i.e. with a suffix P for one shot operation.
And all digital bits can have a pulse high & pulse low including I/O.
 
Last edited:
I'm trying to program an output to go true immediately when I hold a maintained pushbutton but only go true for a scan then go false for 5 seconds then go true. This is to repeat until the pushbutton is depressed.

The question is a bit "dated", in a way nobody else has pointed out yet. "...for a scan..." . Does that mean a scan of the logic, or a 'scan' of the inputs or outputs....'cause it makes a difference.
 
If the "output" mentioned in the assignment is a real-world output it makes no sense to turn it on for a single scan, regardless of whether a program scan or an I/O scan. A single scan generally isn't long enough for a reliable response.
 
Lets answer some of these questions:
DR: I was only on about Mitsubishi having over 150 pulsed functions, Siemens only has a bit pulse function as far as I can remember.
Scan of logic or scan of PLC in many PLC platforms updating I/O is normally synchronous unless programmed otherwise, not everybody uses AB. In actual fact I did use the scan for one pulse between two PLC's for a type of digital communications (using constant scan mode of 100ms).
As for an output the OP has already used poor wording so an output could be an internal bit (although I agree not likely).
 

Similar Topics

I have some logic that I have written within a 5380 series controller that tracks the time an event is started, while the event is running an RTO...
Replies
2
Views
81
Hi all, I have a simple question that I have overcomplicated and gotten stuck on. I have a variable, we can call it "light" that I need to stay...
Replies
4
Views
305
Hi, I've been lurking for about a month now and via the search, I've been able to string together a basic micro820/PV800 project. I've got a...
Replies
10
Views
3,067
I added T4:50 to delay the OTE from coming on, but the customer only wants T4:50 to delay the OTE every 12 hours. I am a beginner and can't...
Replies
11
Views
2,791
Hello guys, I am currently looking through some examples of how timers work, but this ladder logic diagram gets me really confused. Once I:1/0 is...
Replies
2
Views
1,845
Back
Top Bottom