Sign in to follow this  
Followers 0
BlurDavinci

String in Micrologix

7 posts in this topic

I need to place character or string in the ST (string table), beside directly key into the the string table, which is easily erase or modfiy accidentally. I need to know how to "move" say character "i" (=hex 69) or space into ST table. ? how Thanks

Share this post


Link to post
Share on other sites
Hopefully by Micrologix you mean a ML1100, 1200, or 1500 and not an ML1000. The ML1000 does not support strings. Take a look at these instrucitons in the Micrologix instruction set reference manual available at AB's online literature library. ACI Converts a string to an integer value. ACN Links two strings into one. AEX Extracts a portion of a string to create a new string. AIC Converts an integer value to a string. ASC Searches a string. ASR Compares two strings.

Share this post


Link to post
Share on other sites
sorry I don’t have time to go into all of the details right now, but these rungs should help you experiment and discover the basic ideas that are involved ... notice that we’re MOVing the contents of string ST10:0 to string ST10:1 - but we’re using N7:0 along the way just so that you can see how the values are displayed on the screen ... so “i<space>” amounts to two characters (the LEN value) ... and note that you can’t see the <space> character on the screen ... note that the integer N7:0 can hold TWO separate ASCII characters ... note that the “i” character is ASCII code 69 ... note that the <space> character is ASCII code 20 ... so N7:0 is displayed as 6920 when the radix is set for Hex/BCD ... on the regular display window, this pattern is indicated as the decimal equivalent value of 26912 ... final note: in MANY cases, it’s easier to simply store repeatedly used characters (such as “i” and <space>) in separate STring locations and then use the ACN (ASCII Concatenate) instruction to “tie things together” to have your program build the string that you want ... if you can tell us more about what you’re trying to do, we can offer more specific help ... hopefully playing around with this little “show and tell” program for a few minutes should help you understand everything that’s going on ... Edited by Ron Beaufort

Share this post


Link to post
Share on other sites
My intention is actually sending string to a printer. Date Time Data1 Data 2 Data1 =Float type Data 2 =Integer If I would to place the String at specific location, I'm more concern some one accidentally deleted or overwrie the value store at ST By the day, how do I convert Float into string? Thanks

Share this post


Link to post
Share on other sites
Depends, is the float larger than 32767? Have decimals? How many places?

Share this post


Link to post
Share on other sites
Greetings ... click here and here for some sample programs which I wrote for previous questions like yours ... these might be useful ... they deal with converting numeric values (including floats) into string values ... I think that the second link is probably going to be more helpful for your specific application ... if I understand your problem correctly, the second program that I've linked is "backwards" since it goes FROM an ASCII string and converts TO a floating point number ... I think that you're interested in going the other way ... still the basic technique might give you some ideas ... we can offer more help with the conversion from float to string IF you can tell us more about the specific requirements of your program ... something along these lines would be a good start: the largest floating point number I will ever need is 999.999 ... the smallest floating point number I will ever need is 0.000 ... I will only need three decimal places of precision ... I will never need to deal with negative (-) floating point numbers ... Edited by Ron Beaufort

Share this post


Link to post
Share on other sites
There are several tech notes in AB's knowledge base that have sample programs that show how to convert floating point numbers to strings and strings to floating point numbers. See the following technotes. 29902 37115 36899 (PLC 5) 20280 (string to float)

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