Explainer
Why a Twido needs no Comm macro or EXCHANGE for an HMI button
Short answer
The Magelis panel is the Modbus master, so Vijeo Designer polls and writes the Twido's %M and %MW memory directly and the PLC serial port answers by itself. The Twido needs no Comm macro or EXCHANGE for this link — only a Modbus port with matching address and frame settings, plus one rung (normally open %M1 contact driving %Q0.0). Comm macros and EXCHANGE belong only when the Twido itself must act as master.
On this page
- Why does a Twido need no Comm macro or EXCHANGE for an HMI button?
- What are Comm macros and the EXCHANGE instruction actually for?
- How do you wire the Magelis panel to the Twido's RS485 module?
- Which serial settings have to match on both ends?
- What does the HMI button write, and what do Set, Reset and Toggle do?
- What ladder does the Twido need to turn the button bit into an output?
- How fast does the link refresh a button bit with no PLC code?
- When does a Twido genuinely need Comm macros or EXCHANGE?
- How do you prove the link before you trust it with a motor?
- Questions asked
A Magelis panel running Vijeo Designer is the Modbus master of the link, so it reads and writes the Twido's %M and %MW memory on its own, and the Twido's serial port answers those requests automatically. The PLC needs no Comm macro, no EXCHANGE instruction and no ladder beyond the rung that turns the request into an output — for the start-button case, a normally open %M1 contact driving coil %Q0.0. What the Twido does need is a configured serial port (Modbus RTU, a fixed unit address, matching baud rate, parity and stop bits), correct RS485 wiring and termination, and Vijeo Designer variables bound to the same addresses. This article separates what the panel does from what the PLC does, shows that one rung, and runs the numbers that tell you why a polled button never needs a PLC-side communication program.
Why does a Twido need no Comm macro or EXCHANGE for an HMI button? #
The Magelis panel is the Modbus master, so Vijeo Designer polls the Twido's %M and %MW memory itself while the Twido's serial port answers those reads and writes in the background — the PLC program has nothing to do with running the link.
Modbus is master/slave by design: a master sends a request carrying a unit address, a function code and a CRC, and the slave with that address answers; a slave never initiates anything, so there is nothing for your program to start. In Vijeo Designer the equipment connection is the master side — it builds each frame, checks each reply and refreshes the screen variables from the controller's memory. The answering happens in the Twido's communication layer, ahead of and invisible to the ladder. That is why the panel can write a start bit and read a lamp bit while the PLC program contains only control logic: on this link, communication is the port's job, not the program's.
The same role rule explains a classic dead end, the case described in why a PLC Modbus master read returns nothing from an HMI: when the arrows flip and a PLC master aims a read at a panel, the transaction dies because the panel only ever answers. Get the roles right once, and every panel-to-PLC link follows the same pattern.
What are Comm macros and the EXCHANGE instruction actually for? #
They belong to the opposite side of the link: Comm macros and the EXCHANGE instruction let the Twido act as the master and initiate messages of its own — to a printer, a drive or another slave that nobody else is polling.
TwidoSuite groups them with its communication functions, and they are PLC-as-master tooling: read and write requests the controller fires on its own clock at another slave, or raw frames for a device that speaks neither plain Modbus nor any polled dialect. Each one costs scan time, because the program builds a frame, waits out the reply and only then moves on. Typical jobs are a report printer, a weighing terminal, a drive the panel never sees, or a peer PLC. What they are not is a requirement for answering: a polled slave needs no macro, no EXCHANGE and no ladder support, which is the entire point of this article.
The one trap is sharing. If the PLC also runs master transactions on the serial port the panel polls, two masters collide on one wire pair and both sides see corrupt frames and timeouts — the situation dissected in HMI Modbus timeout caused by a PLC master-slave conflict. Give PLC-side exchanges a port of their own.
How do you wire the Magelis panel to the Twido's RS485 module? #
Run a two-wire RS485 cable from the panel's serial port to the terminals of the Twido's RS485 module, match the signal pair and its reference, and terminate both ends as that module's hardware documentation specifies.
Identify both ends before you draw any screen: the serial port and connector on the panel, and the RS485 communication module on the Twido rack, with its signal terminals and reference in that module's own documentation. Schneider Electric publishes a support resolution for exactly this pairing — a Magelis STU panel to a Twido over its RS485 ports — and it is a good model for the order of work: cable first, settings second, variables last. Use the terminals your hardware documents show, not a pinout remembered from another product.
Respect the ground path as well. A millivolt-level difference between the earth potentials at the two ends is tolerated; a common-mode voltage in the supply range is not, and that case calls for an RS-485 isolating module rather than a longer cable. Missing termination and wrong settings look identical on screen — a link that never answers — so prove the electrical layer before touching any configuration.
Which serial settings have to match on both ends? #
Protocol, unit address and frame format must match: set the Twido port to Modbus RTU at a fixed address — for example address 1 — and enter the same address, baud rate, parity and stop bits in the Vijeo Designer equipment connection, on the port the cable uses.
On the Twido, the port mode and the unit address live in the controller's communication configuration; on the panel, the driver, the physical port and the frame settings live in the Vijeo Designer equipment connection, and the driver to select is the one for a Twido over Modbus serial. Protocol is a both-ends decision: Unitelway runs over the same hardware where both devices support it, but a connection configured for one protocol will not accept the other, so pick one and set both ends to it.
Every mismatch in this list produces the same symptom, a link that never answers, and the fastest cure is the checklist in fixing HMI PLC communication timeout over serial. Work through address, baud, parity and stop bits one at a time, and keep the first goal modest: one successful read of one known value, before any button exists.
What does the HMI button write, and what do Set, Reset and Toggle do? #
Bind the button to a %M bit — %M1 for the start request, for example — and give it a write operation: Set writes 1, Reset writes 0, Toggle reverses the bit, and you choose the event that triggers the write: press, release or while pressed.
Create an external Boolean variable in Vijeo Designer, attach it to the Twido equipment connection, and type the device address; from then on the panel writes that exact bit in the controller. The button's configured operation and event decide what lands in the bit and when:
| Operation | What the panel writes to the bit | The request behaves as |
|---|---|---|
| Set | 1 | stays on until something writes 0 |
| Reset | 0 | clears the request |
| Toggle | the inverted value | every operation flips it |
| Set on press, Reset on release | 1 at press, 0 at release | momentary: held only while the button is pressed |
Choose from the machine's behavior, not from habit: a maintained start request suits Set with a separate stop button; a jog-style request suits set-on-press and reset-on-release, as long as you accept that the release write can be lost if the link drops — the failure mode behind press and release actions that leave bits stuck. One cheap insurance rung in the PLC, clearing request bits whenever a stop condition says so, covers every style at once.
What ladder does the Twido need to turn the button bit into an output? #
One rung is the whole job: a normally open contact of %M1 driving the coil %Q0.0, so when the panel writes 1 into the request bit the contact closes on the next scan and the output turns on, with no communication code anywhere in the program.
In ladder notation, the sketch is two symbols wide:
| %M1 %Q0.0 |
|--| |------------------( )-----|
The coil follows the contact on every scan, and nothing in the rung latches: the output stays on exactly as long as the request bit does, which with a Set action means until the panel or the program writes the bit back to 0. Confirm in the real project that the coil address is the output your motor contactor actually uses, and cross-reference it so that no second rung competes for it.
The panel lamps follow the same pattern in reverse, with the PLC as the writer. Allocate a spare indicator bit — %M2 works as an example — and copy the output into it:
| %Q0.0 %M2 |
|--| |------------------( )-----|
An indicator bound to that bit lights exactly when the output is live, and the panel only ever reads it. One writer per address is the discipline that keeps polled I/O predictable: the panel owns the request bit, the program owns the output and the indicator bit, and no address gets a second writer.
How fast does the link refresh a button bit with no PLC code? #
One read-coils request and reply for a single %M bit takes 14 bytes, which at 9600 baud 8N1 with both 3.5-character RTU gaps is 210 bits, about 21.9 ms — roughly 45 full request/reply cycles every second.
Here is the arithmetic in full. A Modbus RTU request to read one coil carries the slave address, the function code, the starting address, the quantity and the two CRC bytes — 8 bytes. The reply carries the slave address, the function code, a byte count, one data byte and the CRC — 6 bytes. One request/reply cycle is therefore 14 bytes on the wire.
At 8 data bits, no parity and one stop bit, a byte costs 10 bits, so the frames alone cost 140 bits. RTU framing adds a silent gap of 3.5 character times before and after every frame — two gaps of 35 bits — which brings a cycle to 210 bits. 210 ÷ 9600 = 21.875 ms, and 1000 ÷ 21.875 ≈ 45.7, so roughly 45 request/reply cycles fit in every second. Writes ride the same budget: a force-single-coil transaction is again an 8-byte frame in each direction.
Two things stack on top of that serial minimum: the panel's own poll interval, and the load of every other variable the screens scan. When a growing application slows the screens down, that stacking is the mechanism behind why an HMI freezes or updates slowly over serial, and the cure is trimming the polled set, not adding PLC code. The same cycle arithmetic scales to a line with several slaves, which the piece on how to poll many Modbus RTU slaves from one serial master works through. For one button and a few lamps, the serial minimum sits so far below what an operator can notice that the PLC-side contribution — none — is never the limiting factor.
When does a Twido genuinely need Comm macros or EXCHANGE? #
The Twido needs them only when it must speak first: driving a Modbus slave that no panel polls, exchanging with another PLC, or talking to a device over a non-Modbus serial protocol.
Open the Comm macro list in TwidoSuite and you are looking at master tooling: requests the controller fires at another slave on its own schedule, or message frames for equipment that speaks a serial dialect of its own. Each one runs where the Twido is the initiator, which is never the case on the panel link — there the controller only answers. So the decision writes itself on the drawing: everything the panel polls — the Twido itself, plus any slave given its own connection to the panel — needs zero communication code in the PLC, and everything only the PLC talks to gets Comm macros or EXCHANGE, configured on a port the panel never touches. In a machine of this kind, the start button, the lamps and the process values are all panel-polled, so the Twido program stays pure control logic.
How do you prove the link before you trust it with a motor? #
Prove the link in steps: read a known value from the Twido, watch the request bit change while you press the test button, watch the output follow with the load disconnected, then wire the permissive chain around the rung. A read that never errs is the gate before any write.
- Download the port configuration to the Twido and the equipment connection to the panel.
- Read one known value — a real input bit or an accumulating counter word — from the panel, and confirm it tracks the plant.
- Bind a test button to the request bit and watch that bit change in the TwidoSuite online view on every press and release.
- Only then add the rung, with the motor circuit isolated, and watch the output coil follow the bit.
- Wire the request into the existing start/stop chain with its permissives, then hand over.
A read that never errors is the gate for every write that comes after it, because a write to a dead or misconfigured link tells you nothing. One rule outlasts commissioning: an HMI button is an operator request, not a safety function — the stop chain, the permissives and the fault handling stay in the PLC program, and no screen object is ever allowed to bypass them.
Questions asked
Do I have to define anything in the TwidoSuite symbol table before Vijeo Designer can see the variables?
No. The TwidoSuite symbol table is documentation for your own program; nothing is exchanged between the two tools at that level. Create the variables in Vijeo Designer as external Booleans and words bound to the Twido connection, enter the device address there, and type the same names in TwidoSuite by hand if you want readable symbols. Two tools, two variable lists, one shared address space.
Can the Vijeo Designer button write the output %Q0.0 directly instead of a %M bit?
Some Twido drivers can address direct I/O, but capability is documented per driver, and it hands output ownership to the screen. The safer interface keeps the exchange in %M and %MW bits that the PLC logic owns: the button writes the request bit, a rung decides the output, and an indicator reads a mirror bit the PLC copies from the output. Direct writes to physical I/O also leave the permissive chain out of the path.
The same Vijeo Designer project must set an Altivar ATV312 speed with plus and minus buttons — does that need EXCHANGE?
Not for the buttons themselves. Either give the drive its own serial connection and let Vijeo Designer poll it as a second Modbus device — the plus and minus buttons then increment or decrement the drive's frequency reference directly — or make the Twido the drive's master, and that second design is exactly where the EXCHANGE instruction earns its keep. One master per port decides which design you pick.
Does anything change if I connect the panel to the Twido over Unitelway instead of Modbus?
The division of work does not change: the panel still initiates every transaction and the Twido still needs no communication program, so the PLC side stays the same rung. What changes is the driver you select in the Vijeo Designer equipment connection and the settings on both ends; Unitelway and Modbus are separate choices, and both ends must run the one you picked.
What happens to the request bit if the cable comes loose while the button is pressed?
The bit holds the value of the last completed write until something changes it: a lost cable freezes the exchange, so a Set-on-press action can leave the request armed with no release write behind it. Clear such requests in PLC logic — a rung that resets the request bit when the machine's stop chain or the application demands it — rather than relying on the button's release event, which may never arrive.