Appearance
Y305 PLC I/O Modules Modbus Integration Guide
Establish a read of one known Y305 value, then add host commands or PLC polling with defined ownership, transaction scheduling, and data expiry. Y305-4400, Y305-4421, Y305-8800, and Y305-8821 require the separately selected RS485 option for these connections.
The command interface is a design example. Test its implementation on the intended hardware and firmware with actuators isolated before using it to control equipment.
Contents
- Bus roles and serial settings
- Address conversion
- First read test
- Host commands and PLC outputs
- Retries and stale data
- PLC master operation
- Integration record
1. Bus roles and serial settings
For host polling, set the equipped PLC port to Modbus RTU slave mode. For PLC polling of a meter or drive, use a master port and the corresponding communication logic. Keep one active master on each RTU bus.
RS485 supports up to two fitted ports; the model number and analog channels do not establish the port count. Complete the RS485 installation checks before testing the connection. RTC is a separate option and is not required for Modbus polling.
| Setting | Connection record |
|---|---|
| Port and role | Fitted port 1 or 2; master or slave |
| Station address | Actual configured value; documented initial value 1 |
| Serial format | Bit rate, data bits, parity, stop bits |
| Timeout/retries | Values suited to the slave's response time and polling cycle |
| Configuration owner | PLC logic or tool that initializes or changes the port |
Read the running configuration before changing it. The serial register reference gives format words, station and timeout registers. Its 9600 8N1 examples do not establish the factory baud rate. Start with one port; test port routing and when settings take effect before adding a second bus.
An external gateway has its own RTU/TCP translation and timeout settings. It does not give the PLC a native Ethernet or Modbus TCP interface.
2. Address conversion
Record the PLC device, Modbus space, raw decimal address, raw hexadecimal address, function code, and host-tool entry separately.
- Hexadecimal 0x1000 equals decimal 4096, not decimal 1000.
- A tool with one-based offsets may display 4097 for raw address 4096.
- A 4xxxx holding-register reference is a tool notation. Check its numbering convention before converting it.
- X/Y terminal labels use octal-style numbering; they are not Modbus address strings.
| PLC device | Space | Raw decimal | Raw hexadecimal | Test condition |
|---|---|---|---|---|
| X0 | Read-only bit input | 1024 | 0x0400 | Match one physical input transition to the returned bit |
| D0 | Holding register | 4096 | 0x1000 | Use only when the project assigns a known, harmless value |
| D8030 | Special holding register | 3102 | 0x0C1E | AD0 on Y305-4421/8821; test the derived address on the target firmware |
The special D8000 region starts at raw address 3072, so D8030 maps by calculation to 3072+30. It does not use the ordinary D0 base plus 8030.
D8030 holds an analog input value in holding-register space. Test an FC03 read at the derived address on the target firmware before adding it to the polling map. Do not choose FC04 solely because the physical signal is an input.
Start with a single validated address. Before expanding to block reads, establish the supported range and quantity on the target firmware. Keep requests within those tested boundaries; do not infer a usable endpoint from the address base. Use the address reference to plan the tests.
3. First read test
For an isolated port-1 bench test, a slave setup can use the following profile. Confirm that the installed firmware supports FC03 at D0 before using the read request. This profile is a configuration and address-map example, not a captured successful exchange or a statement of factory settings.
| Item | Bench profile |
|---|---|
| PLC port and role | Fitted port 1, Modbus RTU slave; disconnect port 2 for this test |
| Format | D8120 = H0081: 9600 bit/s, 8 data bits, no parity, 1 stop bit |
| Station | Set D8121 = K1 in the isolated test project; use station 1 in the host |
| Timeout setting | D8129 = K300, the 300 ms example setting; configure the host's reply timeout separately |
| PLC value | D0, monitored in the engineering tool and not used for process control |
| Read function and quantity | FC03, one holding register, after firmware support is confirmed |
| Raw address | Decimal 4096 / hexadecimal 0x1000; a one-based-offset tool may require 4097 |
| Expected comparison | Returned word equals the D0 monitor value; decoding follows the application's signedness |
Initialize the serial registers through the isolated test project using the unit's confirmed transfer procedure. Apply settings through the firmware's specified activation procedure and check the resulting configuration; do not change a running machine's port settings for this test. The host is the only master. A 300 ms D8129 value does not set the host tool's timeout.
- Isolate actuators and other writers. Use a short connection to one device.
- Identify a known PLC value in the engineering monitor. Do not overwrite an arbitrary register in an existing application to create a test value.
- Enter the serial format, station, read function, address, and quantity of one in the host tool.
- Send one request and capture the response with a timestamp.
- Compare the decoded value with the monitor. For an input test, change one safe signal and observe the intended bit.
- Repeat at a second validated address to catch an offset error.
Inspect station, function, expected length, integrity, exception status, and value. A reply proves neither correct addressing nor correct decoding. Keep exception responses separate from timeouts in the test record.
FC06 and FC16 (0x10) change remote registers. Do not use write examples as connection probes.
4. Host commands and PLC outputs
Let PLC logic own Y outputs and, on Y305-4421/8821, D8050. The host requests an action; the PLC applies modes, interlocks, and limits. A host write to Y0 can be overwritten by ladder logic on a later scan. Faster polling does not resolve competing writers.
Reserve ordinary D/M addresses that do not overlap the application or special devices. Allocate a separate field for each part of the example command interface:
| Field | Writer | Meaning |
|---|---|---|
| Interface revision | PLC | Identifies map and command semantics |
| Command sequence | Host | Distinguishes a new request from a processed one |
| Requested mode/value | Host | Action requested by the operator or host |
| Command valid/commit | Host | Marks a complete request under the agreed update method |
| Acknowledged sequence | PLC | Identifies the accepted or rejected request |
| Result code | PLC | Accepted, interlocked, invalid range, or another defined result |
| Control state | PLC | Program state after interlocks and limits |
| Data validity/fault | PLC | Whether measurements and permissions are usable |
Define the update order. Do not assume a multi-register write is atomic relative to PLC execution. Test a staging/commit handshake or another method that prevents mixed old and new fields.
For multiword data, specify signedness, width, floating-point encoding, and register order. Standard wire-byte order does not determine the firmware's 32-bit word order or the host library's swapping options. Compare known patterns before transmitting process values.
5. Retries and stale data
A timeout after a write is ambiguous: the slave may have acted and lost the reply. Retrying a set-value command differs from retrying “advance one step” or “dispense once.” Use the sequence and acknowledgment rules to detect duplicate requests, and test that behavior with outputs isolated.
Limit retry rate and polling frequency. Track the last successful update, consecutive failures, and value validity. These are application diagnostics, not built-in features of the example interface.
When data expires, mark it stale. Do not present the last reading as a new measurement. Specify the output action for an expired command and whether recovery needs a fresh request or operator acknowledgment.
M8063 indicates a serial error, M8409 a timeout, and M8029 instruction completion. Completion alone does not prove that the requested operation succeeded. Compare flags with the response and expected result. D8063 is listed for RS error-code information; obtain or test the code meanings before assigning a diagnosis.
Measure output behavior on communication loss, STOP, and power failure. Implement command expiry while the program runs, and provide independent protection where STOP or loss of power could leave equipment in a hazardous state. Do not rely on an automatic safe-output response.
6. PLC master operation
Use ADPRW for Modbus transactions. Test port routing and instruction conditions before commissioning two buses.
For each slave transaction, record the slave's map, function, quantity, encoding, timeout, and permitted writes. The remote address belongs to that slave; it is not automatically a Y305 D-register number.
Use request, waiting, completion/error, and recovery states. Check trigger behavior so an instruction enabled on successive scans does not repeat a consequential write. Raw RS also needs tested byte packing, lengths, CRC, response checks, and timeout handling; a short instruction fragment is not a complete driver.
6.1 Read measurements and write settings with ADPRW
Choose the transaction from the external slave's map, then use the corresponding ADPRW instruction example. The examples use slave 2 and these data paths:
| Purpose | Remote function and address | Local data |
|---|---|---|
| Set one value | FC06; one holding register at raw address 0x000A | Send D0 |
| Update a group of settings | FC16 (0x10); five holding registers starting at raw address 0x000A | Send D1–D5 |
| Acquire an instrument measurement | FC04; two input registers starting at raw address 0 | Receive into D10 and D11 |
Set a slave-compatible serial format and response timeout before issuing a transaction. The instruction fragments supply neither the polling schedule nor the completion checks. Follow the single-register operand convention in the reference; a literal operand in that example is not a general bus quantity rule.
Use a single-register write for an external setpoint, a multi-register write for a small group of settings, or a read for an instrument measurement only when the slave's map defines those addresses and data formats. Five words are five registers, not necessarily five independent values: a 32-bit measurement occupies more than one word.
A scheduler should accept one transaction at a time on the bus:
| State | Action | Next condition |
|---|---|---|
| Idle | Choose the next permitted read or queued command | A request is ready and the port is available |
| Start | Prepare stable operands and issue the request once using the target's trigger rules | Request accepted for execution |
| Wait | Keep the transaction context; do not start a competing request | Completion, error, or timeout |
| Evaluate | Check status and the expected response; accept a read only if valid | Success or a defined retry/fault decision |
| Recover | Bound retries, invalidate expired data, and apply the application's fault action | Retry permitted or return to Idle |
Do not enable several ADPRW calls directly from independent inputs without arbitration. M8029 reports instruction completion, not successful delivery of a useful value; include M8063/M8409, response checks, and freshness in the decision. For a write, a lost reply does not prove that the slave ignored the command. Apply the duplicate-request rules in Retries and stale data.
Changing a port from master to slave does not turn a polling sequence into a slave application. Master examples do not define the PLC slave's full function-code set.
6.2 Send a fixed frame with RS
RS gives the program responsibility for assembling and checking a byte-oriented exchange. It can support a device-specific serial protocol when its framing, timing, and electrical requirements match the port; it is not an automatic driver for arbitrary protocols.
For the port-2 example, configure port 1 as slave and port 2 as master. The documented routing gives port 1 priority when it remains master, so do not retain the preceding port-1 master setup. Verify the selected physical port before transmitting.
The RS instruction example supplies the initialization and buffer fragments. Its intended payload is station 03, function 06, raw address 00 00, and value 00 01, followed by two CRC bytes. This writes a remote register; use an isolated, compatible slave after the read-only connection test has passed.
| Exchange state | Application action |
|---|---|
| Prepare | Select port 2, keep port 1 in slave mode, assemble the stable payload, and calculate its CRC |
| Request | Issue the transmit request through M8122 using the target's tested trigger behavior |
| Wait | Keep the pending frame and deadline; do not alter the buffer or start another exchange |
| Validate | Check the received frame against the pending request before accepting a result |
| Finish or recover | Handle the result before clearing M8123; on failure, apply the bounded retry and fault rules |
Before transmitting, establish the M8161 mode, word-to-byte packing, CRC placement and order, and receive-length behavior. Inspect the actual transmitted bytes on an isolated bench. Validate the received station, function, length, CRC, and exception status. For this FC06 exchange, also require the echoed register address and value to match the pending request; clearing M8123 alone does not validate a reply.
A periodic RS call does not establish recurring transmission: the short source sequence sets M8122 during initialization and does not show how to request each subsequent send. Test the complete exchange sequence and issue the next request only when the previous exchange has finished or timed out.
RS and ADPRW cannot operate simultaneously. Do not assign one to each port and assume that this removes the restriction.
7. Integration record
Keep the hardware/firmware identity, host-tool version, serial settings, map revision, supported functions, address convention, traces, and multiword test patterns.
Acceptance tests should include a lost write response, duplicate request, partial command update, host restart, PLC restart, and stale command on reconnection. Repeat affected tests after a firmware, map, or control-logic change.
