IMDHMIControls LibraryShop main store

Explainer

Modbus master and slave roles on a CJ1M with SCU serial modules

Industrial networks Published 7 min read By IMDHMI controls team

Short answer

A CJ1M SCU port becomes a Modbus RTU slave through the I/O table's user settings; there is no matching master selection, so Modbus RTU master polling runs as a protocol macro sequence loaded into the unit and driven by ladder. Retarget borrowed master code from CS1 to CJ1M in both CX-Programmer and CX-Protocol, then commission one transaction per port.

On this page
  1. The slave role: user settings and Modbus slave mode in the I/O table
  2. The master role: a protocol macro sequence loaded into the unit
  3. Retargeting the master code from CS1 to the CJ1M
  4. Poll gap on the four-device SCU32 port at 19200 baud
  5. Commissioning order: one transaction per port, then the segment
  6. Questions asked

Yes, the CJ1M's SCU serial units can poll as Modbus RTU masters, but the master role is not a setting. The slave role is: with the CPU in program mode, open the SCU in the I/O table, set the port to user settings, choose Modbus slave, and enter the station and serial parameters. There is no matching master selection anywhere in those lists; the master runs as a protocol macro sequence that you load into the unit and start from ladder. On this machine that splits cleanly: the SCU32's ports poll the field devices, one carrying four devices and one carrying the freshness-critical device alone, while the SCU42's RS-485 port answers the upstream master from mapped memory. The sections below cover the slave path, the master path, the retargeting any borrowed code needs before it fits a CJ1M, a worked poll-gap calculation for the four-device port, and the commissioning order.

The slave role: user settings and Modbus slave mode in the I/O table #

Each CJ1W-SCU unit provides two serial communications ports, and the serial communications mode is set separately for each port, which is the datasheet's own summary of the hardware. Modbus slave is one of those modes, and it needs no protocol macro file and no ladder code. With the CPU in program mode, open the SCU in the I/O table setup, switch the port from the default to user settings, select Modbus slave, then set the station number, baud rate, parity and stop bits to match the upstream master; the CS/CJ serial communications units operation manual documents the mode and its parameters.

Decide the slave's data map before you touch the settings: which memory areas the upstream master may read, and what lands in them, meaning the values your master ports poll from the field plus the I/O points the master system expects to see. Once the SCU32 transactions write into those areas, the slave port serves them with no further code. Bring the slave port up after the master ports are filling the map, and confirm the upstream master reads sensible values from every address it was promised.

The master role: a protocol macro sequence loaded into the unit #

The port's serial-mode list has no Modbus master entry, and Omron's guidance for CS and CJ serial units is blunt: to perform Modbus RTU master functions, the protocol macro must be loaded into the SCU or serial communications board. So the master is built, not selected. Define each transaction as a sequence in CX-Protocol, with station, function, register reference, quantity and destination words, transfer the sequence set to the unit, put the master ports into their protocol macro serial mode, and start the sequences from ladder in CX-Programmer.

Ready-made sequence sets for these units exist and are worth borrowing. The pattern is the same one how a CJ2M protocol macro reads a 10-register Modbus block documents step by step. Most circulating master code for these units was built against CS1 CPUs, and a worked CS1 Modbus master configuration with CX-Protocol for an SCU21 unit shows what a complete sequence set looks like. Whichever you take, it does not fit your CJ1M until it is retargeted, which is the next section.

Retargeting the master code from CS1 to the CJ1M #

The ladder project and the protocol macro file each carry their own PLC target, and code aimed at a CS1 CPU has both pointing at CS1 devices. Change both. In CX-Programmer, change the ladder project's PLC type to your CJ1M. In CX-Protocol, change the protocol macro project's target PLC type to the same CJ1M. Change only one and the halves disagree at transfer: the ladder goes down and the sequence set does not, or the reverse.

With the target fixed, verify every generated transaction against your own data map: port assignment, station number, function code, register reference, transfer quantity, and the destination words in PLC memory. Check each device's register convention as you go, because the register number a device manual prints and the address a request carries are not always the same number. Validate both projects, transfer the protocol macro file, then the ladder. Transfer with the machine in a safe state: a changed poll schedule changes when the data your outputs act on arrives.

Poll gap on the four-device SCU32 port at 19200 baud #

This worked example uses typical settings; enter your own values from the device documentation before trusting its result.

Inputs: four devices on one SCU32 port and the freshness-critical device alone on the second port, as this machine is laid out. One read-holding-registers transaction per device per sweep, each reading 10 registers, the same block size as the CJ2M example. Serial settings of 19200 baud with 8 data bits, even parity and 1 stop bit, which is the RTU default character format at 11 bits per character. And frames separated by at least 3.5 character times of silence, which is what the Modbus over serial line specification requires between frames; a shorter silence is its own fault that stops slaves answering, as covered in why a Modbus RTU frame gap before the CRC silences the slave.

The rule: wire time per transaction equals the frame characters times 11 bits, divided by the baud rate, plus two inter-frame gaps of 3.5 character times. A read-holding-registers request is always 8 characters, made up of station, function, start address, quantity and CRC, and its response is 5 characters plus twice the register count, made up of station, function, byte count, data and CRC.

