eagleplc

Compare not working

5 posts in this topic

We have this logic (on a CP1E) the desired outcome is as follows:

When a bad part is detected, force the operator to index the machine 6 times, using a holding register to prevent a power cycle from resetting the count.

once 6 cycles are recorded output that the bad parts are removed AND reset the count to zero.

 

What has actually happened so far:

the count has gone to 6 and not reset. I have used CX Programmer to set the H0 value to zero but the compare still says it's equal (to 6)

 

I have read everything i can get my hands on regarding holding registers and compare functions and i can't see what is wrong. I have no formal training on this so i'm sure it's something simple. can anyone point me in the right direction?

 

Thanks guys

 

 

Prg Snapshot.png

Share this post


Link to post
Share on other sites

H0 is the Set Value of the counter. If you set it to #6, it will always be #6.

The process value of the counter will change to #6 (Set Value) when the counter is reset. (When 210.00 turns ON).

The process value will decrement by #1 each time 212.00 turns ON.

When the process value reaches #0, the counter will turn ON. (C0).

Conclusion:  You do not need to perform a compare. Set H0 to #6 then use contact C0 to turn ON 212.02 (Bad Parts Removed). 

Share this post


Link to post
Share on other sites

IO_Rack is correct, you do not need to use a compare for this, however, if you want us to look and see why it is not working (for educational purposes), post the program and we will look.  It is difficult to tell from this picture. 

 

As IO_Rack also mentioned, the counter counts down from the setpoint to 0 and when it is done, it turns on the done bit.  If you are trying to count up, you will need to use the increment instruction - ++.  

 

Share this post


Link to post
Share on other sites

Thank you for the input. I really appreciate it!

Share this post


Link to post
Share on other sites

I suspect there is another move further up in program, loading a #6 into H0.

The way CX-P works when online, it shows the current value at end of the scan.

Because you are comparing H0 to 6, the compare output is correct, then you are clearing it.

 

As Michael points out, the complet code will help to identify where the issue lies.

But also, you don’t need the compare if you stick with the counter.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now