RSLogix Binary to DEC

KLemas16!

Member
Join Date
Jun 2016
Location
NH
Posts
9
Good morning,

Still new-ish to Allen Bradley and hoping some of you seasoned folks out there could help me.

I am setting up communication with a Mettler Toledo weight scales. Five bits (bits 8-12) of a 16 bit input word are used to communicate a particular weight mode (gross, net, tare, target, etc.) that is being reported by the scale interface. I need to get the decimal value of these five bits to determine which weight mode is being communicated. What would be the simplest way to do this? My ideas right now seem convoluted.

I am using ladder logic in RSLogix 5000 for this interface. Thanks in advance for any help.
 
I was thinking the same thing as Widelto. Use a Masked Move command to a INT or DINT register.

You could also use individual move commands and when bit 8 is true then move a 1 into a register. If bit 9 is true move a 2 and so on.
 
Good morning,

Still new-ish to Allen Bradley and hoping some of you seasoned folks out there could help me.

I am setting up communication with a Mettler Toledo weight scales. Five bits (bits 8-12) of a 16 bit input word are used to communicate a particular weight mode (gross, net, tare, target, etc.) that is being reported by the scale interface. I need to get the decimal value of these five bits to determine which weight mode is being communicated. What would be the simplest way to do this? My ideas right now seem convoluted.

I am using ladder logic in RSLogix 5000 for this interface. Thanks in advance for any help.

I would use bit distribute (BTD)

The arguments are:
Source - The tag that contains your raw data.
Source bit - in your case 8
Destination - The tag that you want your result in. The supported types are again Sint (8 bits), Int (16 bits) or Dint (32 bits)
Destination bit - 0
Length - 5

That should do it for you.

If it were my program, I'd make sure that the number from the Mettler stays stable for half a second to verify that the bits are stable before you process your logic.
 
I would use bit distribute (BTD)

The arguments are:
Source - The tag that contains your raw data.
Source bit - in your case 8
Destination - The tag that you want your result in. The supported types are again Sint (8 bits), Int (16 bits) or Dint (32 bits)
Destination bit - 0
Length - 5

That should do it for you.

If it were my program, I'd make sure that the number from the Mettler stays stable for half a second to verify that the bits are stable before you process your logic.
+1

And to clarify, this would move those five bits to a new tag in bits zero through four which I believe will match up with your needs better than a MVM which would leave the bit positions unchanged.
 
Thank you all for the response. It seems the BTD is the cleanest and easiest way to do this. Nice block for the tool bag :)

I've attached an image showing my old rather manual way vs. the BTD function. Maybe someone will learn from this in the future.

All the best!

BIN to DEC.jpg
 

Similar Topics

Is there an instruction to convert a number to binary and then apply that binary to outputs of a SLC 500 eg. convert the number 6 to binary =...
Replies
10
Views
4,244
Why is it that the Binary data file has only 16 available 1-bit memory points? Is this a characteristic of the 1747-L511 processor or do I need...
Replies
9
Views
7,127
Hello everyone, First time posting here. I'm working on a CompactLogix (RSLogix 5000) program for a machine that inspects bottles. There is an...
Replies
5
Views
6,104
Does anyone know how to convert from a decimal number to a true binary output. For example convert the number 15 to 1111 and then be able to turn...
Replies
9
Views
14,757
Hi Everyone, I am not proficient in RSLogix 500 so I have a question regarding the evaluation of N7:0 data as an input. So as I understand in...
Replies
1
Views
84
Back
Top Bottom