Bits

spaghetti

Member
Join Date
Jun 2005
Posts
1
I have a program that reads an encoder. I am moving the encoder value HSC:0.acc to N7:0. I need to read values greater than 32767.
Can I get a 32 bit address? I'm using RSLogix 500.
Thank you
Phil
 
If you use a floating-point register, you'll lose accuracy after about 7 million counts.

Because you mention the HSC:0 function file, I presume you're using a MicroLogix 1200 or 1500 controller. Those support the Long Integer (L) data type, which is a 32-bit signed integer.

Try moving or copying your HSC:0.ACC value into an element in a L-type data table file.
 
Which PLC are you using? The accumulated count in a 1200 or 1500 is a Long Word which will give you up to a huge number. If you have long integers available, move it into that.

Edit - the master go in his answer first.
 
Ken Roach said:
If you use a floating-point register, you'll lose accuracy after about 7 million counts.

Hi Ken, I'm curious what happens at 7 million counts, isn't the floating point file good for a much larger number? The RSLogix500 help file shows its good to 3.40282347e+38. Thanks.

P.S.
Sorry, I didn't catch the HSC:0.ACC; I should have assumed MicroLogix instead of SLC.
 
Use the long integer (L) type - that will get you into the billions of counts. Floating point provides a mantissa and an exponent (powers of 10). The mantissa is only so large.

Let's start with a simple concept. You get one digit to hold a number (0-9) and one digit (0-9) to hold 'how many zeros after that'

If your 'how many zeroes after that' is zero then using the first digit you can count from 0 to 9 in 1 number increments. If the 'how many zeroes after that' is 1 then you can count from 0 to 90 but only in jumps of 10. When you get to 9 in the 'how many zeroes after that' you are counting in jumps of 1 billion. So if you have 2 and 4 as your digits you have 20000. Now try to add just 1 to that using this system. You can't. You can add at a minimum 10000.

Are you getting the idea? The 3.40282347 in your post is the max that the first 'digit' register can hold. (The strange number is a binary/computer thing). The 38 is the largest that the 'how many zeroes after that' can hold. (Actually each of these can hold minus numbers also but I won't get into that)

The inability to add 'just one' as you get to bigger numbers is what Ken was referring to.
 

Similar Topics

Hi I am being given several fault words (as a DINT) from a Drive that I am receiving into a Compactlogix L33ER controller. I have a small...
Replies
12
Views
1,140
Dear Fellows; I am working on a very old machine which is designed in GE 90-30 PLC system. I have some difficulties like 1. How a force to...
Replies
3
Views
348
Hi All, I am trying to write some simulation logic for an existing project im working on. Does anyone know if this is possible to write to...
Replies
6
Views
1,278
Hi, I have this code: LAR1 P##structy L 0 T LW [AR1,P#0.0] which resets all the bits in this struct called structy...
Replies
1
Views
641
I am passing DINTs between a Micro800 and CompactLogix - each bit in the DINT has its own unique meaning. On the Studio5000 side I can just write...
Replies
3
Views
1,101
Back
Top Bottom