Sign in to follow this  
Followers 0
jmm0837

Non-resetable Counter

5 posts in this topic

Hi Everyone, I have a colleague that needs help with a counting issue. Our customer has a product counter that is displayed on a touchscreen. Our problem is – the customer does not want the counter to reset or rollover. The customer wants a value displayed from 0 – infinite or something similar. We use an A/B Micrologix 1500 and an EZ-Automation 6” screen. We need help with the logic and how to display the result. Our typical numeric display button on the screen goes to 5 characters (99999). Any help appreciated.

Share this post


Link to post
Share on other sites
While there is not such thing as infinite a counter on a Micrologix is only capable 32767 before a rollover. Create a L data file which is a Long Integer and use a ADD instruction. This will get you to 2,147,483,647. Is that infinite enough?

Share this post


Link to post
Share on other sites
If you really need infinity, and you have series C processor, you can use the ADD instruction but with floating point data. This gives you 3.408 x 10 to the 38th . (Tried to format the superscript without success) Edited by lynchmob2000

Share this post


Link to post
Share on other sites
When will he loose precision with the Floating data type?

Share this post


Link to post
Share on other sites
If your display can only display 5 digits then you may have to use two (or more) counters, the first that counts from 0 to 9999 (if you use 16 bit which I recomend) and the next one which counts how many times the first counter rolled over. You could then have two numeric displays next to each other (padded with zeros) which would appear to be one number (i.e. 0 to 9999 9999) If all you are doing is counting then this is a pretty simple task but it becomes more complicated when a user wants to input values or if you are doing any calculations. The following image is the basic idea although you'll have to check what happens if a counter is reset and the rung is already true (it may go to 1 instead of 0). If you display on the screen [C5:2.ACC] [C5:1.ACC] [C5:0.ACC] padded with zeros then this will count from 0 to 100 billion. P.S. it also doesn't handle reaching it's maximum very well either. Edited by Spedley

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