Today is...
Tuesday, May 22, 2018
Welcome to Control.com, the global online
community of automation professionals.
Featured Video...
Featured Video
A tutorial introduction to programming using the QuickBuilder Programming Environment.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Timers in STEP 7
Some difficaulty with timers in STEP 7
By Reza Hasseli on 28 August, 2002 - 1:32 pm

I have created a function allowing me to make a flicker on one of my PLC's digital outputs.
In that function, I made use of ON-DELAY timers, but in OB1 when I want to use this function several times to have more than one flickering digital output with different timing, I can't have different timing it seems that timers in my function block are global. how to solve this problem?

Thanks
Reza Hasseli

Are you declaring a timer as an input inside the FB/FC? You should be. Then you can assign T1, T2 etc.. to the FB/FC when it is called at diiferent places in your program.

Are you using the same timer more than one time? That's not possible on a simple way.

By Zulkeysams on 29 August, 2002 - 2:38 pm

Dear Reza,
The problem most likely occurs if the same timer is being called again. Thus by changing the timer no every time you call the function might solve the problem.

Hi,
The easiest way in STEP7 is to configure a clock byte. Each bits have a different flash rate. To flicker the outputs, you just need to AND the outputs with the memory bit of the desired frequency !

By Donald Pittendrigh on 4 September, 2002 - 4:59 pm

Hi All

You don't have to configure the clock byte, it is already part of the CPU and only has to be assigned an address in the CPU setup in the hardware configuration.

Regards
Donald Pittendrigh

By Legin Snave on 30 August, 2002 - 2:50 pm

We use a static variable counter in the FB and a count-up triggered by external timer pulse. This means each instance use of the FB has its own timer function without using the pool of available timers.

By Ronald Nijssen on 1 September, 2002 - 4:57 pm

In S7 there are two types of timers, 1. the S5-compatible ones, 2. the IEC version. The first is programmed with an unique number (e.g. T1, T2..) These resources are global, multiple usage will not work. The Tx number however can be introduced in a Function (Block) through an Input Parameter, thus allowing it to be specified outside the scope of your Function and allowing for multiple calls to that function using different timers.

The IEC timer can be found in the System Function List, it is a System Function Block (SFB) and requires a Datablock for each use, or must be used in a Function Block, where you can declare it in the STATIC portion of the FB's header. Each call to the FB will allocate an unique instance of the IEC timer in your code

Regards
Ronald

By ITS SHAHID WAQAS CHAUDHRY on 4 September, 2002 - 3:51 pm

Two ways to do this:

Method 1:
In the declaration table of your FB, add the timer as an IN declaration, Type: TIMER. In the code (of FB), use the declared timer with reference name [with the # sign before them]. This would allow you to specify the timer number for each call.

Method 2:
Use the library, use the SFB4 [TON]. Declare the definition of the SFB in the declaration table as STAT declaration and use the SFB4. Call the SFB4
with whatever parameter name you have given it in the code block. The functioning of the timer are the same as the buitin timer [Txx].

The method 1 is easy and suited for small projects where you have spare timers. With method 2, you can program as you want, keeping your timers [Txx] safe for using elsewhere. If you need more help or a sample, I will be glad to send to your mailbox direct.

Shahid Chaudhry

Hello,

I'm having troubles with a multiple instance TON. I've already declare it in STAT in the FB, the PT input is in TIME format. But when I activate the input IN, the time does not run and of course then the output Q doesn't activate. Do I need to configure something else? If someone could help me I'll be grateful.