Email us

Este artículo está en inglés. Ver el sitio en español

Cet article est en anglais. Voir le site en français

Dieser Artikel ist auf Englisch. Website auf Deutsch ansehen

Este artigo está em inglês. Ver o site em português

本文为英文。 查看中文网站

HMI writes to a VFD over Modbus RTU: fix the write error

Clean frames on the Modbus sniffer with a write error at the HMI point to the tag, not the wire: a Boolean sent to a 16-bit holding register leaves as 65535, which a drive rejects on a control word. Read a known register first — DC bus voltage reads about 648 V DC behind a 480 V AC line — then rebuild the tag as a 16-bit integer carrying the control word's bit sum, 23 for bits 0, 1, 2 and 4.

NEMA4 Enclosure engineering team · Published November 11, 2026 · 8 min read

Short answer: clean frames on the Modbus sniffer with a write error still showing at the HMI means the tag data type, not the wire. A Boolean tag pointed at a 16-bit holding register sends its TRUE state as all ones — 65535 — and the drive refuses that on a control word. Rebuild the tag as a 16-bit integer, write the decimal bit sum the drive's serial manual lists (23 in the worked case below), and prove the link first by reading a value you know: DC bus voltage, about 648 V DC behind a 480 V AC supply. The sections below split the fault hop by hop, run that read, and show the arithmetic that turns the 65535 on your sniffer into the 23 the drive expected.

Which hop is failing

A Modbus RTU write crosses five hops on its way to the motor: the HMI's Modbus driver, its serial port, the cable, the drive's serial port and the drive's application logic. The sniffer clips across the cable, so it splits those hops for you. Read each exchange against this list:

  • No response at all. The drive never saw a frame it recognized: swapped A and B polarity, a missing 120 Ω termination, a wrong slave address, or framing so far off that the port discards the bytes.
  • Garbage or CRC errors. Baud, parity or stop bits disagree between the two ends, or the drive's own output cable is coupling switching noise into the serial pair.
  • A clean request answered by an exception frame. Both ports and the link work; the drive's application logic refused the register or the value you sent. That is the fault in front of you.
  • A clean request answered normally with the flag still set. The write actually landed; look at the error-flag logic inside the HMI project instead of the wire.

Close the framing question before anything else. Modbus RTU's framing default is 19200 baud at 8E1 — 8 data bits, even parity, 1 stop bit — per the Modbus over Serial Line specification. One mismatched stop bit gives silence or CRC errors; it never gives a clean answer. Once a valid frame earns a valid reply, the wiring question is closed and everything left is data. The addressing and wiring fundamentals sit in connecting an HMI to a PLC over Modbus RTU serial.

The four causes, most likely first

With clean frames and a rejected write, four causes cover nearly every case. Work them in this order:

  1. A Boolean tag on a holding register. The sniffer's value field reads 65535 (FFFF hex) on a tag you set to TRUE. That signature accounts for most clean-frame write errors, and the worked example below shows the arithmetic behind it.
  2. An offset-convention mismatch. One tool counts from 0, another from the 40001-style references, so every address lands one step away from the live register. Read the two neighboring addresses and watch which one changes.
  3. The command source still on the keypad or the control terminals. The drive files the write and acts on nothing; the run bits only matter once local/remote sits on serial.
  4. A write-protected or run-locked parameter. Several drive families refuse writes to some registers while the drive is enabled or turning; stop the drive or lift the parameter lock before the tag can land.

The exception frame tells you which cause you are on: a wrong register number and a rejected value answer with different codes, decoded in the FAQ below.

Read a known register before you write

A read changes no drive state, needs no command source and proves address, framing and function code in one move. Pick a register whose value you can check at the keypad. DC bus voltage is the best one: it is always live, and you know roughly what it should read.

A standard 6-pulse diode rectifier charges the bus to about 1.35 times the line-to-line supply. Behind a 480 V AC line that is 648 V DC; at 400 V it is 540 V DC; at 230 V, about 311 V DC. The bus follows the supply, so a reading within a few percent of those figures clears the whole read path in one poll: slave address, function code, register map and scaling.

