PDA

View Full Version : Timers in S7 300


meet_jagadish_mec
April 21st, 2007, 09:14 AM
hi
I am using S7 300 CPU 315-2 PN/DP. I can use only 0-511 timers in that plc. In my project i have to use more then 800 timers.
Is there any way.

504bloke
April 21st, 2007, 10:11 AM
You could roll your own timers using a clock pulse and count

504bloke
April 21st, 2007, 10:23 AM
Here you go, i kenw i had read a post on here before about roll your on on S7

If you do want to roll you own - try this , I posted it before , but I can't find where :-
You need to sub M10.0 for your first cycle flag , and MD58 is your last scan time - you may find it gives you what you want .
FUNCTION "TON" : VOID
TITLE =TON - Timer On Delay
//If the enable condition go true, timer TON starts incrementing according with
//the last CPU cycle time. When the accumulated value is greater than or equal to
//the preset value, the timer stops and sets the timer done bit.
NAME : TON
VERSION : 0.1


VAR_INPUT
EN : BOOL ; //Timer Enabled
Pre : TIME ; //Timer Preset
END_VAR
VAR_OUTPUT
TT : BOOL ; //Timer Timing
DN : BOOL ; //Timer Done
END_VAR
VAR_IN_OUT
Acc : TIME ; //Timer Accumulator
END_VAR
BEGIN
NETWORK
TITLE =Reset Accumulator Value If Timer Not Enabled Or First CPU Cycle

A( ;
ON #EN;
O M 10.0;
) ;
JNB _001;
L 0;
T #Acc;
_001: NOP 0;
NETWORK
TITLE =Accumulator Value Increasing

A #EN;
A( ;
L #Acc;
L #Pre;
<=D ;
) ;
JNB _002;
L MD 58;
L #Acc;
+D ;
T #Acc;
_002: NOP 0;
NETWORK
TITLE =Timer Done

A( ;
L #Acc;
L #Pre;
>D ;
) ;
A #EN;
= #DN;
NETWORK
TITLE =Timer Timing

A #EN;
AN #DN;
= #TT;
NETWORK
TITLE =ENO Setting

SET ;
SAVE ;
END_FUNCTION

Nick B
April 21st, 2007, 10:47 AM
Check out this thread. I would use SFB4 (TON) as a multi-instance block and you can have thousands in use. You can also use FC80 also located in TI->S7 Library

http://www.plctalk.net/qanda/showthread.php?t=30061

Nick