19bit Int?

Join Date
Jan 2003
Location
Michigan
Posts
490
Hey All.
Im using a positrack system from pepperl+fuchs and the location info coming to me from the header is a 19 bit int. Im on a SLC505 and im a tad confused on how im going to get this into an integer. Could a float be used in this case? Can you do a mask move on a float? It appears that floats cant be used in a MVM. And no double ints. What to do?

Matt
 
Is there a sign bit involved? I think you can MUL the most significant 4 bits by 32768 with a float destination, and then add the lower 15 bits to the result...but the sign bit (if any) may add some extra steps.
 
No, there is no sign bit, its unsigned. Its divided into a 16bit word and a 3 bit word.

So, first I would convert the 16 bit unsigned to a float by moving the value of the first 15 bits into it, then adding 32768 to it if the 16th bit is on. Then, examine the state of the next three bits (bits 17,18, and 19) (which are bits 1,2, and 3 on the next word) and add either 65536, 131072, or 262144 of each bit.

Damn, wish I just had DINTs. This is the last slc project for me, its all compact logix from here out. Thanks

matt
 
And the rest of it...

Two posts so they're visible on screen:
EDIT: Not sure I understood the original bit pattern, so that may need "adjustment"...

19bit_int_001.jpg
 
Last edited:
Very similar, but you take the 16th bit and mask it out so u can MUL the first 15, where I converted the entire 16 to float.
Then do the same to the new 4 bit high word.

I would bet your version scans faster.
 
This should work too. ANDing the high order bits with 7 might be superfluous if there is not possibility N18:0 could have any more than the lowest three bits set and could be omitted.

A101609A.JPG
 
Taking a second look at the CPT instructions above I see it could be simplified.

CPT F8:0 ( N18:0 * 65536.0 ) + ( N18:1 AND 32767 )

XIC N18:1/15 ADD F8:0 32768.0 F8:0

A101609A-1.JPG
 
Last edited:

Similar Topics

Will someone please convert this logic to pdf?
Replies
2
Views
119
Anyone have access to Melsec Medoc plus 2.31a that can either open a file (.pcd zipped in link below) and send a PDF/screenshot of the ladder, or...
Replies
10
Views
374
Hi all. Me again still learning Rockwell. So I'll be polling an INT data array from a Modbus SE power meter with a L82 (with a Modbus ProSoft in...
Replies
56
Views
1,352
Hi, I have some problem with View Point which I'm using to manual control of conveyors. On begin when in network was only PLC and HMI View Point...
Replies
0
Views
69
I have a bunch of tags in Historian/VantagePoint that off by one decimal point. I looked into the HMI displaying the same number, and the HMI is...
Replies
2
Views
113
Back
Top Bottom