How to give an address to variables that are part of an structure in EcoStruxure Machine Expert?
Issue:
This FAQ provides an alternative for assigning addresses to variables that are part of a structure in EcoStruxure Machine Expert, as this process is not intuitive.
Additionally, this FAQ includes an example illustrating the relationship between different memory types (e.g., %MLx, %MBx, %MWx, %MDx, %MXx).
This information is useful when using the Modbus TCP protocol to read tags from an M241, M251, or M262 controller and share them with another device (e.g., SCADA, HMI, PLC).
Product:
EcoStruxure Machine Expert (previously SoMachine)
Environment:
PLC Configuration Software in Windows
Resolution:
When using Modbus TCP, you must assign an address to the variables. If you are working with structures, follow the steps below:
a. Create a structure and calculate its size in bytes.
b. In Machine Expert, use %MLx to address structures. This memory type occupies 8 bytes.
Depending on the structure size, you must leave enough space between instances to avoid overlap (unfortunately, this must be done manually).
In this example:
- %ML0 starts at %MB0 (Memory Byte).
- %ML3 starts at %MB24.
This spacing ensures all tags fit properly.
c. Create a tag for each element of the structure instance and assign an address using %MWx (INT/WORD), %MXx (BOOL/Bit), or %MDx (REAL), depending on the data type.
d. Validation.
In this example:
a. Structure GateOC is create that consist of 17 bytes.
Note: 6 INT (2 bytes each) + 2 BOOL (1 bit each, so 1 byte is required) + 1 REAL (4 bytes) = 17 bytes
b. Create each structure instance and assign it a %MLx address, leaving enough space to prevent overlapping.
c. Create a set of tags for each instance, in the picture below a set of tags was created for instance CokRecLg1TpGt.
Note: Not all tags use %MWx, but the comments show the relationship between %MXx and %MDx with the %MWx memory type.
d. Validation.
Each color represents a different case, and in the end, everything aligns. Yellow is consistent across all three representations, as are sky blue and purple.
For the REAL tag:
WORD 1 = 33,554 (lower 16 bits)
WORD 2 = 16,288 (upper 16 bits)
REAL ≈ 1.254
Unfortunately, this is the only way to assign addresses to tags inside a structure in Machine Expert. It is a manual process, and you must maintain proper order to ensure tags do not overlap
Publikováno pro: Schneider Electric Česká republika
Potřebujete pomoc?
Nástroj pro výběr produktů
Rychle a snadno vyhledávejte správné produkty a příslušenství pro vaše aplikace.
Získejte nabídku
Poptejte se nás online a náš lokální specialista se s vámi spojí!
Kde nakoupit?
Jednoduše najděte nejbližšího distributora výrobků Schneider Electric ve vašem okolí.
Centrum nápovědy
Zdroje podpory pro všechny své potřeby najdete na jednom místě.