Ascii in RSLogix5000

almog44

Member
Join Date
Oct 2015
Location
Israel
Posts
26
hi,
I tring to mov Ascii in RSLogix5000 to a string at structured text code:
for example:

if temp=5 then
string_tag = [3,'abc']
end_if

but I can't compile that, any idea?
I have a lot of text that I need to move to the string tag,
so I dont want to open a tag for every text line.
 
I tried the same approach, because I had to hardcode a lot of strings in the PLC. But this is not possible.

Literal strings are not valid entries in RSLogix5000
https://rockwellautomation.custhelp.com/app/answers/detail/a_id/41625/page/1

The ST language does not support literal string assignments.

The way I did it in the end was to manually MOV the correct lenght in the .LEN member, and MOV each individual ASCII char in the seperate .DATA[n] elements. I am not really happy with this approach. But it works and is was only executed on the first scan. :unsure:
 
Basti504 said:
The ST language does not support literal string assignments.

Neither does ladder, for that matter. I don't *think* FB does, but have not tried explicitly.
 
When I work with strings, I use the copy or concatenate instructions in Ladder code.

For example, you could have a series of storage tags built up that would have predefined ASCII strings stored before copying the data to where you want to use it. I do this to send out messages to bar code readers, printers, and the like. When you use the COP instruction, ensure to point to the .DATA[0] place holder and specify the length that you want copied across.

Alternatively you can make a tag up, called ASCII_Lib for example and store the alphabet that you need. You can then concatenate string you want to store using something like a one string tag that you can use to store the ASCII library using the CONCAT instruction. You can build a string one letter at a time, or in a group of ASCII characters. I do this when I am generating product codes for our finished product.
 
Literal strings are not alowed but you can use the COP instruction to assign or any of the built in string handing functions.

You can also just change the .data[n] elements directly with ascii codes if you need control codes. There are a lot of codes that you can't even type into the string editor you either build them on the fly or you can hard code string snippets to bolt together.

The stupid thing is you need to make code that puts the ascii values into the string data elements to create them initially. Once they have the data in them you can remove the code you used to make them and just copy strings as required.
 
Last edited:

Similar Topics

Hey, i've been working on getting some add-on instructions defaulted in the company i work in. i am currently trying to create a string which...
Replies
7
Views
3,076
This might be a simple question. I have a red lion display which i can communicate over rs232 or 485. I am needing to get information from a plc...
Replies
2
Views
1,542
Using Controllogix PLC and RSlogix5000 to scan in data over devicenet ascii module (1734-232ASC). Data scans in and displays correctly. I need to...
Replies
2
Views
4,037
I need to convert ascii data scanned in on Devicenet serial (1734-232ASC) to individual Integer values. Perform math and convert integer values...
Replies
3
Views
11,453
Hi, We couldn’t find anything specific, so am starting a new thread. I’m trying to migrate a config from a ML1400 to a micro820 & am experiencing...
Replies
1
Views
104
Back
Top Bottom