AB Micrologix 1100 string help

DaytonPLC

Member
Join Date
Nov 2013
Location
Beavercreek, OH
Posts
18
Thanks for taking the time to read this.

From a string I am receiving vis RS232, I'm trying to convert that to a REAL or Floating Point. I need to make HIGH/LOW limits from that number that's in the string. So I need to convert that number in the string to an actual number so I can do that. it has a decimal point so it has to be a floating point number. Done this in Logix5000 a million times but we are saving money and recycled an old 1100 PLC

Anybody else have had this issue? Thanks
 
This ought to do the trick!

Edit: wait, just saw that it has a decimal point...let me think about this some more...

Screen Shot 2016-08-23 at 2.41.48 PM.png
 
Okay. I would find out what the ASCII code for a decimal point is, and then search for that in your string data array. Once you find it, subtract it's position in the array from [string length minus 1]. So, if your string was 1234.56, your string length would be 7, and your decimal point would be in array element 4. (7-1)-4=2. Store that "2" somewhere handy.

Now, strip the decimal point out of your string. There are a few ways you could do this, but if you're familiar with manipulating strings, you should be able to find a way.

Next, throw in my rung above. You will end up with 123456 in F8:0.

Go back to your calculation from before, and get the value of 10 to the power of [previous result]. Your previous result was 2, so 10^2 = 100.

Finally, divide your REAL by the result from the previous step (i.e. 100), and you have 1234.56.


Another example: 987.65432
DP is in array element 3, string length is 9. (9-1)-3=5.
10^5=100,000
98765432/100,000=987.65432

Since the ML1100 doesn't have the CPT instruction, you could be up for some fun with the math, but I'm sure with enough brute force you can make it work!
 
My copy of the free logix 500 for the micro 1100 does not show support for any of the usual string manipulation instructions - ACI, AEX, ASC, etc.

I believe the only way forward, and it's clunky, is shown in the attached screenshot. As you can see, there's some work to do to get where you're going.

Note: the data[x] technique is not supported in any Rockwell literature I've seen.

Also, IIRC, the desired string character ( DATA[x] ) is accessible only by a literal, you cannot step through the string with, say, a counter as a variable.

RS500 string extract.png
 
Last edited:
Thanks for everybody's help... It was chunky for sure but I figured it out. I had to find the decimal point and put the results in an int. Then add 1 and sub 1 from that results and put the results in different ints. then chunked out the numbers left and right of the decimal point and stored those in different strings. Then did an ACI to convert string numbers to an int's. Then I took the 2 numbers that were right of the decimal and did a MUL .01 results to a floating point and added the results to the number left of the decimal to a nother floating point. Bam!

Crazy way of doing it. I got spoiled with Logix5000 just using a STOR...
 
Glad you got it working!

Doug-P, that screenshot of mine was taken on a project where a ML1100 Series A was specified, and the instructions were available and the project compiled. Must be the version of software that doesn't support the instructions, rather than the hardware - which is news to me, I thought the restrictions were always hardware based! I wonder what would happen if you tried to go online with a ML1100 with your version of the software, that already had those instructions in it?
 
Well shut my mouth!

Doug-P, that screenshot of mine was taken on a project where a ML1100 Series A was specified, and the instructions were available and the project compiled. Must be the version of software that doesn't support the instructions, rather than the hardware - which is news to me, I thought the restrictions were always hardware based! I wonder what would happen if you tried to go online with a ML1100 with your version of the software, that already had those instructions in it?

Just for giggles I loaded a one-rung program and it works on the default 1100 ser. B in the Micro Starter Lite. Once it compiled I figured the emulator would choke on it but, no.

Perhaps the OP could try this, it might work to simplify the logic. I was basing my statement on the second screenshot.

micrologix AEX.png micrologix AEX help.png
 
Hmm, I didn't think to check the help files...but according to the help files, even the ACI instruction is unsupported on the ML1100. Strange. I don't have a ML1100 handy to test with, either, only a 1400!
 
Hmm, I didn't think to check the help files...but according to the help files, even the ACI instruction is unsupported on the ML1100. Strange. I don't have a ML1100 handy to test with, either, only a 1400!

I was going to run this through the emulator for a test, but saw the same thing in the help file. Offline, the editor (RSLogix500 standard) did verify without errors a single ACI instruction with a ML1100 series B. I might have a ML1100 hiding somewhere around the shop...

EDIT: It does work in the emulator...

Even with ASCII instructions, it still gets hairy. You don't have the XPY instruction to be able to figure out how many tens places to divide the mantissa string by. So you could cheat and just fill the string out to a known length with zeroes, but then there's the limitation of integers using the ACI instruction...If you know the value will always have a fixed number of digits before and after the decimal point and neither piece will exceed 32767, then you can hard code those parts...

In any case, I would be sure to check and clear the math overflow trap on this controller.
 
Last edited:

Similar Topics

I am having a problem writing a string containing backslashes into an ST:9 file of an ML1100. I have the serial port set to ASCII and am sending...
Replies
6
Views
2,864
I need to transfer string data from a MicroLogix 1100 to a ControlLogix 5000 L72 system. The string data resides in File ST9:0 on the MicroLogix...
Replies
6
Views
3,792
Guys I know this has been talked about but I couldn't find it. I need to do a bunch of ASCII read and writes in a 1100. It doesn't support...
Replies
4
Views
2,577
I have a micrologix 1100 and I need to extract characters from a string data type and store the ascii values for each character in an integer type...
Replies
7
Views
13,231
Does any one knows if micrologix 1100 would be a good choice to receive ascii string characters by Ethernet port and forward it using rs232 port...
Replies
1
Views
5,506
Back
Top Bottom