Micrologix 1500 increment by .1 issue

vin7102

Lifetime Supporting Member
Join Date
Feb 2012
Location
Ohio
Posts
30
Hey fellas,

I have a Micrologix 1500 ser.c on a bxb base.
I found this weird issue today to run by you guys. I have a momentary toggle switch wired to an input that is used to increment a (float) measurement field. I have a standard little one liner in RSLogix with a ons instruction to add .1 to my float each time the button is toggled. It works great but at certain numbers it flips out and shows ex. .8000001 then increment up it goes to .9000002 but then for some reason straightens up and goes to 1.0 , 1.1, 1.2, 1.3, then maybe 1.4000001 ect.

Really odd, anyone ever see this? I don't think I'm getting any bounce because it works flawlessly if I use 1 as my incremented value. The .1 flips this thing out.

Thanks
 
Search for IEEE Floating Point Precision

This has been discussed many times. Everything is working exactly as it should. Poke around this website and many others for an explanation that will help you understand. Good luck.
 
And remember that the MicroLogix 1500 supports the Long integer data type, so you can use a 31-bit-plus-sign value to run your accumulator.

1 is always 1 in Integer-land, but 0.000001 is sometimes zero in Floating-Point world.
 
Flopro & Ken,

Ah... Got it!
Thanks guys, I appreciate the hints.

Have a great weekend!
 
Excellent !

It's worth mentioning that a Long Integer is a signed value, so one bit is used to indicate the sign. So an "L" type data table element in a MicroLogix has a range of -2^31 to +2^31.

That's -2,147,483,648 to +2,147,483,647.

If your accumulator is counting by ten-millionths and only has one digit to the left of the decimal point, you can make each of those increments a 1, and still only be in the 10 million units range, much smaller than the over-2-billion maximum value for the integer.
 
Thanks Ken,
For this application (thankfully) the highest value I will ever need is around 1000 (with my decimals staying in the tenths), so I wont be anywhere near the max range of even the integer element.

I simply set up a temporary (N) address to hold my accumulated values then added one instruction to divide that result by 10 and sent that result to my original Float address and its done!

I'll keep your suggestion in mind for the future... Thanks a lot!
 

Similar Topics

I have been working on this for a while now and I can't seem to get it. I was finally able to view the 1500 on the PanelView under the serial...
Replies
1
Views
81
Hello, I have a 1764 1500 LSP Series A that keeps failing with DTL_E_FAIL I/O error. Searching around it seems there's a weird issue specifically...
Replies
2
Views
104
Good Day i Have Micrologix 1500 LSP, and I want to get data from plc and send it through Modbus RTU slave; I have only ch0 on that plc I Order...
Replies
6
Views
917
Hello folks, Hope everyone is doing fine. I got an OMRON NS10-TVOOB-V2 hmi screen last day and planning to use it with Micrologix 1500. 1. Is...
Replies
4
Views
1,207
Good morning to all, I need to modify an existing PLC MIcrologix 1500 configured with a Modem on Channel 1 (DF1 Full Duplex) and an...
Replies
7
Views
1,425
Back
Top Bottom