IMDHMIControls LibraryShop main store

How-to

SLC 5/03 CH0 Modbus RTU with the ASCII driver

Industrial networks Published 9 min read By IMDHMI controls team

Short answer

An SLC 5/03 channel 0 has no Modbus driver, only DF1 and ASCII, so configure the ASCII driver, build each Modbus frame as a string, and send it with AWT. Use the slave's Modbus ASCII mode with its one-addition LRC checksum where supported, precompute CRC-16 frames where it is not, and move to a protocol module beyond one slave and a few registers.

On this page
  1. Can an SLC 5/03 CH0 port run Modbus RTU without a protocol module?
  2. Should you use Modbus ASCII mode or Modbus RTU frames on CH0?
  3. What wiring does CH0 need to reach the controller?
  4. How do you configure channel 0 in RSLogix 500 for raw character I/O?
  5. How do you build the frame that reads or writes one register?
  6. How do you handle the checksum without drowning the scan?
  7. How do you sequence transmit, receive and timeout in the ladder?
  8. How fast can CH0 poll one register at 9600 baud?
  9. When should you stop hand-building frames and buy a module?
  10. Questions asked

Channel 0 on an SLC 5/03 has no Modbus driver: RSLogix 500 offers DF1 and ASCII there and nothing else, so Modbus on that port happens only if you build it. For one register in one slave, building it is a practical job: configure the port as ASCII, assemble each frame as characters in a string file, send it with AWT, and bound the wait with an ordinary timer. Prefer the slave's Modbus ASCII mode where its manual offers one, because the LRC checksum is a single addition; fall back to precomputed CRC-16 frames where it does not. The sections below cover wiring, channel setup, frame math, the ladder sequence, timing and the point where a protocol module becomes the better buy.

Can an SLC 5/03 CH0 port run Modbus RTU without a protocol module? #

No native Modbus driver exists in SLC 5/03 firmware: channel 0 offers DF1 and ASCII drivers only, but the ASCII driver plus the string instructions AWT, ARD, ARL, ACB and ACL give you raw character transmit and receive, enough to hand-build Modbus frames for one register in one slave.

The ASCII driver turns the port into a character pipe: it transmits what an instruction points at and buffers what arrives, with no protocol logic of its own. That makes you the protocol stack — framing, checksum, timeout, retry and exception parsing all live in your ladder. For one read and one write that is a few dozen rungs; for anything more it is a maintenance liability, which is the decision at the bottom of this article.

Should you use Modbus ASCII mode or Modbus RTU frames on CH0? #

Use Modbus ASCII mode when the slave supports it: its checksum is an 8-bit two's-complement sum called the LRC instead of a CRC-16 shift loop, and the frame is printable hex characters between a colon and a CR LF, which maps cleanly onto SLC string elements and line reads.

Modbus RTU carries the same information as raw binary with a CRC-16 appended, which costs two things on this port: the checksum becomes an eight-shifts-per-byte loop in ladder, and the receive side cannot hunt for terminator characters because CRC bytes can equal CR or LF by chance. Set the mode you choose in the slave's own communications menu, and match the channel format to it: Modbus ASCII normally runs 7 data bits with even parity, Modbus RTU runs 8 data bits with even parity or two stop bits.

What wiring does CH0 need to reach the controller? #

CH0 is an RS-232 port on a 9-pin D-shell, so a slave with a 2-wire RS-485 port needs an RS-232-to-RS-485 converter between them, one that self-toggles its driver or is keyed from RTS, because the channel's RTS send and off delays are configurable.

For an RS-232 slave, settle the DTE/DCE question from the two manuals and cross transmit and receive if the ports are wired alike. For an RS-485 slave, mount the converter near the SLC, run twisted pair to the controller, and fit the termination the controller manual specifies at the segment ends. Set the RTS delays to the smallest values that keep the first and last characters intact, and raise them only if the converter clips the frame.

How do you configure channel 0 in RSLogix 500 for raw character I/O? #

Set it up offline: choose the ASCII driver on the Chan. 0 - System screen, match the port format to the slave on the Chan. 0 - User screen, set CR LF as the termination characters, turn echo and XON/XOFF off, and download the project rather than editing online.

  1. Open Channel Configuration in the offline project, then Chan. 0 - System, and set Driver to ASCII. CH0 stops being a DF1 port, so keep programming traffic on the DH-485 channel.
  2. On Chan. 0 - User, match Baud Rate, Parity, Data Bits and Stop Bits to the slave exactly.
  3. Create a string data file such as ST9 for request frames and responses; each element holds a length word plus up to 82 characters.
  4. Set Termination Characters to CR and LF, entered as hexadecimal 0D and 0A, so ABL and ARL recognize a complete ASCII-mode response.
  5. Set Append Characters to CR LF if you will transmit with AWA; otherwise embed the CR LF in the string and use AWT.
  6. Set Echo off, XON/XOFF off and Delete Mode to ignore: any character processing on the port corrupts a checksummed frame.
  7. Download. The manufacturer's support knowledgebase documents online CH0 driver changes that leave the ASCII instructions only partly functional, so the driver swap goes in with a download.

