RSLogix 5000 Hex to string

Are your trying to produce the hexadecimal representation of a number as a string rather than the decimal representation which the DTOS instruction will give?
 
If don't have RSLogix500 with me but this general method should work

Temp is a Sint

Temp = Sint AND xf0
Temp = Temp / 16
Temp = Temp + 48
If Temp > 57 then Temp = Temp + 7
String.Data[0] = Temp

Temp = Sint AND x0f
Temp = Temp + 48
If Temp > 57 then Temp = Temp + 7
String.Data[1] = Temp

String.Len = 2
 

Similar Topics

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 like.
Replies
5
Views
1,267
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,671
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
151
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
574
Back
Top Bottom