Negate output of counter

krneki10

Member
Join Date
Aug 2012
Location
slovenia
Posts
18
I need to negate output of counter down, so output Q0.5 will always be on 0 except when counter itself counts down from 2 to 0, then Q0.5 should be on 1.
I tried to solve that with |NOT|, but in that case, output Q0.5 will be on 1 by default, because counter is not initialized by M0.4 before program starts.

 
What about using a NOT and a Normally Open M0.4 in series on the Q output?

Or is your M0.4 a pulse?

You could use a NOT and your M0.5 (Normally Open) and then each time the counter counts down it checks to see if its at zero. You may need to 'set' Q0.5 when it reaches zero and then use M0.4 to 'reset' Q0.5?

You could also use a comparator to 'set' a bit when the counter is over zero and then put that in series with your NOT instruction...
 
Is there a reason you can't use a Count Up counter?

Code:
A(
A M0.4
A M0.5
CU C 1
BLD 101
NOP 0
NOP 0
AN M0.4
R C 1
L C 1
T MW 100 // ANY MARKER WORD OF YOUR CHOICE (THAT'S FREE!)
NOP 0
A C 1
)
A(
L MW 100
L 2
>=I
)
= Q 0.7

I haven't got the ability to post a screenshot at the moment so I wrote it in Ladder and converted it to Statement List. I've left the NOP's and BLD in so that you can enter it here in STL and it should convert.

Let me know if there's a reason you can't have a Count Up counter and we'll try something different.

Cheers

;-)

PS. You also need to decide how you wish to reset the counter after it has counted to the required value. Or whether that will be done by M0.4 going off...
 
There are no particular reasons for counter down, I just used it because it somehow worked it my case :oops:

If we take a look at last network, imagine counter as box with bottles and Q0.5 as indicator for full box. It should work like this: M0.5 inserts bottle into box. When box is full, indicator Q0.5 is set to 1 (in all other cases, it's 0).

Q0.5 is also a safe switch in Network 6, so process cannot start if box is full. Only M0.4 can reset counter (box) + restart process.

Thanks for help again!
 
Well then the example I posted shouldn't be far off the mark.

Just Count Up the number of bottles put into the box with the counter and then use a Comparator to say, if the number of bottles is equal to or greater than x bring on Q0.5. Then just use your M0.4 to reset the counter. ;-)
 
Hello, thank you very much. With some modifications, it actually works now. See the working solution in attachment.

If I will have any questions left, I'll contact you for sure :)

newcounter.JPG
 

Similar Topics

If anyone can tell me whats wrong with my program iam trying to ditect the negate edge of the pushbotton. I have created 3 type of code. No one...
Replies
19
Views
6,584
Hey all, I am starting a new project for a customer and I am adding in solenoid valves. Once added, I noticed there was a lack of an Output...
Replies
0
Views
66
Hi, The hardware is: Click Plc model # CO-O1DD1-O HMI model # S3ML-R magnetic-inductive flow meter model # FMM100-1001. I will set the flow meter...
Replies
4
Views
130
Hi, I am using AB 5069-L306ERS2 CPU. My system should achieve SIL-2. I have safety door switches connected to AB 5069-IB8S module, and I want to...
Replies
1
Views
106
Hello! Hope you are great. I need to make a change in a PLC with ladder logic. I will mount a analog valve and I need to control it in ramp up...
Replies
7
Views
317
Back
Top Bottom