RsLogix 5000 Hex to SINT array

Omnicode

Member
Join Date
Jun 2009
Location
Knoxville
Posts
7
Hello i have been trying to figure out a good way to take hex and convert it to an array of SINT[].

Here is what my failed attempt looks
b4a30fc735fc7341cec4635b3e712bce
like.
 
There are two issues with what you have shown:

1)Your 16-bit number is far too large. Logix is 32-bit, and while there is some support for 64-bit LINT it definitely won't be able to handle the number you have shown.

2)The COP instruction cannot handle constants/literals.

Break your number up into smaller chunks and use BTDs instead.

EDIT: This assumes what you actually care about is the bit pattern of your hex number, not necessarily the value itself.

And if you already have a constant hex value, why not just put it in the sint array manually instead of entering the hex constant into your instruction?
 
Last edited:
You could COP the data into the SINT .DATA array member of a string data type, then you would see those hex data as the string it is meant to be i.e.
$VL25,2,960,0*TT

 
You could COP the data into the SINT .DATA array member of a string data type, then you would see those hex data as the string it is meant to be i.e.
$VL25,2,960,0*TT

You are an true gem. I was basically taking long ascii commands and having to manually break them down into hex nibbles and put them in an array.

Lead by the comment about the string.data i found i can now just paste the commands i a string makin sure to use $$ to get my symbol and now I ca roll the commands directly into my WriteSocket.Buf[].

Thank you all for the help.
 

Similar Topics

I am trying to concatenate 3 hex numbers into 1, and I am doing this as follows: 3 registers with 8 bit values in them need to be joined into 1...
Replies
8
Views
3,675
How can I convert a SINT Hex number to a string in RSLogix 5000.
Replies
4
Views
9,401
Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
2
Views
157
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
581
Back
Top Bottom