Read result What it proves What to do next
About 648 V DC on a 480 V drive Address, framing, function code and scaling all correct Move on to the write
A stable number wrong by a constant factor The link works; the tag's scaling differs Apply the resolution factor from the register table
Silence or CRC errors Wiring or framing, not data Fix the serial settings first
An exception frame The register number is wrong for reads Shift the address by one and read again

The middle row is the classic second fault, and on screen it shows up as a scaled display or hash marks — the same arithmetic behind HMI numeric fields showing hash marks. The offset shift hides here too: a manual that prints its control word at 682 may mean protocol address 681 behind a tool that counts from 0, or 40683 behind one that counts from 40001. Reading the two neighbors settles it before you write anything.

Why a Boolean tag writes 65535 to a 16-bit register

The inputs. A Boolean tag set to TRUE in the HMI project, pointed at the drive's serial control word — register 682 as the worked case's serial manual prints it. Every Modbus register is 16 bits wide, 2 bytes, holding a value from 0 to 65535; that register format is the one the Modbus Organization's protocol documentation defines. The control-word table in the same manual lists bits 0, 1, 2 and 4 as the set needed for a run command on this drive.

The rule. The sniffer's 65535 tells you how the HMI driver stored the tag: it mapped TRUE onto the full register width, so all sixteen bits left as 1s. The frame carries 2^16 - 1 — not the 1 you typed at the tag.

The arithmetic. 2^16 - 1 = 65535, which is FFFF in hex: 15 × 4096 + 15 × 256 + 15 × 16 + 15 = 61440 + 3840 + 240 + 15 = 65535. The value the drive wanted is the sum of its own bit weights: 1 + 2 + 4 + 16 = 23 decimal, or 17 in hex.

The result. The drive receives a word commanding run and stop together, with reserved bits set besides. Its application logic refuses the word and answers with an exception frame, so the exchange still looks tidy on the sniffer — which is what let this fault masquerade as a link problem.

The decision. Treat 65535 on a write frame as the signature of a Boolean tag and change the tag type before anything else. If the sniffer instead shows the decimal you intended, the data path is proven, and the remaining suspects are the command source and parameter write protection. Booleans belong on coils — the single-bit objects written with function 05 — or on named bits inside an integer register where your HMI driver exposes them.

Change the tag and prove the write

  1. Build a 16-bit integer tag (INT) at the control register address and delete the Boolean tag, so no Boolean copy survives anywhere in the project.
  2. Keep the sniffer on the wire and write the bit sum from the manual — 23, hex 17, in the worked case — from a momentary button or a numeric entry.
  3. Watch the sniffer's value field show 23 instead of 65535, then watch the drive's status register or keypad status change to run.
  4. Write the stop pattern from the same bit table to bring the drive back to idle; several drive families reject an all-zeros word, so take the pattern from the table rather than assuming 0 works.
  5. Set the drive's command-source parameter to serial from the keypad if the word still does nothing.
  6. Add a read-back display of the status word beside the write button, so the screen shows what the drive actually heard.

Checks that close the fault:

  • The sniffer's value field shows your decimal on every press.
  • The status read-back changes in step with each press.
  • The communication flag stays clear through a full run-and-stop cycle.
  • The DC bus voltage read still matches the keypad, in case the tag edits disturbed the address map.

When the wire really is at fault

Silence or CRC errors on the sniffer send you back to the physical layer, and that is where enclosure layout earns its keep. Fit 120 Ω termination at each end of the RS-485 run and daisy-chain from device to device. Keep the serial pair away from the drive's output cable: the switching edges in a motor cable couple into an unterminated pair across a few inches of parallel run. Route the two on opposite sides of the backplate and cross them at right angles where they must meet. The routing practice is worked through in shielding VFD motor and remote wiring in a steel enclosure, and the wiring behind the display itself in HMI rear wiring protection.

If the serial run and the motor cables cannot be kept apart inside the present box, re-plan the trunking instead of fighting the noise — an enclosure layout decision, not a tag edit. The gasketed rear cover on our 304 stainless HMI enclosures leaves a protected channel behind the display for exactly that pair.

Keep the write error from coming back

