logix5000 copy SINT to String in ASCII

Sydneyguy

Member
Join Date
Jun 2019
Location
Sydney
Posts
39
HI Guys
So i am trying to write a real SINt or DINT value into a string tag.
If in string browser I write it manually, no problem. But how can I copy it to specific elements as values of ASCII but in readable format.
The photo below explains what I mean.

Elements 164 and 165 are hand written, great, but element 171 is a copy from the SINT, it changes it to ASCII and converts 114 to ASCII 'r', which is not desired. Any tricks?
sint.png
 
I don't understand what you want to see and/or happen.

  • The display [Style] is ASCII,
  • And 'r' is the displayed ASCII value for a SINT value of 114
    • R/r is the 18th character of the alphabet,
    • For lowercase characters, the base is 96,
    • 96 + 18 = 114.
So the value of Email_Body.DATA[171] is still SINT 114, it is only being displayed as ASCII 'r'

Can the display [Style] value be changed, e.g. to Integer, for that element of the array?

Do you want to see the ASCII sequence '114' in positions 171, 172 and 173?
 
Sorry I know its a bit confusing, took a bit to get my head around it as well.
If I change the [ Style ] it only changes the 'view' locally if you will.

From here it goes to an email handler, which reads and displays in ASCII. So I am seeing 'r' displayed when really i need the value 114 to be displayed.
How can I convert it as if you opened string browser and entered it there manually, which is WYSIWYG
Cheers
 
Code:
'1' '1' '4' in Style ASCII
is equivalent to
Code:
49 49 52 in Style Integer
Cf. https://man7.org/linux/man-pages/man7/ascii.7.html

And to pick some nits, that will not display the value 114, it will display the string "114"

Take care of the bits, and the bytes will take care of themselves.

If this is still confusing, just ask again I can go into more detail.
 
Last edited:
Thanks for that, ive slowly been learning more about handling strings. I thought using a 'DTOS' would be ideal ? but it had a similar effect, but maybe I am handling it wrong?
 
Thats I would have thought, but when it copies the string to the new string, it copies the value of the length, not the data?
See what i mean below
1.png



2.png



3.png
 
You have to copy the data portion of the string. The string data type starts with a 4-byte length. But there is a data SINT array there you can copy from. Then you’ll need to deal with the copy length. You can use the string’s length for the copy, but you’ll need to deal with the fact that it may be different depending on the length of the integer. E.g. 114 with be 3 character while 47 will be two characters. If you’re overwriting previous data, this needs to be handle. Otherwise a “114” overwritten by a “47” will end up “474”. Or, you may need to last char in a specific place in which case you have to change the destination offers based on string length.
 
your on the money, thanks, I kept the DTOS and the copy, and set the COP Length to a fixed max value and it worked a treat, cheers
 

Similar Topics

I have two separate programs open in two instances of RSLogix5000. Each program has a user defined tag that is a large array of a user defined...
Replies
7
Views
9,367
Hello, I'm using Logix5000 v24. I've got a large array of an UDT that I'm using for a recipe. I recently added a few more tags to the recipe UDT...
Replies
0
Views
2,578
I am trying to copy 3 separate 32 element arrays into one 96 element array. I am using 3 I/O cards and each individual bit is a separate alarm...
Replies
4
Views
2,907
Hi, done Cop(Copy) instruction but usually with DINT or INT in an array, but just happen an hour ago that I try to COPy an array of 380Boolian...
Replies
0
Views
2,085
Hi All, Can anyone tell me how I would go about copying or moving a DINT into an array of 32 Boolean values in rslogix5000? I've tried using...
Replies
11
Views
19,869
Back
Top Bottom