Hello friends I am new in this field I try to set and up counter in S7 300 station.Its count but counter not stop on the preset veluve.Can any one give me some help about that
I have got to admit that the S_CU instruction can be confusing. It is an old S5 left-over.
Here is the way Siemens explains the use of the S-CU counter up instruction:
S_CU (Up Counter) is preset with the value at input PV if there is a positive edge at input S.
The counter is reset if there is a "1" at input R and the count value is then set to zero.
The counter is incremented by one if the signal state at input CU changes from "0" to "1" and the value of the counter is less than "999".
If the counter is set and if RLO = 1 at the inputs CU, the counter will count accordingly in the next scan cycle, even if there was no change from a positive to a negative edge or viceversa.
The signal state at output Q is "1" if the count is greater than zero and "0" if the count is equal to zero.
So basically you are right, the counter never examines if CV=PV. You have to do that yourself. Here is one way you could do it (see attachment).
An easier way to implement counters can be found in the System Function Blocks, under SFB0. Have a look at the online help.
Hope this helps,
Daniel Chartier