how to reset counters automatically

delatorre

Member
Join Date
Jun 2002
Location
Tonaya, Jalisco
Posts
20
Hi all,

I have a problem with a ladder (see attachment)

I have two counters, CT40 and CT41 and the on-off transition comes from X35 and X36 respectively then I have a conditional where if V1016 is equal to K1 then LD V1040 and out it in V4055, then LD V1041 and out it in V4056 and after this I want to reset the counters by PD C76. in order to start a new sequence. (actually with this configuration it doesnt work)

IS IT CORRECT??

I APPRECIATE ALL YOUR HELP

count.jpg
 
Last edited:
It would appear to me that the PD for C76 on rung 242 should be on a separate rung just below rung 242 with the V1016 equals K1 being the first element and the C76 PD the last element. The NOP on rung 231 probably shouldn't be there or any NOP's ahead of the logic you are trying to run. Also, Where is the END instruction? It should be the last rung in the ladder as a separate rung by itself. I may have missed something, try these things to see if it helps.
 
jrwb4gbm has brought up a good point... Just because the logic exists, doen't mean it's getting scanned. I remember a recent discussion about this around here...

This code should work, so what exactly is "not working"?... :confused:

To expand on jrwb4gbm's suggestion... Where is this logic in the program??? Might the code be in a subroutine that isn't enabled? Is the comparison actually turning on?

The NOP shouldn't be there (though it shouldn't affect the program).

Details, details, details... It also might help to mention that you're using a Koyo PLC... :rolleyes:

By the way, jrwb4gbm. The PD doesn't need to be on a separate rung. It will work the same way (as your suggestion) right where it is.

And for the non-Koyo guys here who are asking what the heck delatore is trying to do... It might make more sense if you know that V1040 and V1041 hold the current accumulated values of CT40 and CT41.

beerchug

-Eric
 
Delatorre,

I am not sure what your actual problem is, The NOP stands for no operation it is an empty address in your program. When V1016 is equal to K1 you want to load v1040 into V4055 and then Load V1041 into V4056 ( which are counter memory locatons for the accumulative values) then execute the PD Positive differential instruction in the same rung. This will happen but I don't think you won't get any data in V4055 and V4056 since this PD instruction takes precedence and resets the counters before the values are loaded in to V memory. The positve differential will only be on for one scan. You may want to move this instruction to another rung and execute it in some similar way after you load your data to be used, although I am guessing' I am also missing what V1016 is for since it too is a counter data register.

I may be able to elaborate if I new more of the program, or what specifically does not work.

Controlsbyjoe
 
controlsbyjoe.com said:
...but I don't think you won't get any data in V4055 and V4056 since this PD instruction takes precedence and resets the counters before the values are loaded in to V memory. The positve differential will only be on for one scan. You may want to move this instruction to another rung and execute it in some similar way after you load your data to be used...

Takes precedence over what? The PREVIOUS rungs? If C76 is indeed triggering, the counters will not be reset by it until the N-E-X-T scan.

I don't have a Koyo laying around that I can test this code on, so you and jrwb4gbm might have a valid point about the PD needing to be on a separate rung.

Although, I still don't believe it's necessary... :mad:

For that matter, you could replace the PD instruction with a RST CT40-CT41 instruction and reset the counters immediately without waiting until the next scan. Note that this would keep the counters reset as long as V1016=1, which may not work in delatore's application.

Maybe we're ALL a little tired... zzzzz :D

beerchug

-Eric
 
Delatore, instead of PM-ing me, it would be better if EVERYONE got this info.

via PM from delatore...

Thanks for your comments and I am going to try to be clear in relation with the problem that I have with my project.

This project is a micro irrigation system in which I need that when
V1016 (that is the information of the number of irrigations) is
equal to 1.2.3, etc. loaded the CT40 information and it places it in
V4055 where we can get the amount of water entered and after that loaded the CT41 information and places it in V4056 where also we can get the amount of water drained and after of this I need that it reset the counters to initiate a new cycle or
irrigation. (in order to know exactly how much water in and out in every irrigation cycle)

Note: I´m not using the NOP rung

That's great, but I (we) ask again, what is not working? The counters? The comparison? The data movement?

Actually, you never stated that the code does not work... You only asked if it is "correct"... ;)

It might be better to just .zip the program and attach it here. Then we can probably see what you're doing wrong (if anything).

beerchug

-Eric
 
One of the most endearing, and yet most aggravating, things about PLC's is that they do exactly what you tell them to do - no more... no less.

Rung-232:
If X35 goes OFF to ON then INC Count in CNT-40 (current count is stored in V1040)
If C76 is ON then Reset the Count in CNT-40 (set V1040 to "0").

