Sign in to follow this  
Followers 0
Michael Lloyd

Is there a way to write a value to a String with STX?

6 posts in this topic

I have a UDT that has (2) String Tags. So far the only way that I can populate the tag is by cutting and pasting text into it. I had the idea that I could write a structured text routine to write the value to the tag but that doesn't seem to be working. I would call the routine once and then delete it. I can build what I need very easily in Excel and then cut and paste it by job This is what I tried but it won't compile, I assume because it either can't be done or there syntax was wrong. Analog[62].String1 := PT-2100; Analog[62].String2 := Mainline Pump Suction Pressure; If it was just one or two tags I wouldn't hassle with it. Every program these days has at least 32 to 64 analog points and that means 64-ish string tags. Sometimes twice that. It takes a while to copy paste all of that. The Strings are used in the HMI

Share this post


Link to post
Share on other sites
As far as I've seen, RSLogix 5000 doesn't support literal string values in any of its languages. It's laborious, but whenever I've needed to assign tag values in bulk I've edited the *.L5K file.

Share this post


Link to post
Share on other sites
I don't understand your post fully, but I have moved strings into registers before and concatenated them. I wrote an AOI for an LED sign that has a whole lotta string crap in it, if you import this AOI you can view the ladder and see if anything there helps you out. I guess by providing some samples of strings I've done, I didn't know if that would help. LEDSIGN.zip

Share this post


Link to post
Share on other sites
Ok I re-read your post (twice). I agree with Mr. Roach. Do like one or to tags, then export the file as a CSV or something. Then open in EXCEL and edit everything in there. Then import back into your project. That's how I edit a bunch of tags as well.

Share this post


Link to post
Share on other sites
The times when I need to assign tag values in bulk happen frequently enough that a friend of mine wrote an Excel worksheet that uses VB to create the tags based on a specific UDT, etc. It's not very portable but it works. I made a spreadsheet that creates structured text for my analog and motor UDT. I was able to create something in Excel that would create the ASCII values from a string but the process of extracting the individual letters and a few other technical difficulties made the process somewhat useless. ASCII values, as you know, aren't writeable from a CSV import... I figured out how to write a string with structured text but it doesn't have much value for bulk editing. The numbers to the right are the ASCII values for the letters in the comments section. .LEN is very important (obviously) Analog[70].String1.LEN := 6; Analog[70].String1.DATA[0] := 80; // P Analog[70].String1.DATA[1] := 84; // T Analog[70].String1.DATA[2] := 45; // - Analog[70].String1.DATA[3] := 54; // 6 Analog[70].String1.DATA[4] := 52; // 4 Analog[70].String1.DATA[5] := 48; // 0

Share this post


Link to post
Share on other sites
Cool. I'll check the AOI out. I replied to Ken's post with a method for writing to a string variable in a UDT but it's not workable for for what I'm trying to accomplish

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0