Followers 0

# Another Newbee Question

## 5 posts in this topic

Hello agian, Trying to write a program for water tank levels, problem is the tanks have over 37000 gallons of water in each but I can only get sums up to 32767 before I get a math overflow fault. Could somone please explain how to get values greater than 32767. ( floats??? double integers???? something else???) and if so how to set it up and make it work. I realize that I can scale it down to smaller #s for the math in the program its self but eventually I will need to be able to set a value of almost 38000 onto the HMI. Need to be able to go higher than 32767 or need a way to work with decimal. ( K 37.725 ) Also tried to install a reset instruction with S:5/0 for math overflow trap and get ERROR " Invalid Data Type?????????? Any thoughts on this one also. Using ML1400. Thanks in advance for you help. Charles

##### Share on other sites
It's a great question. Because you are using a MicroLogix 1400, you can use either Long Integers or Floating Point values. Long integers keep their resolution of "1" up to the maximum value of 2^31 = 2,147,483,648. Floating Point values go up to roughly 2^23, but because they are an approximation you lose resolution as the values get higher. It's a classic PLC conundrum that programmers use a Floating Point value to get large totalizers, then are baffled when adding 1 to a floating point number of about 7 million has no incremental effect. I would stick with Long Integers. You can't use them with Counters, but you can certainly use them with ADD/SUB/MUL/DIV. About the Reset instruction; "RES" is specifically a Reset function for Timers or Counters. If you need to set a Bit value to zero, either use the OTE instruction with sustained false pre-conditions, or use the OTU instruction with temporarily true preconditions (it's a Latch False instruction). Typically when you are overriding the S:5/0 bit for testing, use a rung with nothing but "OTU S:5/0". What's your ship and homeport ?

##### Share on other sites
Hello Ken, Thanks for the reply. Could you go into more detail on using the long Interger for me. How to set it up and use it. Unfortunatly the laptop that is provided to me on board the ship has Danish windows installed on it, and I only speak english. ( we have people from about 20 different countries onboard but none speak danish) so using the help menu or figuring out driver errors can be a hair pulling experience. I am enjoying working with the plc's and automation onboard but it is a learn as you go process. Ship is the Northern Jaeger Home port is Seattle Washington ( although we spend most of our time fishing the Bering Sea and offloading/resupplying from Duth Harbor ) I personally live in Florida. Thanks again for the reply and I hope you can give me more details about using Long Intergers, ( Love this site, its great to be able to get advice from people who are in the know ) Charles

##### Share on other sites
You can use an "L" data file element in almost every instruction that you could use an "N" data file element. Data file 7 is the default Integer file, and there's no default Long Integer file, so you just create the file(s) as needed in the program organizer. L10:5, for example, can be used as the source or destination of a math instruction like ADD, SUB, DIV, MUL, etc. Your HMI might natively support access to "L" data types, or you might have to trick it a little bit into thinking that the "L" is two ordinary Integer elements. I think you mentioned one of the PanelView family operator interfaces before.