Micro 1100 to compactlogix MSG

stateline

Member
Join Date
Dec 2016
Location
Nebraska
Posts
13
I'm working on a project currently that is requiring me to log a username and a and number. I need to MSG a string file, the username, and an INT, the number, to a L306ER. Once I save the data to the L306ER I then want to collect that data on a remote computer to have a master backup of all events. I will also need to MSG from a Micro850 to the same L306ER. Looking for some guidance on what the best route is for this and what a good software would be to install on the remote computer to data log.
 
Last edited:
Welcome (back) to the PLCTalk forum community ! This sounds like a neat project.

I'm curious about why the CompactLogix 5069-L306 is involved at all. Is it just acting as a data concentrator, or does it need to make some decisions based on the information from the MicroLogix ?

Does the remote computer have to be inside your enterprise network, or is a cloud service preferred ? How do you plan to view or log or act on that data ? Do you have a SCADA / HMI / MES system that you need to integrate with ?

How often do these events occur that need to be logged ? That might inform how you set up buffering or polling or triggering logic.

At the low level, the important fact is that the MicroLogix 1100 doesn't know anything about CompactLogix tag names. The CompactLogix has to be set up to emulate SLC-500/MicroLogix style data table files, and can only emulate 16-bit "B" and "N" type integer files, and 32-bit F (Float/Real) type data files.

The CompactLogix cannot emulate any other compound or complex data type, including Counters, Timers, PID control, or Strings.

So the simple answer is "copy the String data into an array of INTs, and send that data to the CompactLogix". I will have to double-check in the MicroLogix 1100 to see if the COP instruction can copy all the contents of a String to an N-file all at once.

If it were me, I would probably make the first word a transaction ID, and the second word the value to be logged. The third word would be the string length, and the subsequent words would be the string data, two characters per word.

The Micro 850 does have some ability to understand CompactLogix tags; I have less familiarity with messaging from Micro 850 -> CompactLogix.
 
Is the -L30x series MSByte-first or LSByte-first?

Whatever protocol is used under the hood, the MSG will probably handle the byte ordering of the INTs containing number and the string length, but moving the string data from MicroLogix at two-characters per INT could require some fancy footwork. It might be easier to transfer one character per INT.
Untitled.png
Also, ChatGPT yielded the following dialog, but I was unable to verify its answer:
drbitboy:
You are a PLC programmer, an expert in Allen-Bradley PLCs. Is the byte ordering in CompactLogix 5069-L306 series controller MSB-first or LSB-first?
ChatGPT:
As an AI language model, I don't have access to the specific details of every model of Allen-Bradley PLCs, and I cannot confirm the byte ordering of the CompactLogix 5069-L306 series controller. However, according to the CompactLogix 5069-L3xx Controllers User Manual (Publication 5069-UM001), the byte ordering is configurable and can be set to either MSB-first (big-endian) or LSB-first (little-endian) through the controller's settings.

To determine the current byte ordering of the controller or to change it, you can access the controller's configuration settings through the Studio 5000 Logix Designer software. The byte ordering can be set under the "Controller Properties" section of the project settings.
 
Please don't make me argue with ChatGPT, especially when it talks out of its language-model butt.

ControlLogix is "little-endian" and LSB-first. It always has been, and cannot be configured differently. The 1756, 1769, and 5069 controllers are all the same in that fundamental way.

What is important here is understanding how SLC/MicroLogix, ControlLogix, and Micro 800 store and address String data. That's slightly different between platforms and important to Stateline's application.

Without getting too deep into the weeds, a MicroLogix uses a 16-bit Word for the Length, and packs the characters two at a time into 16-bit words. The fixed memory allocation for an ST data table element in a PLC-5/SLC-500 or MicroLogix is that Length word plus 82 characters (so 42 total Words).

ControlLogix uses a 32-bit Double Word for the Length, and packs the characters one at a time into an SINT[x] array. The default length is 82 characters but additional String datatypes can be created with different lengths.

If the data is going to be written to a 5069 CompactLogix from a MicroLogix 1100, then it needs to be packed into an Integer data file first.