How do you build the frame that reads or writes one register? #

A read of holding register 40101 in slave 1, one register, becomes the six data bytes 01 03 00 64 00 01 — address 01, function code 03, start offset 0064, quantity 0001 — because the manual's 40101 minus its 40001 base is the offset 100 that hex 0064 carries.

Code Job
03 Read holding registers: values you may read and write
04 Read input registers: measurements published read-only
06 Write one 16-bit register
16 (hex 0x10) Write a 32-bit float across two registers

Choosing between 03 and 04 is the holding-versus-input question, covered in Modbus holding register vs input register: which one to use; the one-based subtraction is the same conversion explained from the server side in Why Modbus error 8189 needs 400001 added to the register address. A write of a 16-bit value uses function 06; a 32-bit setpoint travels as two registers under function 16. One safety line belongs here: keep any hardware over-temperature cutout independent of this link, because a hand-built write path is process control, not a safety function.

How do you handle the checksum without drowning the scan? #

For Modbus ASCII the checksum is one addition: sum the data bytes, keep the low 8 bits and negate; for the bytes 01 03 00 64 00 01 the sum is 0x69, so the LRC is 0x100 - 0x69 = 0x97, appended as the two hex characters 97.

The complete request is :01030064000197 followed by CR LF, 17 characters in all, which fits in one string element. In ladder the LRC is an indexed ADD that accumulates the bytes, an AND with 0x00FF and a NEG, then a nibble split with a small compare to produce the two hex characters.

  1. Precomputed frames. If the written value comes from a short list — ten setpoints, say — store ten complete write frames and one constant read frame as strings with checksums included; the ladder only selects and sends. This is the practical RTU route too.
  2. Runtime LRC, Modbus ASCII only: one pass per transaction, cheap enough to leave in forever.
  3. Runtime CRC-16 for RTU: seed 0xFFFF, XOR each data byte, shift the register right eight times per byte, XOR with 0xA001 whenever a 1 shifts out, and append low byte then high byte. XOR, AND and BSR implement it, but it is a nested loop and the place most hand-rolled attempts fail. On the example bytes it gives C5 D5, so the RTU read frame is 01 03 00 64 00 01 C5 D5.

If you took the precomputed route, note it in a rung comment: without a runtime CRC you cannot verify the response checksum, and validation rests on address, function code and byte count.

How do you sequence transmit, receive and timeout in the ladder? #

Run every transaction through one interlocked sequence: ACL to clear the buffers, AWT or AWA to send, a timer to bound the wait, ARD to pull the expected characters into a string element, then a validation step that retries once and sets a fault bit on a second failure.

  1. ACL clears the receive and transmit buffers before each transaction; stale bytes from a timed-out poll are the top cause of intermittent parse failures.
  2. AWT sends the request string, or AWA when the append setting adds the CR LF for you. Seal each step behind the previous step's done bit so a slow scan cannot double-send.
  3. Start a TON response timer; a 250 ms preset is a workable first example, retimed once you have measured the slave's real turnaround.
  4. In Modbus ASCII, ABL tests for the CR LF terminators and ARD or ARL moves the line into the string file. In Modbus RTU, ACB counts characters until the expected byte count is buffered, then ARD moves exactly that count; terminators are off-limits on RTU for the chance-match reason given above.
  5. Validate address, function code and byte count; AEX lifts the data characters out and ACI converts hex to an integer, with AIC building the hex characters you write. An exception response carries the function code plus 128 and one exception byte — log it as a slave reject, not a timeout.
  6. Retry once on timeout or mismatch, then set a communications fault bit the SCADA alarm list can pick up.

How fast can CH0 poll one register at 9600 baud? #

At 9600 baud one serial character is 11 bits, or 1.146 ms, so the 8-byte RTU request takes 9.2 ms, the 7-byte response takes 8.0 ms, and with the silent intervals the transaction fits in about 25 ms before the slave's own turnaround.

