scan question slc 5/03

Join Date
Nov 2013
Location
Pa
Posts
264
Scan question for ton timer
If a TON is on a output branch and rung is true.
The next branch has a XIC contact off of that .DN bit to an OTE
The PRE = 0 ACC= 0 should the XIC in the branch open on that scan or the next scan?
T4:6 is the timer, Output gives short pulse out it is hooked to a sol valve that blasts air out. With timer at PRE=0 thought it should be true on that scan.

4033-plcscreenshot.png
 
Last edited:
Scan question for ton timer
If a TON is on a output branch and rung is true.
The next branch has a XIC contact off of that .DN bit to an OTE
The PRE = 0 ACC= 0 should the XIC in the branch open on that scan or the next scan?
T4:6 is the timer, Output gives short pulse out it is hooked to a sol valve that blasts air out. With timer at PRE=0 thought it should be true on that scan.

4033-plcscreenshot.png

In your example, the last bit in the last part of the branch will not turn on.
Mostly, because your timer is set to 0, meaning "turn on that output for 0 time"

Others will reply that the solenoid takes time to move/shift, and the air takes time to move, etc. Notwithstanding those good points, the bit won't turn on until you put a preset in the timer.

As soon as the timer rung conditons go true, the DN will be true.
 
In your example, the last bit in the last part of the branch will not turn on.
Mostly, because your timer is set to 0, meaning "turn on that output for 0 time"

Others will reply that the solenoid takes time to move/shift, and the air takes time to move, etc. Notwithstanding those good points, the bit won't turn on until you put a preset in the timer.

As soon as the timer rung conditons go true, the DN will be true.

Thats what I thought but the output DOES turn on for a split second. since it is a closed valve air time would not matter and the output does flicker on. If I had to guess it is only 1 scan BUT it does come on.
 
using the timer settings as shown in your original post ...

when the rung conditions (either of the left-side branches) are TRUE – then timer T4:8 will run for 0.10 second ... when T4:8 times out (gets DONE) - then the output bit O:4/0 will have a status of ONE for one scan only ...

If I had to guess it is only 1 scan BUT it does come on.

your guess would be correct - as long as the timer settings stay at the same values that you've shown ...

If a TON is on a output branch and rung is true.
The next branch has a XIC contact off of that .DN bit to an OTE
The PRE = 0 ACC= 0 should the XIC in the branch open on that scan or the next scan?

I'm not sure exactly what you meant by that question - it doesn't seem to quite match the logic that you posted ... hopefully I've cleared up any confusion on the OUTPUT'S operation - but if not, please post again with more details ...

going further, if you increase the Preset value of T4:6 to something higher than ZERO, then you can make the output stay ON for more than one scan ...

you might want to tinker around with the stripped down "test" rung shown below ...

.

scan_q2.PNG
 
Last edited:
Scan Time v Timer Operation

I had started draughting this up earlier before Ron's reply, but was interrupted before I could finish it off and make a screenshot. So I'll post it now anyway, before bedtime...:sleep:

just the cowboy said:
...If a TON is on a output branch and rung is true.
The next branch has a XIC contact off of that .DN bit to an OTE
The PRE = 0 ACC= 0 should the XIC in the branch open on that scan or the next scan?...

The next scan.

just the cowboy said:
...With timer at PRE=0 thought it should be true on that scan...

No. The DN bit will be set true on the next scan.

jdbrandt said:
...because your timer is set to 0...As soon as the timer rung conditons go true, the DN will be true.

No. The DN bit will be set true on the next scan.

just the cowboy said:
...Thats what I thought but the output DOES turn on for a split second...

...If I had to guess it is only 1 scan BUT it does come on.

Yes, the OTE is set for one scan because the first TON DN bit is set true and the second TON DN bit will not be set true until the next scan.
i.e. the XIO instruction for T4:6/DN bit before the OTE will remain true for one scan, after TON T4:6 EN bit is set true.

It has to do with how the timer instruction is updated and how it evaluates.

The timer is only processed and updated on each scan. When the rung-condition-in to the timer instruction is true for the first time, it sets the enable (EN) bit true, and the timer timing (TT) bit true. It does not evaluate if the PRE is equal to the ACC. Also, an 8-bit time stamp is recorded for the accumulator value (ACC). The scan then moves on from the timer instruction. So while the scan is elsewhere, the timer instruction is not updating the ACC value. When the scan comes back around to the timer instruction for the second time, and it's rung-condition-in is still true, the timer instruction records a second time stamp. The new time stamp value is compared with the old time stamp value and the ACC value of the timer is increased by the difference between the time stamps. The instruction then evaluates if the PRE is equal to the ACC for the first time.

