S7-315-2DP Timers

plcengineer

Member
Join Date
Jan 2004
Location
USA
Posts
176
I have a project that I am going to need a timer that runs from 0-30hrs. I need to load a timer Setpoint Value and I need to display the current time left in Hrs/mins.. I was looking at various ways to do this and I thought about setting a timer up for 30 Min intervals and have it trigger a counter. I could load the Counter Setpoint with a 2 and that would mean that when the CTR Actual reached 2, 1 Hr passed.

How do I do this most efficiently and how do I display the actual time left in Hrs/Mins? Maybe someone out there has had to do this with the S7. Please help...


Thanks
Plcengineer
 
Go to the Standard Library in STEP7 and from the System Function Blocks folder select SFB4, the IEC on-delay timer. Like most timers this still times down from the preset value to zero (not up from zero as you have requested) but we're half-way to your solution as this uses the IEC 'TIME' datatype for the preset. In other words, to enter 30 hours you just type in T#30h or T#1d6h or T#1800m or any other valid combination of time identifiers to make up your preset. If you monitor the ET (elapsed time) parameter in a Variable Table you can choose a TIME format to display it and you will see it in its full days, hours, minutes, seconds and milliseconds glory.

Fortunately, the IEC TIME data type is really just a double integer which holds a number of milliseconds. If you use an unformatted memory location to store the ET parameter, you can add one network with a SUB_DI instruction (subtract double integer) to subtract the ET value from a fixed value of 10800000 (this is the double integer equivalent representation of 30 hours measured as a number of milliseconds). The result is your remaining time, and again can be displayed in a Variable Table as TIME.

Is two networks efficient enough?

Good luck

Ken.
 
Why don't you use a time-interrupt OB (OB30 to OB 38 - depends on the CPU which one(s) are available). Configure the OB to be executed every second. Count seconds, minutes, hours and even days and weeks, but don't use counters, use math and compare instead. See the example. You could eventually even count down if needed.

Kind regards,

ob35.gif
 

Similar Topics

Hi, I am using CPU315-2DP.There are 256 timers only in it. I need more timers to use in my program.How can I get more timers. I have used the...
Replies
21
Views
4,890
Dear sir, I am using SIMATIC 300, CPU 315-2DP , (6ES7 315-2AF03-0AB0) VIPA 603-1CC21 A1.0 RAM 32KB, Firmware=V4.0.8 The problem Im using MPI...
Replies
2
Views
188
Hi , Looking for some help. We have a 343-1 PN Lean Card & 315-2DP connected to an external system collecting data. After a recent shutdown...
Replies
0
Views
73
I'll preface this by saying this is the first time I've worked on a Siemens system and I'm fairly unfamiliar with them. I might mess up some of...
Replies
29
Views
813
Hi We were having a few power cuts and the CPU would not work. I had to reset the memory and he CPU would read from the memory card and start...
Replies
13
Views
3,205
Back
Top Bottom