SFB4 force to complete S7-300

Daynada

Member
Join Date
Nov 2005
Location
Wisconsin
Posts
28
If I want to force a TON (SFB4) to be complete can I use a one-shot to initiate a move where I will take the PT value and place it in the ET?
Thank you in advance.
 
OK. I have a twist. My TON is a multi-instance and I want to reset it within the FB that is using it. So I don't THINK that I have access to the variables that you refer to.

First... does that make sense?
and then do you have any suggestions?
 
OK. I have a twist. My TON is a multi-instance and I want to reset it within the FB that is using it. So I don't THINK that I have access to the variables that you refer to.

First... does that make sense?
and then do you have any suggestions?

You have access..

Example of declaration and use in a SCL block.. Same principle in ladder and fbd..

Code:
FUNCTION BLOCK : masterfb

VAR
  my_instanced_timer : TON;
END_VAR

BEGIN
  //Call of timer
my_instanced_timer(IN:= true, PT:=T#3m);
  //Acess of a variable
IF my_instanced_timer.ET > T#3s THEN
  //Do something or nothing
  ;
END_IF;
END_FUNCTION_BLOCK

So to acess the timer just put the instance name "dot" the variable you want to acess within that instance..

Does this make any sense??

If not I could post a ladder example tomorrow when i have acess to STEP7 software..
 
I assumed that since I couldn't see the "ATIME" in the interface/emvironment window (at the top) that I wouldn't have access within the FB. Thanks much!
 
Perhaps because I didn't word it correctly or perhaps because I am doing something wrong, but when the timer is complete I need the Q to turn on, but it is not.
So choice A: I am doing something wrong or choice B: I didn't clarify my question initially.

here is my code:
A #ClearTheDelay
JCN j980
L #timertest.STIME
L #timertest.PT
+D
T #timertest.ATIME
L B#16#2
T #timertest.STATE
j980: NOP 0
 
When I tested this, I started the timer and then turned the bit on to force the timer to complete. If the timer is never started, the timer will never complete so you are seeing the correct logic for this implementation.
 
is the IN input on the timer true? IF not it will not work..

The code looks similar to L D[AR2,P#0.0] s code and he usually is right..

Saw after I posted L D[AR2,P#0.0] had already answered.. He is fast..
 
Last edited:
OK. I will test again on Monday. I hope it doesn't matter but I should make sure that I note that my "clearthedelay" is a one-shot rising (PD).
Here is what i recall seeing in the DB:

Q: False
ET: stopped with a value less than PT (what ever it was when I "clearthedelay")
STATE: B#16#2
STIME: some "random" time
ATIME: the "random" time above plus a tiny bit more than the PT time (maybe 10 ms or so)


I do have a back up plan that just uses relay logic to do what I want (it is not as consise as LD[AR]'s but I didn't think I could "take over" the timer's Q output like that)
 
OK. I will test again on Monday. I hope it doesn't matter but I should make sure that I note that my "clearthedelay" is a one-shot rising (PD).
Here is what i recall seeing in the DB:

Q: False
ET: stopped with a value less than PT (what ever it was when I "clearthedelay")
STATE: B#16#2
STIME: some "random" time
ATIME: the "random" time above plus a tiny bit more than the PT time (maybe 10 ms or so)


I do have a back up plan that just uses relay logic to do what I want (it is not as consise as LD[AR]'s but I didn't think I could "take over" the timer's Q output like that)

LD's method should work with rising edge too, if timer is started. If it was never started then it wont force timer to complete. With my simulation following what happened.

Q: True
ET: stopped with a value that had elapsed from timer start when force complete was issued.
STATE: B#16#2 (timer completed state for timer)
STIME: system time when timer was started
ATIME: system time + PT.

Altough, i missed why ATIME was updated by ld, as state change is all that is needed for timer to force complete (naturally timer.IN must be true as it being false changes timers state back to timer not started [b#16#0]).
 
Last edited:
Thanks to all. Rather than spending more time on this. I opted for the "how about some simpler logic". Tested and working fine.
 

Similar Topics

Hi All I managed to use SFB4 in a FC using the IN_OUT interface, but I would like to improve if possible. Can I determine where the "timer area"...
Replies
9
Views
3,149
Hello! I have used two instances of the iec function block SFB4. They are defined as STAT instances within a calling function block. The presets...
Replies
1
Views
1,610
Hi! Is it possible to declare several SFB4 (TON) in a UDT and then create several DB of type (from our UDT)? I was hoping not to have them...
Replies
4
Views
2,218
Hi, I have a simple function block that does not function when I use multi instance SFB4 IEC Timer On Delay. I could not attached a zip of the...
Replies
7
Views
9,093
I have modified an existing program on an S7-400 and download just the FC that had the change made to it while the PLC continued in RUN mode...
Replies
2
Views
1,558
Back
Top Bottom