String transfer from CompactLogix to Micrologix

Join Date
May 2011
Location
South Carolina
Posts
87
Hi all. I know it is late in the day on Friday but I am stumped on something. I am doing a string transfer via messages from a CompactLogix L24ER to a ML1400. I got the data to transfer but am having a problem putting it back together in the ML1400. I will attach a screenshot of the L24ER logic, the ML1400 logic and the data table from the ML1400. In the data table ST98:0 is what I should be getting and ST98:1 is what I am getting. It is close but I am stumped as to what is needed to fix the issue. Any help is greatly appreciated.

L24ER Logic.jpg ML1400 Logic.jpg ByteSwap.jpg
 
Are both of the MSG instructions aimed at N7:50 - N7:101 ?

Verify the length of your MSG instruction and its MicroLogix target address in the MSG configuration in Studio 5000.

It looks like you're truncating the first 16 bits, of course, which should have the "10" ASCII characters. You get the /00/00 at the end because you've forced the LEN = 12 and there are just nulls in the empty rest of the string.

Post the actual contents of N7:50 - N7:62 if you can, in hex or ASCII.

And post the actual contents of Test.PLD_N_File[0] through [12].

It certainly looks correct. The fact that ST98_9_String.LEN is a 32-bit DINT in the CompactLogix should not matter because you are using a MOV to a 16-bit INT array element. It should simply move the 12 into that PLD_N_File[0] element.
 
I don't have a CompactLogix to start with, but I am able, on a MicroLogix 1100, to swap the characters in a source string character by character into an intermediate string, then reconstruct the source string by applying the SWP instruction to that intermediate string; see below.

swapstr.png
 

Attachments

  • swapstr.pdf
    306 KB · Views: 6

That is more or less what OP is already doing, although OP is doing the swap on the 1400, while @BachPhi's example does it on the CompactLogix; it should not matter.

I wonder if the subroutine shown in OP's [ML1400 Logic.jpg] is being called.

I did some fiddling on my MicroLogix 1100, but found to RSLogix Micro Starter Lite would not let me use COP or CPW to move data between any INT files and any strings' .DATA INT arrays, so I had to write some extra code to transfer those data, but once that was in place I was certainly able to handle the byte-swap:

  • MAIN Rung 0000: copy source string (ST9:0) to N50 file
    • Emulates STRING to INT on CompactLogix, without byte-swap yet
  • MAIN Rung 0001: copy N50 file to N51 file, then swap per-INT bytes in N51 file from N51:1 to the end, leaving source string length in N51:0 alone
    • Emulates MSG transfer of INT data from CompactLogix LSB-first to MicroLogix MSB-first.
  • MAIN Rung 0002: transfer N51 file, with swapped bytes to swapped string ST9:1, and duplicated to ST9:2
    • ST9:1 is only used as a snapshot of the swapped data e.g. for diagnostics
    • ST9:2 emulates data, with swapped bytes, from MSG transfer arriving on MicroLogix from CompactLogix
  • MAIN Rung 0004: swap bytes in ST9:2.DATA[0]
    • Reverses byte-swap from Rung 0001 in this test
    • Would also reverse bytes, if ST9:2 actually came from a CompactLogix MSG transfer.
  • LAD 3 and LAD 4 are what I cobbled together because I could get neither COP nor CPW to accept string .DATA[0] as either Source or Dest parameter.

string_msg_transfer_with_swap.png
 
I could not get the RSLogix 5000 program to zip to a file size compatible with the upload requirements. Attached is a screen shot of the N7 file, PLD_N_File and the configuration of both the Template and Test String messages.

After Ken's reply I did notice that I was sending to N7:50 with the length and then sending the String Data starting with N7:50. I changed those as you can see in the attached screen shots but still not getting the correct String value.

N7 File.jpg Template Message.jpg Test String Message.jpg PLD_N_File.jpg
 
Last edited:
Looks like it was working at one point cf. the reversed pairs of two-byte hex value 0x3031 in N7:51 becomes 0x3130 in N7:1:

$ python
Python 3.8.12 (default, Oct 12 2021, 13:49:34)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for lyne in sys.stdin: print(hex(int(lyne.strip())))
...
12337 <==N7:51-----------+
0x3031 |
12598 <==N7:52---------+ |
0x3136 | |
14131 <==N7:53-------+ | |
0x3733 | | |
13621 <==N7:54-----+ | | |
0x3535 | | | |
12592 <==N7:54---+ | | | |
0x3130 | | | | |
14640 <==N7:56-+ | | | | |
0x3930 | | | | | |
12345 <==N7:6--+ | | | | |
0x3039 | | | | |
12337 <==N7:5----+ | | | |
0x3031 | | | |
13621 <==N7:4------+ | | |
0x3535 | | |
13111 <==N7:3--------+ | |
0x3337 | |
13873 <==N7:2----------+ |
0x3631 |
12592 <==N7:1------------+
0x3130



 
Last edited:
Here is the N7 File in Hex. It looks like I am losing some of the data in the transfer, but not sure why or how.

In the decimal version of File N7 (N7.jpg in post #7), you were not losing those data.

Also, why not transfer all 42 16-bit INTs, starting at Test.PLD_N_File[0], in one MSG instruction?

Are you sure Test.PLD_N_File is an array of INTS and not of DINTs? [Update: whoops, never mind, the last attached image in Post #7 shows it is an array of INTs]
-
 
Last edited:
I finally got it to work after everyone's help. I changed the first message to transfer all of the data at once and got rid of the second message. I then did a byte swap in the ML and it worked. THANK YOU VERY MUCH!!!


Sorry I was incorrect. I tested it again and it isn't working.
 
Last edited:

Similar Topics

What I am triying to do is to transfer and display on the PV600 values stored in strings on the PLC, and viceversa being abble to doing text input...
Replies
0
Views
3,795
Hi all, I'm trying to connect WinCC Pro to SQL server through OBDC. Everything is okie, I'm able to transfer number, DateTime and even a direct...
Replies
2
Views
1,448
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,790
I know I'm doing something wrong here, but for the life of me I can't get the Omron Designer Software to see the String Data in the NJ (Also...
Replies
1
Views
1,541
Hello, I have created a String variable in VBScript. I don't know the String's length, because it is changing during Runtime. But let's say it's...
Replies
0
Views
1,727
Back
Top Bottom