Likewise, if the PRE equals zero, the first scan does not yet evaluate if the PRE is equal to the ACC. When the scan comes around the second time, the instruction evaluates if PRE is equal to ACC, but only if PRE is not equal to zero. If the PRE is equal to zero, it sets the done (DN) bit immediately. So this takes an extra scan after the enable to set the done bit true.

Sometimes, depending on timing, the ACC can actually be updated to 1, even though the PRE is equal to zero and the done bit was set on the second scan. This is because the instruction will still record the second time stamp and compare and update the ACC value, even though the evaluation is saying the PRE is equal to zero, so set the done bit true. When the PRE is zero, the evaluation is ignoring the ACC value altogether, but the instruction can still update it.

Knowing that...

Operation of a timer when the PRE = non zero value

First scan with the rung-condition-in true
EN bit set true
TT bit set true
First time stamp for the ACC is recorded
PRE = ACC is not evaluated
DN bit is false

Second scan with the rung-condition-in true
EN bit is still true
TT bit is still true
Second time stamp is recorded, compared and ACC updated
PRE = ACC is evaluated false
DN bit is false

Subsequent scans with the rung-condition-in true
EN bit is still true
TT bit is still true
Subsequent time stamps are recorded, compared and ACC updated
PRE = ACC is evaluated false
DN bit is false

Eventually, scan with the rung-condition-in true
EN bit is still true
TT bit is still true
Time stamp is recorded, compared and ACC updated
PRE = ACC is evaluated true
DN bit is set true
TT bit is set false
---------------------------------------------

Operation of a timer when the PRE = 0

First scan with the rung-condition-in true
EN bit set true
TT bit is set true
First time stamp for the ACC is recorded
PRE = ACC is not evaluated
DN bit is false

Second scan with the rung-condition-in true
EN bit is still true
TT bit is still true
Second time stamp is recorded, compared and ACC updated
PRE = 0 is evaluated true
DN bit is set true
TT bit is set false

So the timer instruction does not evaluate PRE = ACC on the first scan when it is enabled. This is because the instruction is designed on the basis of having a non zero PRE value. So it waits by default until it has two comparable time stamps before starting to evaluate PRE = ACC.

So when you set PRE = 0, and the timer is enabled, it does not initially account for this 0 value, and must by design wait until the next scan before evaluating PRE = 0, and then set the done bit true.

In the attached, I used your logic with "Test Single" mode to pause the scan cycle when the timer EN bit was set. You can see the DN bit of the timer is not yet set and the XIO beneath is still true, making the OTE true. On the next "Go Single Scan", the timer DN bit is set and the XIO instruction will go false, setting the OTE false.

Regards,
George

TON_PRE_0.jpg
 
Surprised valve reacts to 1 scan.

I guess the question should have been "When is the DN bit updated" the answer seems to be on next scan.

I did not want to change the program but I guess I will have to, that one scan does blast cooling air. I'm surprised the valve reacts in one scan.
I will check to see what the scan time is.

Again thanks for the input
Harvey
 
I'm surprised the valve reacts in one scan.

some valves will - some valves won't ...

the reason is that some of them have enough INERTIA to keep the valve plunger moving - even though the electrical current is no longer flowing ...

going further ...

if this is an AC type valve - and if the output module is a TRIAC type - then the output module's commutating/switching time can come into play ... you might want to look up "zero crossing" if you're interested in digging deeper ...

here's the basic idea: when a TRIAC type output module receives a "turn off" signal from the processor, the TRIAC doesn't actually stop conducting current until the AC waveform crosses the zero point – and the polarity reverses ... sometimes this effect can cause a troublesome lag in an output device's operation ...

let's nail it down with this ...

suppose that your processor is executing its program at (let's say) 200 times per second ... many people assume that a one-scan pulse to an output device (let's say a valve) will keep the valve electrically "energized" for just 1/200th of a second ...

that's usually a misconception ...

good luck with your project ...

(and that was a very nice write-up, George) ...
 
Last edited:

Similar Topics

Hello! I have a question about a routine I found on one of our box palletizing machines. I've attached the 3 rungs that I have the question...
Replies
12
Views
2,220
Hi. I'm a beginner at programing and my question is about the MOV instruction at RSLOGIX. First of all I dont have any practicals issues with...
Replies
8
Views
3,336
This should be a pretty easy question, would just like to have it explained a bit so I can understand it. In the attached program, why does the...
Replies
15
Views
4,682
I have a question about differences in logic solving output instructions when they are placed in series as opposed to parallel. Getting down to...
Replies
23
Views
5,011
I have a 10ms periodic task (in ladder logic) set up in my Logix controller (v28.) One of my routines is to MOV the decimal number "2" into a...
Replies
7
Views
2,408
Back
Top Bottom