Teaching myself Studio 5000 on Emulate, V33, ahead of a machine we're quoting on a CompactLogix instead of the usual 1200. A part sits on a photoeye and after 3 seconds a pusher output should fire. Simple TON, preset 3000ms.
The timer never gets to DN. Online, .ACC goes to 2, 5, sometimes 10, then straight back to 0, and .EN blinks. The photoeye input I'm simulating stays on, I can see the bit is 1 the whole time.
```
PE_Part ---] [--- [ONS] ---[TON Pusher_Delay PRE 3000 ACC 0]
```
I tried changing the preset to 3 in case it wanted seconds not ms and that made no difference, so then I made a new timer tag in case the old one was corrupt. Same again.
Does the TON need something on the rung I'm missing, or could it be the emulator resetting it? Not sure about that ONS, it's the only thing on the rung I've not tried taking out.
What's the ONS doing in front of the timer? What changed when you added it, or was it there from the start?
It was in an example I copied out of a training PDF, for catching the part arriving. I thought it'd make the timer start once when the eye goes on, but maybe that's not what it does.
Wait, does the ONS make the rung false again after one scan? I think I've had that backwards, I thought it just started the timer.
It does. A one-shot makes the rung true for exactly one scan. Your TON gets one scan of enable, accumulates a few ms, then the rung goes false and a TON resets to 0 when its rung is false. The ACC you're seeing is one scan of the emulator, which is why it's 2 or 5 or 10 depending on the scan.
Same in every brand. R_TRIG feeding a TON in ST does exactly this.
Right. A TON needs its rung true for the whole preset, it isn't a start command, it's a hold command. Take the ONS out and put the photoeye straight in front of the TON, and it'll time the 3 seconds while the part sits there and DN comes on at 3000ms.
If you really want the one-shot for something, use it to latch a bit and put that bit in front of the timer, then unlatch the bit when DN comes on. But for a part sitting on an eye you don't need any of that.
There's a beginner writeup that has the TON timing diagram in it: https://plctr.com/introduction-to-plc-programming-for-beginners/
took the ONS out. ACC counts up to 3000ms, DN goes on, pusher fires. The one-shot was only ever letting the rung be true for a single scan, so the timer reset before it got anywhere near the preset. Nothing else needed changing, the photoeye holds the rung on its own.
What I still don't get is what that example was using the ONS for in the first place. I'll go back and read the rest of it. Thanks priya87 and carav9.
Probably a counter. One-shots belong in front of counters, not timers.