Rung-237:
If X36 goes OFF to ON then INC Count in CNT-41 (current count is stored in V1041)
If C76 is ON then Reset the Count in CNT-41 (set V1041 to "0").

Rung-242:
If the contents of V1016 = the value of K1, then...
Grab and save the accumulated count value from CNT-40 (V1040) to V4055...
Grab and save the accumulated count value from CNT-41 (V1041) to V4056...
Then Turn ON C76 for one scan to reset the counters to "0".

There is nothing wrong with that code... and yet...

So, time goes on... X35 and X36 go on and off while the counters count events...

Then, out of the blue, a decision is made to save the accumulated values and rest the counters. This decision is apparently based on the value of V1016. That is, if V1016 = K1 (whatever that might be) then save the data and reset the counters.

At this point... I'm betting that the program fails because it counts and saves data only once... then the counters remain at "0"... forever... or, at least, until something is done to make V1016 NOT EQUAL to K1. That is, C76 stays ON until V1016 NOT EQUAL K1.

I can say this only because I don't see that the value of V1016 is manipulated in any manner... I don't even know how V1016 comes to equal K1. Then, once it does equal K1, I don't see how V1016 is made to NOT Equal K1. And so... C76 stays ON forever.
 
ho to reset counters...

Eric,

I`m sorry you are rigth.

Ok. that it doesn`t work in my project are the resets on CT40 and CT41, in other words the data is being moved correctly every time the V1016 is changing to 1,2,3 etc., but the counters are always accumulating the pulses instead of getting the resets it must be get.
 
So...

I don't know if you read my post... if you did, and my suggestion was wrong, then...

It shouldn't make any difference, but how about breaking Rung 242 into 3 separate rungs?

And... how exactly is V1016 being manipulated? And where?

Are you using C76 anywhere else?
 
Hi terry,

V1016 is counting the number of irrigations done (1 - 25), then CT`S must be counting the amount of water in and out and saving this data into V40`S and after this CT`S must be reseted (in order to start in "0" for counting the next irrigation, water in and out also) by C76 that isn`t anywhere else. (IN THE FOLLOWING ATTACHMENT YOU WILL SEE 2 SEQUENCES OF IRRIGATION)

...AND THE PROBLEM IS THAT THE CT`S RESET IS NOT WORKIG .

count2.jpg
 
Last edited:
It looks to me like you may have the old double output reference issue. You have two different references to C76 in the two rungs you show. The case where V1016 = 1 will definitely not work since the logic conditions preceeding C76 will be turned off in the next rung. The second instance may or may not work depending on how Koyo inmplements their oneshots. Since your counters won't reset I'm voting for 'not work'.
I recommend you use separate addresses for the PD instructions and parallel the contacts from the PDs at the counter resets.

Keith
 
Yes, now that you've posted "the rest" of the code (or at least a bit more), we can see where one of the problems lies. As kamenges mentions, you're suffering from "double coil" syndrome...

Terry brings up a very ggod point about the comparison instruction. As long as V1016=1, the counter data will constantly overwrite the storage locations (V4055-6) with current counter values.

I disagree with Terry about the counters staying reset though... The counters are reset by a one-shot, so they will reset only at the point when the comparison goes from false-to-true. They will start counting again on the next scan.

Since you've made a decent effort in asking for help, I'll give you an idea of how I'd write the code for this section. Note that you can replace C70 and C71 with different bits if they are in use. This also gets the PDs on separate rungs if that's needed...

I coudn't fit all of it in one screenshot, so...

Upper section:
[attachment]

upper.gif
 
I don't know if Eric did this intentionally but he (almost) shows a pretty good optimize you can do with the Koyo plc if you are moving around sequencial addresses (like you are).
In the rung where Eric shows the LD and OUT instructions you can use LDD and OUTD instructions, which are double word load and double word output instructions. This would load both V1040 and V1041 in one instruction and output them to V4055 and V4056 in one instruction. This isn't required but I thought I would toss it out there since Eric's post jogged my memory.

Keith
 

Similar Topics

Hi, All production number reset following the comm error. I've looked through logic and disabled autamatic reset future. The counters should only...
Replies
1
Views
1,927
Hi, Quick question :- I have a large number of counters that I wish to reset at a particular time, by using the RES instruction. However...
Replies
3
Views
2,283
Anybody know a slick way to reset 200 consecutive counters in a AB Logix 5000 plc? thanks, Jerry
Replies
16
Views
6,771
Hello, We are working on PLC Schneider Electric Modicom TSX Premium (Telemecanique) and we aren't able / we don't know how to make some range of...
Replies
5
Views
6,388
I was loading a program onto an XE1e2 PLC and it got stuck on these two windows and won't progress. It won't let me connect from the PC to reload...
Replies
0
Views
72
Back
Top Bottom