SFB timer in Step7

Tsørensen

Member
Join Date
May 2004
Posts
25
hello all

In my step7 project I have a FB that I use 4 times I a row. In this FB I need a function to increase a Dint by 1 every 10 seconds.

I have read somewhere that I have to use a SFB timer for this job, so I have tried to make a little program that whit it, but it doesn’t work :/

Anyone that can give me a hint how to solve this problem?

Timer1_on and timer1_on_1 are Stat variables

timer.gif
 
what about OB35 default call on every 100 ms
OB 35

L "DB timer".timer4
L 0
==I
JC mo04
TAK
L 1
-I
mo04: T "DB timer".timer4

this is some kind of timer i think


FB 10

A M 11.0
AN I 24.4
FP M 62.0
= M 62.1
AN M 62.1
JC M001
L 20
T DB210.DBW 0
M001: NOP 0

here are condition for loading a timer constant


A Q 12.0
A I 24.5
A(
L DB210.DBW 2
L 0
==I
)
S DB90.DBX 18.3

end when timer constant become zero i set DB90.DBX 18.3
all timers in my plc is buzy
in db 210 i wrote constant for the other timers

I hope that may be help
 
Hi,
In netword 22, the timer SFB, you need to enable the SFB by given a true signal input at "En", then the SFB can work. otherwise, it won't work even the "IN" is on.
 
In your SFB call you seem to have specified a Preset value of T#100mS. So every time the timer times out, the DINT addition will be done. Your text says you want this done every 10 secs, not 10 times every second. Which is it?

If you want 10 times a second, how about using the system clock memory byte? Go to the Hardware Configuration editor, select the CPU and examine the Object Properties. Select the tab Cycle/Clock Memory and you can specify a memory byte there whose bits the operating system will periodically change. Bit 0 of the byte will change state at 10Hz which is what you want. (Bit 1 = 5Hz, Bit 2 = 2.5Hz etc). You can detect the rising edge of this state change to trigger your addition - no timer needed at all.

If you want once every 10 seconds, the 'slowest' bit in this byte is bit 7 which changes 0.5Hz. You could use a counter to count 5 changes of this bit and then do the addition.

Regards

Ken
 

Similar Topics

If I Got This Correctly,in Order To Make A Sfb Timer, I Need To Add It In One Of The Sfb Blocks In The Library....which In My Case Is Write...
Replies
8
Views
6,143
Hi I am using Siemens s7-300 and I amtrying to work out how to read the output data from a sfb 52 block. I have a IM151-8F CPU connected trough...
Replies
0
Views
1,455
Hey any body tell me how i can program FM 350-2 through ET200M ..can i use SFB48 in my programing for this
Replies
4
Views
2,062
Hi all in a SCL FB I've decalred some variables like this: VAR ShiftRegister:ARRAY [0..100] OF BOOL; ValvesOutputCMD: ARRAY...
Replies
1
Views
1,635
A message with the following information appeared on the HMI: STOP Caused by PG stop operation or by SFB 20 "STOP" Previous operating mode: RUN...
Replies
1
Views
2,035
Back
Top Bottom