meta data for this page
  •  

This is an old revision of the document!


BYTE – WORD type variables

There are plenty of variables in the world of automation. They differ in scope (size) and internal structure depending on their use.

The simplest variable types have no internal structure, i.e., they can describe ones and zeros in different scopes:

BYTE – WORD type variables

The longest 64-bit LWord didn't fit in the example above, but I think it's relatively easy to imagine. The byte positions are on the bottom row. If everything works well, this is the byte order for the longer variable types, but sometimes confusion arises in the matrix, and this order gets “tangled”.

This most often happens when we try to transfer long variables via communication to other systems, such as HMI. In such cases, it is definitely worth testing the transfer, for example, with the above trick, because when the specified #deadbeef is on one side. If the destination side shows #beefdead or #efbeadde, we can rightly suspect a conversion discrepancy, which is easiest to correct on the starting side by swapping the structures.