jmm0837
Mar 28 2006, 08:27 AM
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.
TWControls
Mar 28 2006, 09:25 AM
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?
lynchmob2000
Mar 28 2006, 12:10 PM
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)
TWControls
Mar 28 2006, 12:42 PM
When will he loose precision with the Floating data type?
Spedley
Mar 28 2006, 12:57 PM
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.
[attachmentid=2166]
P.S. it also doesn't handle reaching it's maximum very well either.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.