skatinima

CP1L CNTR Function, Increment is reseting the count

6 posts in this topic

Hi,

So I'm doing this project for school where I have to use an Up/Down counter.

The thing is, when I simulate, the increment impulse doesn't increment the count, and instead resets the count . I have screenshots below of a program I created just to illustrate the situation, envolving just the counter.

 

The first 2 screenshots show how the counter is reseting the count from 1 to 0 when I activate the increment pulse (my problem);

The 3rd and 4th illustrate the correct functioning of the decrement pulse, from 3 to 2;

The last one shows the reset of the count from 2 to 0 using the reset pulse.

 

Conclusion: The Decrement and the Reset impulses function as predicted. The problem lies in the increment impulse. Instead of incrementing, it resets the count.

 

My Software Especifications:

Software version: CX-Programmer 9.6

OS: Win 10 64-bit

If you could help me out with this one I would really appreciate it.

Cheers.

cntr_1.PNG

cntr_2.PNG

cntr_3.PNG

cntr_4.PNG

cntr_5.PNG

Share this post


Link to post
Share on other sites

Manual W451

Basic Operation of CNTR(012)/CNTRX(548): The counter PV is reset to 0 by turning the reset input (CIO 0.02) ON and OFF. The PV is incremented by 1 each time that the increment input (CIO 0.00) goes from OFF to ON. When the PV is incremented from the SV (3), it is automatically reset to 0 and the Completion Flag is turned ON. Likewise, the PV is decremented by 1 each time that the decrement input (CIO 0.01) goes from OFF to ON. When the PV is decremented from 0, it is automatically set to the SV (3) and the Completion Flag is turned ON.

And by the way: do you realize that your set value "4" is not a value but an address?

Edited by Sergei Troizky

Share this post


Link to post
Share on other sites

Thanks for the answer.

My problem is that the counter doesn't even increment from 0 to 1. In the example, I chose a SV of 4 and, manually, set my counter value to 1. It should increment to 2 when I activate the input 0.00, but instead goes to zero.

Share this post


Link to post
Share on other sites
Just now, Sergei Troizky said:

 

And by the way: do you realize that your set value "4" is not a value but an address?

Then why does it say "Set Value" right next to the 4? How do I change the SV then if that is not the SV?

Share this post


Link to post
Share on other sites
2 hours ago, skatinima said:

Then why does it say "Set Value" right next to the 4? How do I change the SV then if that is not the SV?

In Omron CX-Programmer, CIO addresses are referred by numbers, so if you put numbers like 0 to 2560, it will mean you're accessing CIO 0 ~ 2560 address contents.
In your screenshot, your SV is set to 4 which means your SV is the value inside CIO 4 address, which typically will be defaulted to zero during simulation.

As CNTR is a BCD counter, you should put # mark next to the number you desired for SV to put it as a BCD constant. Example for SV of 4, you put #4 in the SV.
This rule applies for any direct number input operations like BCD Addition / Subtraction.

For binary numbers (lets say you use CNTRX instruction, which is a  binary counter) you should put & mark next to the number you desired. Example for SV of 4, you put &4 in the SV.

That's just the rules defined by CX-Programmer.

1 person likes this

Share this post


Link to post
Share on other sites
4 hours ago, skatinima said:

Then why does it say "Set Value" right next to the 4? How do I change the SV then if that is not the SV?

The preset is the word CIO4 and its value is 0bcd, which is monitored under the address. 

In Omron, the CIO prefix is omitted for the CIO addresses, and they look like numbers, which is confusing the beginners.

Edited by Sergei Troizky
1 person likes this

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