Five habits keep this fault off the next drive:

  • Match the tag type to the object every time. 16-bit integers for holding registers, Booleans for coils and named bits; the register write functions (06 and 16) carry 16-bit values, and the driver will not shrink a Boolean for you.
  • Read before the first write on any new map. DC bus voltage at 1.35 times line voltage proves the whole path in two minutes.
  • Print the convention on the drawing. A note beside the register list — "HMI counts from 0" or "HMI counts from 40001" — saves the next engineer the shift hunt.
  • Log the bit sums with the panel documents. Control word 23 equals bits 0, 1, 2 and 4 on this drive; the next drive family will want a different sum from its own table.
  • Keep one master on the wire. Extra masters and heavy polling arrive as timeouts that mimic data faults; the practical limits are worked through in HMI panel connection limits.

Catalog dimensions to compare

Compare these catalog dimensions with your component layout. Open each enclosure for its rating, material and usable space, then check those specifications against your application.

EnclosureMaterialOutside H x W x D / displayRating
17" HMI enclosure304 stainless14.69 x 17.4 x 3.86 inIP65-type front seal with the display installed, manufacturer rated; not UL listed
10.1" HMI enclosure304 stainless8.72 x 12.66 x 3.48 inIP65-type front seal with the display installed, manufacturer rated; not UL listed
15.6" HMI enclosure304 stainless11.69 x 17.64 x 4.13 inIP65-type front seal with the display installed, manufacturer rated; not UL listed
60 × 36 × 16 in304 stainless60 x 36 x 16 inRated NEMA 4X / IP66 by the manufacturer; not UL listed

Questions

What does the exception code on a rejected Modbus write mean?

The exception frame carries a code byte behind the function number. Code 01, illegal function, means the drive does not support that write at all. Code 02, illegal data address, means the register number is wrong — usually the 40001-versus-0 offset. Code 03, illegal data value, means the register exists but the value is out of range, which is what a 65535 Boolean write triggers on a 16-bit control word. Those three cover nearly every write exception in the field.

Can I write the speed reference to a VFD the same way?

Yes, with the same 16-bit integer tag and the drive's scaling factor. Most drive register tables scale the frequency reference at 0.01 Hz per count, so 50.00 Hz writes as 5000. A family that scales at 0.1 Hz per count takes 500 for the same speed, so read the factor from the table first. Prove it by writing a low speed with the motor uncoupled and comparing the keypad's frequency display with the value you sent.

Why does the drive answer reads but completely ignore my writes?

The command source. The drive accepts the frame and stores the register, but its run command still comes from the keypad or control terminals, so the run bits change nothing. Set the local/remote or command-source parameter to serial at the keypad; several drive families apply that switch only after a control-power cycle resets the serial interface. The write then lands on the same 16-bit integer tag the read already proved.

Which serial settings and termination does Modbus RTU expect?

The Modbus over Serial Line specification defaults to 19200 baud, 8 data bits, even parity, 1 stop bit (8E1), and calls for two stop bits at the same baud when parity is switched off. Match those four values on both ends, then add a 120 Ω termination resistor at each end of the RS-485 run. A single mismatched stop bit shows up as silence or CRC errors on the sniffer; it never produces a clean-but-rejected write.

Checklist before you order

Specify it once, built to your drawing

  • Environment and NEMA type: Type 1, Type 3R, Type 4, Type 4X, Type 6P, Type 12, Type 13 (manufacturer ratings, not UL listed)
  • Material: 304 stainless steel, 316L stainless steel, Powder-coated carbon steel, Aluminum, Polycarbonate, Fiberglass (FRP)
  • Size: inside or outside height, width and depth, with the depth your deepest component needs
  • Cutouts, glands and windows, dimensioned from one datum on each face
  • Mounting and access: wall, pole or stand, hinge side, mounting panel
  • Quantity: from one piece

Delivered in 10 business days, anywhere in the world. Counted from your order; for custom work, from your approval of the drawing.

Configure an HMI housing in 3DRequest a custom quote

NEMA 4X enclosures: sizes for this job · HMI panel cutout dimensions by series

Keep reading

More on hmi and operator enclosures

All articles

Buying guides

The guides behind this answer

All guides