Sign in to follow this  
Followers 0
RhodyCho

Logix 5000 Strings Out of Order

9 posts in this topic

Hello Again, I'm sending some string data serially from a Honeywell Serial Interface module to an AB CL 5561 controller using port 0 set in the "system" mode which is set for DF1 Point to Point. When I send a value, say "ABCDEFGH" from the Honeywell system, I get a "CDAB" in my string tag's .LEN value (if I change its style to ASCII from decimal) and a "FEHG" in the first four elements of the strings .DATA value. So the actual string's value appears as 'FEHG...' Ultimately I'm wanting to view the correct string on a PanelView. I've tried a byte swap instruction but that only works for integer or real values but I can swap the LEN characters around so they are in the proper order. The problem then is how do I view them as ASCII characters and not their decimal equivalents. The Integer to String instructions only seem to work for numbers, or am I wrong there? I thought I could display each character individually on the PV application in the order required to make the combination appear as the original string but the values from the individual DATA elements only appear as the decimal number. Any thoughts on how I could rearrange my strings? Thanks.

Share this post


Link to post
Share on other sites
Hmm.. not sure of an easy way to do this. I know it can be done with a series of COP from stringtag.data element to DINT, then swap bytes and copy from swap destination to another stringtag1.data. Depending on the size of the string, you may have to copy to several temporary tags and then concat them to the final tag. Also, check with Honeywell to see if there is a swap parameter prior to sending the data.

Share this post


Link to post
Share on other sites
I can't remember exactly where, but I'm sure I've seen an instruction for this exact situation in the help files...maybe FAL or BTD? I'll keep an eye out for it and post again if I find it :)

Share this post


Link to post
Share on other sites
Aha. Swap Byte. See attached screenshot, hopefully this can do what you need :) By the looks of it you may have to run it through a couple of times in different modes to get it completely re-ordered. You could possibly use an AOI to tidy it up. Edited by ASForrest

Share this post


Link to post
Share on other sites
Thanks for the replies. The problem with that swap byte instruction is that it is only applicable to INT, DINT, and Reals (note that SINT values are not included). The way the instruction help is shown using the letters, I feel, is actually somewhat misleading. I can swap some DINT values around and then change the DINT tag's "Style" under the tag browser to ASCII and see lettering but this does not mean I can view the tag as a string value, on an HMI for example. It would only show up as the numbers. I believe y2k's suggestion may work, although I'm having some issues with it upon first trial. When copying an INT value after performing a byte swap into a String's Data element, the characters are again rearranged probably because the string's data elements are of the SINT type; I'll keep trying may be. The amount of instructions this may require is probably more than I want to add for this one application so I may just send a number corresponding to one of say 20 different string values and then translate it on the HMI with a multi-state indicator.

Share this post


Link to post
Share on other sites
Whoops, didn't read your first post properly. Never mind, you quite effectively nerd sniped me with that one. Try this :) Decode Honeywell String AOI.zip

Share this post


Link to post
Share on other sites
By the way. The "length" parameter is the max length of the string (82 for a standard string), not the actual length of the string contents. If your string has a max length of less than 82, make sure you change this parameter or you'll probably fault your processor

Share this post


Link to post
Share on other sites
Yes, that custom instruction is working. I ended up modifying it somewhat but my hats off to you for clever ladder design. Appreciate the input on this one. The solution is basically a series of copy, swap, and copy instructions for those interested. I believe the original HW serial interface was set up to communicate with the older PLC 5 and SLC 500 series so perhaps their string configuration was different? You basically have to map your tag to a file number and '9' is the designated string number. I thought I recall that file 9 however was an integer file by default in the last SLC 5/05 I saw. Edited by RhodyCho

Share this post


Link to post
Share on other sites
Glad I could help :) what modifications did you end up making?
1 person likes this

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