If it were me, I would prepend a transaction ID number, then the "Number" value as a Word (or two, if it's a Floating Point value), then the String Length, then 41 words of the String data. That's simple for the MicroLogix to originate a message to the CompactLogix on-demand and send all the data in one transaction.
 
Please don't make me argue with ChatGPT, especially when it talks out of its language-model butt.
:ROFLMAO: I wouldn't think of doing that.

If it were me, I would prepend a transaction ID number, then the "Number" value as a Word (or two, if it's a Floating Point value), then the String Length, then 41 words of the String data. That's simple for the MicroLogix to originate a message to the CompactLogix on-demand and send all the data in one transaction.
Okay, lets see how that goes.

  • Micrologix has a string, s, say it's 2 characters long and the string is "@A" (as in the image I posted)
    • So s.LEN
      • has a value of 2, and
      • is a 16-bit signed INT
    • s.DATA[0]
      • is the first INT of the strings,
      • containing the first (and in this case the only) two characters, and
      • its value is 4041h (0x4041),
        • with the 0x40 (=64 decimal) as the high byte
          • which 0x40=64 is the ASCII code for the first character of the string i.e. '@'
        • with the 0x41 (=65 decimal) as the low byte
          • which 0x41=65 is the ASCII code for the second character of the string i.e. 'A'
  • The MicroLogix sends the data as four or five INTs
    • Transaction ID (one INT); let's say the value is 1
    • Number (Say it's a Long and takes up two INTs); let's say the value is 42
    • String length (one INT); value is 2
    • String data (82 INTs); value of first INT is 0x4041
  • The CompactLogix receives the INTs in an array
    • Transaction ID; INT; value = 1
    • Number; 2xINT ; value = 42 (low and first byte) and 0 (high and second byte)
    • String length; INT; value is 2
    • String data; 41 INTs; value of the first is still 0x4041
  • The CompactLogix converts the INTs
    • Transaction ID is MOVed from array[0] into an INT or DINT
    • Number is COPied from array[1] and array[2] to a DINT
      • Byte order is the same i.e. LSWord-first,
      • so array[1]=42 goes into low word of DINT, and
      • array[2]=0 goes into high word of DINT
      • value of DINT is 42;
      • if it was not, then SWPB instruction could be used to fix it
    • String length INT is MOVed from array[3] to clxsstr.LEN (DINT)
    • String data are COPied from 41 array[4..44] INT elements to 82 clxstr.DATA[0..81] SINT elements:
      • value of 0x41, from the low byte of LSByte-first INT array[4], is COPied to SINT clxstr.DATA[0]
      • value of 0x40, from the high byte of LSByte-first (MSByte-second) INT array[4], is COPied to SINT clxstr.DATA[1]
      • the rest of the INTs data are also COPied, but since the string length is 2 they will be ignored
    • clxstr string elements are now:
      • clxstr.LEN = 1, and
      • clxstr string data are '$41$40' i.e. 'A@'
      • i.e. the characters have been swapped
        • that is what I was getting at with that image in my previous post.
        • It's solvable (41 SWPBs),
          • but only if we know it needs to be solved.
Bits. Bookkeeping.
 
Last edited:
Sorry guys it was a busy weekend. I will give a better run down of what is going down. There are currently three PLCs installed in the plant. There is a micro 850, Micrologix 1100, and the 306. All are connected together on a network and connected to the remote computer. Each of the PLCs is used to mix batches which requires an operator to login to the system. Once logged in I have each PLC logging the last 50 Users and the amount of product they used. They are now wanting to maintain a large database recording this information without having any of it fall off. I was wanting to have the 306 keep a log of the last 50 for each system in addition to to sending the information to the remote computer. I could have each system talk to remote computer individually If there is a good way to log the string and int. I was going to use the OPC server to pull the data but couldnt find a way to pull a string from the Micro850 to the server. If there is a way I could go that route.
 
So the purpose of the last-50 on the 306 is

1) so only one PLC delivers records to the large database?
2) to keep a buffer and/or backup of recent records in case connectivity to the large database goes down for a time, so any records buffered will be sent to the large database when connectivity is restored?

You could also replace each string with a code, and then store the codes as well as the code<=>string mappings, in the database. Then your OPC approach would work.

Since you have a test bench, that is where I would spend my effort. I suggest loading a number, string length and string into an array of INTs on the 1100, send (explicit CIP, I think it's called?) that array to the 306, and converting the array back to the number, string length and string. It may not be necessary to do that in the end, but you will learn something by doing it. It will either be working, or not and you will know why, within an hour or so.


update: I stumbled onto this thread; you may not be the first.
 
I was thinking of approaching it the same way. Assign the user name a number and then send that number and have the user names saved in the 306 in the same order with a number attached to them. It was a thought but then you have to worry about them keeping the user names in the same exact order on all systems
 
Also it doesnt have to be only the 306 delivering the data. Each system could do it on its own if I can find a way to get it done.
 
What does the "large database" look like? How much control do you have over its ingest pipeline?

PLCs are at best awkward for doing this kind of thing, so the least common denominator for the protocol makes the most sense e.g. as @Ken Roach suggested, a 43-word array: 1 number; 1 string length; 82 characters (41 words) of string data; have the large database system sort out the details after the data arrive. This could done with a few dozen lines of Python on the remote PC, but what's easy for me may not be suitable for you.
 
Yeah Im not the best with python, been probably three years since ive done anything with it and I havent done much with it to begin with. Currently the only thing I have going on is each system recording its last 50 uses. I have not done anything with the large database yet and was looking for recommendations on a system to use for collecting the data via rslinx opc server. If it is possible to pull the data directly from each plc I would be fine with going that route but as I said earlier I wasnt able to get the OPC server to read strings from the 850. I will look into that tech note you posted and see if I can come up with anything with that. Unfortunately I do not have a 850 to test with currently.
 
Also I could possibly have the 1100 and 850 just message a int, 1-20, as there are only 20 users in the system and assign each of them a number. Then when the 306 receives that I could load a string value based upon what number was sent and then avoid having to msg a string. IE user1 is assigned number 1 in all 3 systems. When the 306 receives a 1 in could load a string with the user name associated to it instead of sending the entire string.
 
Last edited:

Similar Topics

I am trying to integrate a Cognex Insight Micro 1100 camera with a CompactLogix 1769-L32E PLC. I am trying to use the ethernet communication port...
Replies
2
Views
4,849
Hi! I need help converting an old MicroLogix 1100 project to Micro 820. Project Details I have an old MicroLogix 1100 program that has been in...
Replies
0
Views
475
Is it possible to write to the high speed counter function file "high speed preset" on an AB micro 1100. I have the HSC set up with a MOV...
Replies
3
Views
1,086
Does the 1100 only have 1 high speed counter, but it can have multiple inputs? And so then the 1400 has 6 HSC and you have a choice of multiple...
Replies
1
Views
1,718
Is it proper to use the S:4 instruction ie: S:4/12 for a flasher?
Replies
6
Views
1,711
Back
Top Bottom