SimarGill Posted March 28, 2015 Report Posted March 28, 2015 Good evening, I was wondering if any could give me some guidance on how to use a CNT function properly. The PLC I am using is: CJ2M - CPU31 What I have in my process is that an inductive sensor is in default OFF state then if a metal part is detected then it kicks off but when metal part is no longer in view then it is back OFF. Then if a plastic part is in front of inductive sensor then it still remains off. What I want to implement is that any time a metal part is detected (Inductive Sensor is ON) then it should add 1 to the counter and hold that value until the next time a metal part is detected which will make the counter now 2. The same thing should apply if the plastic part is detected (Inductive Sensor is OFF), add 1 to the plastic counter. The problem with this section is that there isn't a indication as to when a plastic part is detected therefore if inductive sensor remains OFF then the plastic counter will keep adding 1 recklessly. If anyone knows a way I could use internal bits or some other trick to this problem. Please reply and I highly appreciate it. Meanwhile, I'm going to look around in the lab if I can find a capacitive sensor lying around which I can mount to detect plastic parts and thus kick off the counter to add 1. Thanks for all the help. Quote
vasekd Posted March 29, 2015 Report Posted March 29, 2015 You must use a capacitive sensor (detects metal and plastic parts) Quote
pfort Posted March 29, 2015 Report Posted March 29, 2015 (edited) CNT instruction is not the best way to do this. Try an Increment instruction instead, with the rising edge of your sensor input. Maybe you want something like this: (Edit: since the capacitive sensor see both metal and plastic part, you will notice that there is a NC contact of the inductive sensor in the 2nd rung) Edited March 29, 2015 by pfort Quote
vasekd Posted March 29, 2015 Report Posted March 29, 2015 OK. For reliable operation use a timer. Both sensors + time - metal part , only capacitive sensor + time- plastic part. Sorry I haven“t cx-programmer at home. Quote
SimarGill Posted March 29, 2015 Author Report Posted March 29, 2015 Thanks for replies. I found a capactive sensor but with fixed sensitivity that kicks off for aboth metal and plastics parts..I could probably use this in conjection to the inductive sensor?? Such as if both inductive and capactive kick off then add to metal counter or if only capactive kick off then add one to plastic??? Thoughts? Quote
pfort Posted March 29, 2015 Report Posted March 29, 2015 (edited) See post #3 Your info tell your are studying but did you begin? Edited March 29, 2015 by pfort Quote
SimarGill Posted March 30, 2015 Author Report Posted March 30, 2015 Yes I am studying. What this topic is actually a small part in a bigger operation im doing. And yes I already made a program but so far I am able to seperate metal and plastic parts but not being able to keep track of them. Its the weekend here and lab is closed. Im going to try that suggestion tomorrow or maybe tuesday when I am in lab again. I will keep you poated. Thanks to all. Quote
BobB Posted March 30, 2015 Report Posted March 30, 2015 Try an Effector capacitive sensor - they have one with a sensitivity adjustment but it stll may not work If the metal object is steel you may be better off with a magnetic sensor to detect that and and the results for metal. Quote
SimarGill Posted March 30, 2015 Author Report Posted March 30, 2015 Ok I will have to ask my professor if he can order one. Can you give me an example on how I would use CNT function? Let's say I toggle a bit ON and counter adds 1. Something simple like that. If you can attach a picture of that logic that will be great. Thanks! Quote
Michael Walsh Posted March 30, 2015 Report Posted March 30, 2015 Pfort provided a good example for what you are trying to do. The CNT (or CNTX) function counts down from a specific setpoint and then turns on a done bit. To keep a running count, not to a specific value, use the code above. Quote
SimarGill Posted March 31, 2015 Author Report Posted March 31, 2015 I just tried that method but I am having a issue with the binary increment. Instead going up by 1 it keeps going up as long as the inductive sensor is on. I should mention here that as soon as metal is detected, Inductive sensor is on for at least 7 seconds. Quote
Mendon Systems Posted March 31, 2015 Report Posted March 31, 2015 (edited) You must either use the differentiate up option on the inputs as shown in Mike's example or use an @++ instruction to increment the count. Either one of those will keep it from cycling more than once. Edited March 31, 2015 by Mendon Systems Quote
pfort Posted April 1, 2015 Report Posted April 1, 2015 (edited) When I was new to Omron, the first thing I did was to read the programming manuals. There are very good hints there. And when I ask question on a forum, I read the answers before ask again. But usually I make my homeworks before asking. Edited April 1, 2015 by pfort Quote
SimarGill Posted April 1, 2015 Author Report Posted April 1, 2015 Thanks for the tips Pfort. I'll do that but I did use the differentiate up instruction but pretty sure made an error. I will try again today when in lab again. Thanks! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.