0

I have a weigh scale controller I am connecting to my TwinCAT PLC. The ESI file from the manufacturer maps 18 input bytes individually, but the information read is grouped into 4 byte (DINT) or 2 byte (UINT) chunks.

I'm trying to avoid the need to individually link each of the bytes to the physical IO. Is it possible to map only to byte0, but still read all 18 bytes?

I would then break the 18 bytes out into chunks to generate the tags I need.

At present I am going to have to map each of the 18 input bytes individually then copy them into a UNION struct so I can generate the outputs. Makes the mapping painful, so hoping to find a way to avoid this.

Any advice gratefully received!

Duncan
  • 3
  • 2
  • 1
    I think you can link all of them at once if you have a `STRUCT` which has the same number of elements and types as your 18 byte input from the IO. See https://stackoverflow.com/questions/73009732/how-can-link-bit2-type-to-a-variable – Roald Oct 26 '22 at 06:55

1 Answers1

0

The magic is in Change Multi Link. I tested Roald's suggestion and it does work with Multi Link, in fact the structure doesn't even need to have the same variable types or sizes as long as the total size is the same as the combined size of the items you selected on the mapping screen; it maps them on a byte-for-byte basis. If you have Matching Size turned on in the link screen, it will show a single item for any structures or variables that match the size of your selected I/O.

Another approach would be to use arrays, which could be mapped in the same easy fashion, but this offers less flexibility since you couldn't have varying data types.

kolyur
  • 457
  • 2
  • 13
  • 1
    This worked for my needs. An array of 18 bytes can be mapped to the IO in a single action as follows: - Right click the array (not the individual bytes) - select 'Change Link...' - shift-click to select all 18 bytes from the IO Box. (If I/O vars are not showing, try selecting 'Array Mode' from the filters) This will map all individual bytes into the byte array. Thanks for the pointers! – Duncan Oct 27 '22 at 02:12