IMDHMIControls LibraryShop main store

Explainer

What parity and stop bits change in an M221 Modbus read

Industrial networks Published 7 min read By IMDHMI controls team

Short answer

Parity and stop bits change only the serial character framing between the M221's SL1 port and the slave, and they must match at both ends. They never alter the value a read stores: the communication handler strips the frame and copies only the register data into the destination memory words. A mismatch produces an error status and a timeout, not a wrong number.

On this page
  1. Do parity and stop bits change the value the M221 receives?
  2. What do parity and stop bits do in a Modbus RTU character?
  3. How do you choose the settings when the slave manual gives none?
  4. What happens in the program when the settings don't match?
  5. Does the M221 store the whole frame or only the data?
  6. How does the PROFIBUS sensor's value reach the Modbus registers?
  7. What do you check first when the received value looks wrong?
  8. Questions asked

Parity and stop bits change only how each character travels on the serial wire between the M221's SL1 port and the slave; they never change the value your program receives. The Modbus read strips the address, the function code and the CRC, then copies the data bytes into the destination memory words you chose, so the same register reads identically over even, odd or no parity and one stop bit or two, provided both ends agree. What a mismatch changes is whether a valid reply arrives at all. What follows is what each setting does on the wire, which combination to commit to for a PROFIBUS-to-Modbus gateway, and where a sensor's value can still go stale behind a healthy link.

Do parity and stop bits change the value the M221 receives? #

No. With even, odd or no parity, and one stop bit or two, an identical reply loads identical bits into the destination memory words, because the communication handler validates the frame, strips the framing and hands your program only the register data. The number in those words is decided by two things alone: what the slave's register holds, and the register address and count in your request. The serial parameters decide whether the characters arrive intact, not what they mean once they do. Two installations reading the same register, one at even parity and one at no parity, each matched at both ends, receive the same bits and the same value. Parity is not a filter, a scaling option or a resolution setting; treating it as one sends you searching the wrong place when a number looks wrong.

What do parity and stop bits do in a Modbus RTU character? #

A Modbus RTU character is always 11 bits: 1 start bit, then 8 data bits sent least significant bit first, then either 1 parity bit plus 1 stop bit or no parity plus 2 stop bits. Parity adds an error check; stop bits mark where each character ends. With even parity the transmitter sets the bit so that data plus parity holds an even count of 1s; with odd parity, an odd count. The receiver recounts and flags a parity error on any character that disagrees; no parity omits the bit and the check. The stop bits hold the line at its idle state after the last data bit so the receiver can recognize the next start bit. The Modbus over Serial Line specification adds one more rule: a silent interval of at least 3.5 character times separates frames, which is how both ends know a message has ended.

Example at 19200 bit/s: the character time is 11 ÷ 19200 = 0.57 ms. A request for one holding register is 8 characters (slave address, function code 3, two address bytes, two quantity bytes, two CRC bytes) and the reply is 7 characters, so the wire carries 8 × 0.57 = 4.6 ms of request and 7 × 0.57 = 4.0 ms of reply, plus two silent fences of 3.5 × 0.57 = 2.0 ms each. Wire time per exchange: 4.6 + 2.0 + 2.0 + 4.0 = 12.6 ms, before the slave's own reply delay. Swapping even parity for no parity with its 2 stop bits changes none of this: the character length stays put and only the check disappears. The same character arithmetic explains why Modbus RTU drive polling on one serial port is slow once several slaves share the line.

How do you choose the settings when the slave manual gives none? #

Match both ends and follow the specification's pairing: 1 stop bit when parity is used, 2 stop bits when it is not; with a configurable gateway, set both sides to even parity, 1 stop bit, 8 data bits, 19200 bit/s, and keep that combination. The choice is free whenever both ends are configurable, because the received value does not depend on it, so take the pairing the specification itself prefers: even parity is the Modbus serial-line default, and it buys the per-character check at zero wire-time cost since the character length is unchanged. If the gateway's serial side arrives fixed at no parity with 1 stop bit, match it on SL1 without hesitation; matching beats the recommendation every time. A slave that answers only with one specific parity stays silent on everything else, the failure mode behind why a DL05 Modbus RTU slave answers only with odd parity, so treat a silent slave as a settings question before a wiring question. Assign the gateway a slave address in its own configuration and put the same address in your request; the address is a request field rather than framing, but a wrong one fails just as silently.

What happens in the program when the settings don't match? #

The read finishes with an error status and writes nothing: the receiver flags parity or framing errors, discards the characters, and the destination words keep their previous content, so a mismatch appears as a timeout and never as a plausible wrong number. A receiver set for even parity judges the parity position of every character; a transmitter running without parity leaves that position filled by idle stop time, so the check fails on a share of characters that depends on their content, and the frame is dropped. A receiver set for 2 stop bits meeting 1-stop-bit characters loses the boundary the same way. Either way the whole frame is discarded, on the serial master Modbus RTU read timeouts mean no valid reply arrived, and the function reports the exchange as an error. Corrupted characters are rejected, not repaired into wrong numbers. The trap is the opposite one: a link that has never worked still leaves the destination holding whatever it held, so pass the measurement on only while the read's success status is true; that single habit keeps a dead link from displaying as a live measurement.

