Counting in Siemens S7

M

Thread Starter

Michael Pietrow

I have a problem with precise pulses counting. I need to create blocks in Step7 which will define number of pulses on normal digital input. I have about one hundred pulses/second to count. I have made counting on block ADD_I, but i think this is not precise. I need to watch (in Modify/monitor variables, in perspective - in a program) number of pulses per second every second. Is there anyone who could help me?
 
A

Alan Rimmington

You will need a high speed counter module to count the pulses reliably or a scan time of less than 5ms. You may be able to use an interupt but it would be better to buy the high speed counter.
 
S

Syed Aftab Ahmed

Two Solution

1) Use dedicated S7 counting module which comes with S7 Built-In Counting FBs (Costly solution )

2) Or use a Built-in Counter in relation with ADD_I simply adder is not sufficient as Counter is a positive Edge Detector precision will be automatically obtained. Suppose make the Counter to count up to 20 pulses and then reset the counter with its own OutPut when counts are upto 20. Mean while Use this out put also to add 20 in a ADD_I. ( Economical )

Now Question arises why not simply use the counter only without an adder. But the problem is that Adder helps to resolve yours problem of counting ranges, modifying the counting values during any process etc. etc.

REMEMBER S7 COUNTER GIVES AN OUTPUT HIGH WHEN DESIRED COUNTS ARE COUNTED.

I am using this program already Successfully. Although my system is working at 1-5 Hz but hope the suggested solution will also work at 100 Hz.

For more Information Contact

Syed Aftab Ahmed
ITPS
Siemens Engineering Company
Lahore
PAKISTAN
+0 92 042 5871010-15
[email protected]
 
D

Donald Pittendrigh

HI All

You can do this but need to use a 5ms time interrupt for the counting otherwise your cycle time will not give you the resolution to read every pulse.

You should only process the ADD_I block on the rising edge of the pulse you are measuring and you can use the internal frequency flags of the CPU to give you a 0.5 hz pulse frequency which you use also with rising edge detection to reset the count value every second.

You are better advised however to use a counter card with frequency mode if you need accuracy.

Regards
Donald P
 
Top