Sign in to follow this  
Followers 0
aassbeer

How to count pulses into DM?

10 posts in this topic

Hello! I need to add "1" into a DM each time there is an input-pulse. This is supposed to function as a counter to show values on a numeric display (NT-21) Will use a "move" function block with "0" to reset it. The PLC is an Omron CJ. How can it be done?

Share this post


Link to post
Share on other sites
Hi Aassbeer You can use the instruction @+ Input ------[]--------------------@+DMxx &1 DMxx Banker

Share this post


Link to post
Share on other sites
Heihei banker! That function will only add "1" once, right? I need to add it several times to raise the numeric value on my TS. Like this 1 puls = DMxx=1 (1) 2 pulses = DMxx=2 (1+1) 3 pulses = DMxx=3 (1+1+1) 4 pulses = DMxx=4 (1+1+1+1) and so on...

Share this post


Link to post
Share on other sites
Yes it will ad "1" every time the input goes high. Banker

Share this post


Link to post
Share on other sites
Take this example: ------[puls]--------------------@+DM10 &1 DM20 1. DM10 is first set to "0" 2. There is a puls input, and DM20 will become "1". 3. The puls falls, DM20 looses "1" It does not hold it, so it cannot function as a counter. Do you agree?

Share this post


Link to post
Share on other sites
Increment Binary with a differentiation up will do the trick. For example the rising edge signal of YOUR INPUT will increment D100 by 1. | |-----------|YOUR INPUT|------------[@++D100] |

Share this post


Link to post
Share on other sites
HI No DM men. "looses". To use my code use the same DM like this @+ DM20 &1 DM20 and use the move inst. for reset. Try to test in the simulator. Banker

Share this post


Link to post
Share on other sites
Hello: Use this code: Input pulse -----| |--------------@++ Dxx That's the intruction nr. 490 an is usel for a binary increment. (values , in decimal, from 0 to 65 535) Use The character "@" to count all the pulses. "@" means a differentiate up of the input. However, this is not the best way to count pulses, if the frequency is too hi. If the frequency input is too hi, by this way, your PLC will not count all the pulses. If you have a big frequency on the input, like an encoder, for example, there are a better way in the CJ1M to count the pulses. However it is only possible on the CJ1M CPU 21, CPU22 and CPU23. CPU 11; CPU12 and CPU 13 don't support that option. If you are using the CPU 21 or 22, or 23 I can tell you how to count the pulses in a frequency up to 100 kHz. let me know what CPU do you have and what do you have connected in the input. Do you have a sensor, an encoder,what kind of encoder? Encoder TTL, encoder push pull?

Share this post


Link to post
Share on other sites
Hi! It's an CJ1G-H CPU45. The pulse is coming from a flow sensor and is no more than 10Hz. Will try the programming lines mentioned in the above post's today. Thank you all for spending your time! Edited by aassbeer

Share this post


Link to post
Share on other sites
Ended up with: Input pulse --||--------------- ++(590) Works great!

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
Sign in to follow this  
Followers 0