The arithmetic: 11 bits divided by 9600 baud is 1.146 ms per character; 8 request bytes times 1.146 is 9.2 ms; the 7-byte response (address, function, byte count, two data bytes, two CRC bytes) times 1.146 is 8.0 ms; the 3.5-character silent interval required before and after each frame is 3.5 times 1.146, about 4.0 ms on each side. A 250 ms poll period therefore idles the line about 90 percent of the time and leaves room for one retry. Modbus ASCII puts twice the characters on the wire — the 17-character request — so budget roughly double the wire time. Keep the full silent gap between transactions: a request sent too soon after the previous response is the failure described in Why a Modbus RTU frame gap before the CRC silences the slave.

When should you stop hand-building frames and buy a module? #

Hand-build for one or two registers in one slave with a short list of write values; buy a Modbus module or a serial gateway once you need runtime CRC-16 on arbitrary values, several slaves, or more than ten write frames, because beyond that you are maintaining a protocol stack in ladder.

Decision for a one-register Watlow temperature controller: select Modbus ASCII mode in the controller if its manual lists it and send the LRC frame from one string element; if the controller is RTU-only, store the constant read frame and the fixed write frames, checksums included, and select among them. Decision for a network of several controllers or a register list that keeps growing: a dedicated Modbus module or gateway brings a real driver, real diagnostics and no custom ladder to hand to the next technician. The few dozen rungs this article asks for document themselves in rung comments; a protocol stack that grew to cover a whole panel never does.

Questions asked

Will the same method work on an SLC 5/04 or 5/05?

Yes. Both processors carry channel 0 with the same driver selection, ASCII included, so the string-instruction approach transfers unchanged. The 5/04's DH+ channel and the 5/05's Ethernet port also give you a programming path independent of channel 0, which makes switching CH0 away from DF1 less risky because you keep online access while you commission the ASCII port.

Why does my hand-built poll get a valid response with a value that looks wrong?

Two classic causes. Register numbering: many manuals print holding registers one-based against a 40001-style base while the frame wants the zero-based offset, so register 40101 becomes offset 100. Register type: on some controllers the measurement lives in an input register read with function 04, not a holding register read with function 03. Confirm both in the controller's register map before touching the frame.

Can CH0 hand-built Modbus poll more than one slave?

Frames can carry any slave address, but every extra address, retry and timeout then lives in your ladder, and each added slave multiplies the rungs and the chances of a framing mistake. One slave with one or two registers is the sensible ceiling for hand-built frames. For two or more slaves, an in-chassis Modbus module or a serial gateway with a real driver does the same job with standard instructions.

How do I test the frames before connecting the running controller?

Connect a laptop running a Modbus slave simulator to CH0 through a null-modem cable, load the same register map, and watch the frames in the simulator's monitor window. Framing mistakes, missing terminators and checksum errors show up there without risking a write to a live controller. Rehearse the failure path too by unplugging the simulator, so the retry and alarm rungs prove themselves.

How many characters fit in one SLC string element?

Each element in a string file holds a length word plus up to 82 characters. The Modbus ASCII read frame for one register is 17 characters including the colon and the CR LF, and a one-register response is shorter still, so one element per frame is comfortable and a multi-register read of a dozen registers still fits.

Keep reading

  • Troubleshooting

    Why a Modbus RTU frame gap before the CRC silences the slave

    Measure the idle time between the last request byte and the first CRC byte. Above 3.5 character times — 4.01 ms at 9600 baud with 11-bit characters — the slave ends the frame before the CRC, discards it without an exception reply, and treats the two CRC bytes as noise, so the master times out. The fix is a master driver that writes address, function, data and CRC in one continuous burst, not line tuning or a slower poll.

    Industrial networks

  • How-to

    How a CJ2M protocol macro reads a 10-register Modbus block

    The short-read master function block stops at two registers, so the CJ2M must send the long-time protection request through an SCU protocol macro: one function 4 call for 10 registers, a receive sequence sized for the 20 data bytes, and a destination of ten consecutive words. A quantity below the full set returns an error, and the next poll waits for the macro's completion code.

    Industrial networks

  • Troubleshooting

    Identifying the mystery Modbus card in an SLC 5/04 rack

    Search the drawing tag 1750-MCM and you find nothing, because it is a drawing annotation, not a catalog number: the MCM suffix points at a third-party Modbus communication module built for the SLC rack — the 1746-platform 3150-MCM family. Read the installed label, then configure the slot the way that module's manual requires, typically the Other entry with the I/O card type ID from its documentation. The two 1746-BAS-T modules are separate serial specialty modules and stay out of the generator polling.

    Industrial networks