Does the M221 store the whole frame or only the data? #

Only the data payload: a read of 4 holding registers comes back as 8 data bytes and lands in 4 consecutive memory words, while the slave address, function code, byte count and CRC are consumed by the communication handler before your program sees anything. You set SL1's speed, data bits, parity and stop bits in the Configuration Tab of SoMachine Basic, under the controller's serial-line settings, and you build the read in the program from its inputs: slave address, function code, starting register, quantity and destination. When the exchange succeeds, those destination words hold the register contents, two bytes per register, and the function's status tells you the copy happened. The transmitted frame exists only on the wire; the destination area holds the payload and nothing else.

How does the PROFIBUS sensor's value reach the Modbus registers? #

Through two independent links: the gateway's PROFIBUS side writes the sensor's process data into its own register table, and SL1 then reads that table over the serial line, so the parity and stop bits you choose never cross the gateway. Configure the sensor against the gateway's PROFIBUS interface (station address, transmission speed, the process-data layout from its GSD file) and configure the gateway's serial side against SL1; the two configurations never share a parameter. The register map belongs to the gateway: a process-data offset on the PROFIBUS side and a register address on the Modbus side are different address spaces, and the value lines up only because the gateway's mapping says it does. Map the sensor's status word into a readable register next to the measurement, because if the PROFIBUS side fails while the serial side stays healthy, the gateway can keep answering every read with the last value it stored, a valid reply carrying stale data. The same one-link-at-a-time discipline applies when a legacy serial PLC needs a gateway for Modbus RTU.

What do you check first when the received value looks wrong? #

Read the status before the number: an error status points to serial settings, wiring or the slave address; a constant value on a healthy status points to the PROFIBUS side or the sensor; a value off by a factor or byte-swapped points to the register map, word order or scaling. Work the cases in that order:

  • Error status: compare SL1's parameters against the gateway's saved serial configuration, then the cable and termination, then the slave address in the request. Parity and stop bits live in this case and only this case.
  • Constant value on a healthy status: open the gateway's PROFIBUS diagnostics and the status register you mapped, and confirm the sensor is still in data exchange.
  • Value moving but off by a factor of ten or byte-swapped: verify the register address and count against the gateway's map, then the word order for 32-bit quantities, then the sensor's scaling.

Parity and stop bits decide whether the conversation happens; they never decide what it says.

Questions asked

Does choosing 2 stop bits make the Modbus read slower?

Only if you add the second stop bit while keeping parity on: that costs one extra bit per character, 52 microseconds at 19200 bit/s, or roughly 0.4 ms across an 8-character request. The specification's own pairing, 2 stop bits only with no parity, keeps the character at 11 bits, so the wire time equals the with-parity variant.

Does the parity bit replace the CRC check?

No, they guard different things. Parity checks each character alone and catches most single-bit errors inside that character. The 2-byte CRC at the end of the frame covers the whole message, which is why a corrupted byte gets the entire reply rejected even with parity off. With parity enabled, both checks run and either one can drop the frame.

Why do many Modbus devices default to no parity and 1 stop bit?

A UART receiver resynchronizes at every start bit and checks only the first stop position, so a second stop bit adds little once the parity check is gone, and the shorter combination became the common default on drives and meters. The serial-line specification still pairs no parity with 2 stop bits, so select 2 whenever both ends offer it.

Can I watch the raw Modbus frame from the M221 program?

Not through the Modbus read function: it hands the program the data bytes and a status, nothing more. To see slave addresses, function codes and CRC values on the wire, connect a serial line monitor across the pair, or open the gateway's telegram log if it provides one. The PLC stores the payload, never the envelope.

What should the destination words hold before the first valid reply?

Whatever your program last wrote there, because an unsuccessful read leaves them untouched. Initialize them to a value the logic treats as invalid, and use the measurement only while the read's success status is true. That habit keeps a dead link from presenting its last number as a live measurement.

Keep reading

  • Explainer

    Concept 2.6 XXMIT limits for polling many Modbus RTU slaves

    For read-only Modbus RTU polling in Concept 2.6 on a 140CPU11302, use XXMIT: one read occupies the processor for at least five PLC scans, so 36 slaves need a poll cycle of at least 180 scan times before any slave response time is added, and a 36-device RS-485 segment exceeds the 32-unit-load electrical limit unless your devices are documented as fractional loads. Declare MsgOut with the type your installed block accepts.

    Industrial networks

  • Troubleshooting

    Why a C# Modbus RTU client for an S7-200 needs its library

    When a C# project that talks Modbus RTU to an S7-200 will not build or launch, the missing Modbus assembly is the fault, not the PLC: restore the library, then match the port's serial settings, slave address and register convention, and prove each layer with one known read.

    Industrial networks

  • Troubleshooting

    Why a CJ2M Modbus RTU master gets no answer from an S7-1200

    Yes, a CJ2M can poll an S7-1200 over Modbus RTU. The simulators proved each PLC's serial settings, not the cable or the port mode between them: set the Omron port to the mode the MRTU_CPU_Master package requires, bring the send pair onto RDA and RDB for 2-wire operation, load the S7-1200 port at even parity, and confirm the frame on the wire with a known value.

    Industrial networks