The arithmetic:

  • character time: 11 bits ÷ 19200 bits per second = 0.573 ms
  • request: 8 characters × 0.573 ms = 4.6 ms
  • response: 5 + 2 × 10 = 25 characters; 25 × 0.573 ms = 14.3 ms
  • gaps: 2 × 3.5 characters × 0.573 ms = 4.0 ms
  • one transaction: 4.6 + 14.3 + 4.0 = 22.9 ms
  • four devices: 4 × 22.9 ms = 91.6 ms per sweep

Result: about 23 ms of wire time per transaction and about 92 ms per full sweep, before any slave turnaround. Decision: the freshness-critical device stays on its own port. There it is re-read every 23 ms plus that device's turnaround, four times as often as if it waited inside the shared sweep, and its interval never moves when the other port gains registers or devices. Every extra register adds about 1.1 ms to the shared sweep and every added device one more transaction, which is the same arithmetic that drives why Modbus RTU drive polling on one serial port is slow. Measure the achieved sweep at commissioning with a timestamped heartbeat word instead of trusting the wire-time floor.

Commissioning order: one transaction per port, then the segment #

Work the list in order; each step depends on the one before it.

  1. Freeze the data map first. For every master transaction, record the device, station number, function, register reference, quantity, word order and destination words, and keep the slave-facing addresses the upstream master reads as a separate list.
  2. Match serial settings on both ends of every link, taking baud, parity and stop bits from the device documentation, and give each device on an RS-485 segment a unique station number.
  3. Transfer the retargeted protocol macro file and the ladder project with the CPU in program mode.
  4. Bring up the SCU42 slave port through the I/O table's user settings and confirm the upstream master reads the values you mapped, including the promised I/O points.
  5. On the four-device port, run one transaction to one device and confirm the data lands in its intended memory words; add the other three devices only after that word-for-word check passes.
  6. Commission the single-device port separately: confirm it polls only that device and that the measured update interval meets the freshness requirement.
  7. If a transaction misbehaves, change one variable at a time through framing, station number, wiring polarity and termination, or the register request, and watch the response after each change. When a port will not come online at all, work through fix an Omron CJ1M serial connection that will not go online.

The decisions, stated flat. The SCU42 slave port is a selection: user settings, Modbus slave, parameters, memory map, with no protocol macro work attached. The SCU32 master ports run only through protocol macro code retargeted to the CJ1M in both CX-Programmer and CX-Protocol, loaded into the unit, and started from ladder. And the freshness-critical device keeps its dedicated port, because the shared sweep's length grows with every register and device while the dedicated interval does not.

Questions asked

Is the SCU42 itself Modbus master capable?

Yes, but only through the protocol macro function. Omron's guidance for these serial units is that Modbus RTU master functions require the protocol macro to be loaded into the SCU or serial communications board, with each sequence started from ladder. There is no port setting labeled Modbus master; until that sequence set is loaded, a unit bought expecting a master-by-setting will not poll anything.

Does the slave port need CX-Protocol or any ladder?

No. The slave role is a serial-mode selection made in the I/O table setup for the unit with the CPU in program mode: switch the port to user settings, choose Modbus slave, enter the station number and serial parameters, and map the memory the upstream master reads. CX-Protocol and ladder only come into the project on the master side.

What does the CJ1M CPU itself do in the Modbus exchanges?

On the master side the CPU runs the ladder that starts each protocol macro sequence and supplies its send and receive memory areas; the sequence definitions and your data map carry the addressing and word order, not a CPU setting. On the slave side the CPU does nothing once the port mode and parameters are set, because the unit answers requests from mapped memory by itself.

Why keep the master and slave roles on separate units?

Each port's serial communications mode is set separately, but the two roles need different configurations, different wiring, different station numbering and different data maps. Splitting them, with master polling on the SCU32 and slave service on the SCU42, keeps a change to one link from disturbing the other and keeps the upstream master's register map independent of the field devices' maps.

Keep reading

  • How-to

    How a PLC runs two Modbus networks at the same time

    Yes. Each serial port is its own independent link: the HMI polls the PLC on one port while the PLC acts as master, or slave, on a separate RS-485 Modbus RTU network. The two links share no settings — only their endpoints must match — and PLC copy logic moves any data between them.

    Industrial networks

  • How-to

    How to connect a Modicon PLC to an RTU Modbus RTU network

    Yes — a Modicon PLC can join an RTU network that runs Modbus RTU over fiber. One serial segment carries one client, so the PLC either polls the RTUs as client or answers an existing master as server; the fiber converters must pass frames and gaps untouched, and the timeout is set from measured response time.

    Industrial networks

  • How-to

    Configure MicroLogix 1100 Channel 0 for Modbus RTU

    On the tested MicroLogix 1100 (1763-L16BBB rev. B), Channel 0 is a serial port with a selectable driver — DF1, Modbus RTU Slave or Modbus RTU Master — set in RSLogix Micro under Channel Configuration while Channel 1 keeps carrying Ethernet. Slave mode creates the data files, binary for coils and contacts and integer for input and holding registers; master mode runs MSG instructions against the stations you poll.

    Industrial networks

Why an S7-1500 to QJ71MB91 Modbus RTU link stays silent