RSLogix 500 ML1100 Integer to String

Bern1885

Member
Join Date
Jul 2012
Location
Kentucky
Posts
2
I've got a Keyence barcode scanner I've got coming in via Ethernet to a Micrologic 1100. I've got the data coming into N Type Data Files and when I view them as ASCII the alphanumeric reads properly etc. My issue is I want to convert these integers into Strings. I can't figure out how to get them to go from N Data file to the String value and not get a verbatim Decimal value to String value. I believe a DTOS instruction would do this in RSLogix 5000 but I'm not for certain. Any help would be appreciated
 
When I use the AIC I just get a direct copy of a 5 digit decimal to a 5 digit string. Ex. I'm using AIC N27:2 ST51:0. I get "N7:2=13360, ST51:0=13360 LEN 5" I believe I'm not syntaxing correctly somehow. I was able to get a MOV N27:2 ST51:0.DATA[0] to work and get a conversion into two characters of the barcode. I may have to move foward doing this and concatenate all then pieces to together through a stack of instructions but I feel as if it shouldn't be that difficult.
 
Use COP instead of MOV.

The target will be the string data element starting at ST51:0.DATA[0], and the Length will be the number of Words you want to move (2 characters per Word).

If you're lucky the byte order will work out. If not, you might have to do some byte swapping.
 
Have you solved how to convert an integer to string?

I have the same problem as you. I will appreciate your invaluable help.


Thank you!
 
Last edited:
22714 - MicroLogix: Converting data from an Integer (N) file to a String (ST) file
Access Level: TechConnect

Regards,
George
 
I've got a Keyence barcode scanner I've got coming in via Ethernet to a Micrologic 1100. I've got the data coming into N Type Data Files and when I view them as ASCII the alphanumeric reads properly etc. My issue is I want to convert these integers into Strings. I can't figure out how to get them to go from N Data file to the String value and not get a verbatim Decimal value to String value. I believe a DTOS instruction would do this in RSLogix 5000 but I'm not for certain. Any help would be appreciated
Hi Bern1885.
Sorry, old post but did you get the comms working to the Keyence?
Could you please share the code please (comms MSG and conversion to string please)
 
Hi Bern1885.
Sorry, old post but did you get the comms working to the Keyence?
Could you please share the code please (comms MSG and conversion to string please)

I spent a great deal of time with Keyence Tech Support yesterday. It turns out that their sample code for the RSLogix 500 was built with ver9 and if you are using ver 10, there was a change to the RIX data type. Rockwell released a patch to fix this change from 9 to 10. Once the patch is downloaded, you need to copy the 2 included files into the directory where you have RSLogix 500 installed. After this is done, download the code to the controller again, and the communications should start to work. At least they did for me yesterday.

This is the link to get the required patch.
https://cdn.livechat-files.com/api/file/lc/att/10558177/b01f06b32fb3d8ebd2edd43c56c016f9/ML1400V10Fix.pdf

I will update later after I determine a solution for translating how the barcode data is received into a usable string as the ASCII is inverted in the N27 integers in their sample code.

I hope this helps get you going in the right direction.
 
Great stuff, many hours later, yes I am using version 10 with the bug.
I installed the patch and down loaded again, still no joy.
In the patch notes, it said recreate code so started a new project.
Progress now, I have the SR1000 red read light flashing and a good read / bad read coming back from the scanner.
I do not have any data in N27:0 though, the message block throws an error:
"Error Code (in upper byte of MGXx:y) was returned by the Comms module or CIP service.

In the Keyence software, in the Ethernet/IP section, there is a byte swap for Rockwell and Other.
 
UPDATE:
I put 32 into N26:0 and now get data back from scanner.

The Byte Swap is not going to help, sorry.
 
I have tried a few options of converting int to string.
The data looks nice in the MSG box receive, but looks ugly in the N27 data file.

So had to do a low byte, high byte swap (but can do in the Keyence software).
I then used the CPW commands.
ConvertIntToString.JPG

BUT:
My barcode is two lines, with Chr(10) OR Chr(13) OR combination.
I need to convert to 2 strings....
And the lengths of the strings are sometimes different....
 
It might make sense to loop and compare for the termination characters, or if indirection is not allowed in the CPW, then a series of rungs.

This might be a case where a small Red Lion HMI or Flex controller could massage the data for you and poke it back into a string with a Crimson program which has better tools for dealing with strings, finding termination characters, etc.
 
It might make sense to loop and compare for the termination characters, or if indirection is not allowed in the CPW, then a series of rungs.

I could not make a COP or CPW instruction work with a STRING file's DATA array, so here is a clumsy, but looping approach that does not need to hardcode all of the CPWs (which should have Length=1 not =2, btw). N.B. there should be something to limit the extracted from N7:0 to 82, to prevent overflow faults.

This works on a MicroLogix 1100 Series B.

LAD 4 is the code OP may want: it copies the INT file's variable string length (N27:0) and character data (INTs N27:2 and onward) into the destination string (ST102:1), and finally does a character swap on everything in that string's INT .DATA array.

LAD 3 is a test harness to prove LAD 4 works. LAD 3 takes a test source string (S102:0) and copies it into an INT file in the form OP seems to be using, including swapping character pairs. Manually editing the string ST102:0 while in online mode will exercise the program.

Apparently SWP works on #STx:y.data[z], but COP and CPW do not, at least in my version of RSLogix. So the intermediate data file (N101) in OP's example is not needed.
 

Similar Topics

Hi, Just starting to code a new project. Not used FIFO's before. I have read the instruction help file in RSLogix, and think I have got it...
Replies
13
Views
11,843
I have a little bit of experience with Allen-Bradley. I have a Micrologix 1500 (RSLogix 500) and a PanelView Plus 7 (FactoryTalk View Studio ME)...
Replies
2
Views
69
buen dia. tengo una falla al pasar los tags de mi plc SLC 5 0/4 a mi panel me aparece un error Problem writing value " " to item <tag name>...
Replies
1
Views
66
Will someone please convert this logic to pdf?
Replies
2
Views
118
Hello, Haven't been on in a while. I need to generate a bit level pdf of the I/O for RSLogix 500. I can generate a report but it just shows the...
Replies
1
Views
143
Back
Top Bottom