How-to
How Geo SCADA writes to an M340 PLC over Modbus TCP
Short answer
A Geo SCADA write to an M340 over Modbus TCP needs a write function code, a writable target and PLC logic that leaves the target alone. Point function 05 or 15 at %M bits and function 06 or 16 at %MW words, prove both on scratch addresses, and confirm the offset convention by writing 1234 and reading the same word back in the animation table.

On this page
A working read from Geo SCADA proves the network path to the M340; a write adds three things that read never tested: a write function code, a target object the server will actually change, and PLC logic that leaves that object alone. Build a digital output point for a %M bit and an analogue output point for a %MW word on the same outstation that already reads, prove both on scratch addresses, and settle the address offset by writing 1234 and finding which %MW holds it in the animation table. Then hand every command bit back to the PLC to clear, so a pressed button does not stick on.
What a write adds to a working read #
Reads and writes use the same TCP connection, the same unit ID and the same server inside the M340, so your working analogue and digital reads have already proven everything in the left column. Only the right column is new, and each item there fails in its own way, so prove them one at a time.
| The working read already proves | The write adds |
|---|---|
| IP address and TCP port reach the M340's Modbus server | A write function code, single or multiple |
| A unit ID the server accepts | A target inside a writable object class, not a read-only one |
| An address convention that maps configured numbers onto the right %MW | The same convention held on the new write points, where an off-by-one writes the neighbouring word |
| Points that return data to the HMI | Output points with the control action enabled |
Before you build anything, confirm the existing read point for the intended target address still updates on the HMI; that read point becomes your receipt for every later step.
Choose a writable M340 target #
Writes land in the M340's internal memory. Internal bits (%M) belong to the coil object class and internal words (%MW) to the holding register class; the Modbus Application Protocol Specification defines write functions only for those two classes, with 05 or 15 for coils and 06 or 16 for registers. The input objects %I and %IW sit in the input classes, which have no write function at all, so a write aimed there is refused; Why a Modbus TCP client cannot write M340 input bits shows what the M340 sends back when you try. Decide here: write to %M and %MW only.
A write changes internal memory only; the PLC scan carries it out to the field on its own schedule, which Can a Modbus write change PLC outputs? traces end to end. Pick one unused %M bit and one unused %MW word inside the range the server exposes, cross-reference both in the programming software to confirm no rung or function block writes them, and leave both showing 0 in the animation table. If a write later returns an illegal-address exception at an address you believe valid, the exposed range itself is set on the PLC side; What you must configure on the PLC side for Modbus TCP lists the settings to compare.
Configure the two write points #
Both new points ride the channel and outstation your reads already use, whichever of Geo SCADA's Modbus drivers you selected when you built them, so nothing changes on the network. Field names move between Geo SCADA releases; take yours from the Modbus driver help for the installed version, and on analogue points the fields sit on the Generic Modbus Analog Output Point Form. Work through the scratch pair in this order:
- Create a digital output point for the scratch %M bit. Enter the bit number as the address and keep the outstation and unit ID identical to the working read points.
- Create an analogue output point for the scratch %MW word in the same form family, and select the single-register write, function 06, for a 16-bit value. If your point form only offers the multiple-register write, function 16, use it; the holding register class accepts both.
- Enable the control action on both points and sign in with an account that holds operate permission on them.
- Operate the digital point and send value 1.
- Operate the analogue point and send the test value 1234.
- Watch the animation table in the M340 programming software: the bit shows 1 and the word shows 1234 at the number you intended.
Settle the offset convention with one word #
Take a scratch word configured at address 100 as the example. If the driver sends that number unchanged, the request carries function 06, protocol address 0x0064 and data 0x04D2; in decimal those are 100 (6×16+4) and 1234 (4×256+13×16+2), and the value appears in %MW100. A one-based point form sends 0x0063 instead, because it subtracts one from the configured 100 before transmitting, and the identical write lands in %MW99. Your read points map correctly, but each new point carries its own address field, so let the animation table arbitrate: note which %MW now holds the test value. If it is %MW99, every write address is one low: enter addresses one smaller, or switch the point form's address convention so the configured number travels unchanged. If it is %MW100, the convention matches the read path and the offset question is closed.
Read the exception code when the write fails #
When a write does not land, the server answers with a Modbus exception response carrying a one-byte code, and that code names the failed layer before you open a single configuration screen.
| Response | Cause | Action |
|---|---|---|
| Exception 01, illegal function | The server refuses that function code for the target object | Switch the point between the single and multiple write, and confirm the target class |
| Exception 02, illegal data address | The address sits outside the exposed memory, or the offset is off by one | Apply the correction from the worked example, or pick an address inside the exposed range |
| Exception 03, illegal data value | The value or register count does not fit the request | Check the point's data type and length |
| No exception, value wrong or reverting | PLC logic writes the same object every scan | Give the object one writer: move to a fresh address or delete the rung that also writes it |
That illegal-address exception at a corrected offset means the server's exposed memory is smaller than your address, and the fix is a smaller address or a larger configured range on the PLC side. When the reverting case involves two clients rather than a PLC rung, Two SCADA servers writing to one PLC over Modbus TCP covers the last-writer-wins race and its fix.
Keep a push button from sticking #
A Modbus write sets a level, not a press: the bit stays where the write left it, so the second button press finds the bit already on and creates no rising edge in the PLC. Fix this on the PLC side, not with clever SCADA timing.
- PLC-consumed command (preferred): the PLC takes a rising-edge contact on the command bit, executes the action once, and clears the bit itself from the logic. The next press writes onto a bit that is 0 again, so every press works. Use this pattern for start, acknowledge and reset commands.
- SCADA-pulsed command: Geo SCADA writes 1 and then 0 after a delay. Set the delay from measured numbers, not a guess: add the PLC task interval to the observed write round trip and double the sum. A pulse shorter than one scan can be missed entirely, and if a missed pulse can leave a machine in an unsafe state, do not use this pattern at all; use the PLC-consumed command.
Point the HMI button at the output point's operate action, never at the read point, which only mirrors PLC state and cannot carry a command. When that command bit drives real outputs, Safe Modbus writes to PLC output registers from SCADA covers the interlocking that belongs around it.
Verify end to end on the production tag #
Move off the scratch pair only after both writes land where intended. Confirm the production object has a single writer, the Geo SCADA point, and that the PLC logic only reads it.
- Operate the button and confirm the bit sets in the PLC's online data.
- Confirm the read point for the same address updates on the HMI, which closes the loop through Geo SCADA's read path.
- Confirm the action fires once and the bit returns to 0 under the PLC-consumed pattern.
- Write the production word at both ends of its engineering range and read both back from the data table.
- Unplug the M340's Ethernet cable, operate again, and confirm Geo SCADA reports a failed control or communications fault instead of a silent success; reconnect and repeat step 1.
The decision #
Scratch bit and word landing at the intended %M and %MW numbers means the point types, function codes and address convention are right: configure the production points the same way and go live. The test word arriving in %MW99 means an off-by-one on the write side: correct the convention before any production address is entered. Exception 02 that survives a corrected offset means the address lies outside the exposed memory: move inside the range configured on the PLC side. A value that reverts means two writers: leave the object one writer, the Geo SCADA point, and let the PLC only read it and, for a command bit, clear it.
Questions asked
How do I write a 32-bit value or a float to the M340 from Geo SCADA?
Pack it as two adjacent %MW registers and issue one multiple-register write, function 16, so the PLC never sees a half-updated pair. If the value reads back scrambled, the driver and the PLC disagree on word order: swap the two words in the point configuration and compare again. Keep the register pair inside the memory range the server exposes, or the server answers exception 02.
Why does my Geo SCADA write time out while reads from the same outstation keep working?
The TCP path is proven, so the block sits in front of the control action. Check that the point is enabled for control and that your user account holds operate permission on it; a point left read-only turns the operate action into nothing. If it still stalls, capture traffic at the server: no write frame on the wire means the permission layer is dropping the command, not Modbus.
How does 4xxxx-style register numbering map to %MW addresses?
In the common display convention the first holding register shows as 40001 and corresponds to protocol address 0, so %MW100 appears as 40101. Both styles describe the same register; tools that show 4xxxx numbers add 40001 to the protocol address. When a write lands in the wrong word, check this display offset separately from the zero-based-versus-one-based driver setting, because the two are easy to confuse.
How many coils or registers can one Geo SCADA write carry?
The Modbus specification caps one multiple-write request at 1968 coils and 123 holding registers; a quantity of zero, or anything above those caps, brings exception 03 back from the server. Single writes move one coil or one register each. For a block of command bits or a group of setpoints, size the request inside those caps and send the block as one transaction so the PLC sees it update together.

