top of page

Modbus File Record Reads: Keep Register Lengths Separate from Byte Counts

6 hours ago
3 min read

A file-record reply contains the expected data, but a decoder places the next record at the wrong boundary. Before changing a device address, examine the units used by each length field. Modbus Read File Record combines register lengths with byte counts, so treating every count alike can shift the interpretation of an otherwise valid response.


Original conceptual illustration: Modbus File Record Reads: Keep Register Lengths Separate from Byte Counts. Not a live installation or software screen.
Original conceptual illustration; not a specific product, live software screen or customer installation.

Label each count with its unit and scope. A record length in registers is not the byte length of a complete sub-response.

1. Confirm that file-record access is supported


Read File Record is function 20 decimal, or 0x14 hexadecimal. Confirm explicit support, the file organisation and the allowed ranges in the exact instrument and firmware documentation. Ordinary holding-register support does not establish that a device implements file-record access.


For a serial bench connection, discuss the industrial USB-to-RS485 interface with the actual computer, driver and device interface requirements. A physical converter does not add a missing function to an instrument or supply a file-record decoder. Confirm the complete test arrangement before ordering.


The Modbus application specification distinguishes request data lengths expressed in bytes from record lengths expressed in registers. A request contains a separate group description for each requested file-record range. The response has corresponding sub-responses, each with its own length and reference-type field. Keep those structural fields separate from the returned record data.


2. Annotate one complete exchange offline


  1. Preserve the original request and response with the endpoint identity, transport and analyser export format.

  2. Mark each requested file number, starting record and record length using the device's actual definitions.

  3. Label the outer response byte count and each inner sub-response boundary.

  4. Account for the reference-type field before interpreting the record-data bytes.

  5. Check that all sub-responses fit the validated message and match the requested groups.


Use an authorised simulator or an isolated arrangement with documented read support. Do not probe arbitrary files on operating plant or substitute a write operation to test a decoder. The device manual and site procedure govern what may be requested.


Original explanatory diagram for Modbus File Record Reads: Keep Register Lengths Separate from Byte Counts. Synthetic examples and limitations are explained in the article.
Original explanatory diagram. Examples are illustrative; verify the actual device, interface and application requirements.

3. Worked example: three registers are six data bytes


Imagine a hypothetical response to one supported record read of three registers. Each register contributes two data bytes, giving six record-data bytes. The sub-response also includes its reference-type byte, so its length field describes seven following bytes rather than simply repeating the requested register quantity.


For this one-group example, the outer response-data length also accounts for the sub-response's own length byte. That makes eight bytes in the grouped response area: one length byte, one reference-type byte and six data bytes. These counts describe protocol structure, not a measurement range or a product capability.


A decoder that advances by three bytes instead of the complete sub-response length will lose the boundary. With several groups, the resulting values may still look like plausible integers. Use distinguishable synthetic register data and verify every destination group rather than accepting a single plausible number.


4. Diagnose the count that failed


Check

Meaning to preserve

Requested record length

Number of registers requested

Returned record data

Two bytes for each register

Inner response length

Scope of that sub-response

Outer response byte count

Combined grouped response area


Do not apply a blanket one-based address correction borrowed from another register table. Record numbering and file numbering have their own definitions. Do not reverse whole groups to repair a boundary error; establish the structure before considering the representation of individual application values.


When the instrument sits behind a TCP-to-serial bridge, the Unit ID routing guide helps establish the addressed endpoint. Confirm the route as well as the file definition before interpreting a structurally valid reply.


Does a normal reply prove the record has the right engineering meaning?


No. Validate the file definition, selected record, scaling and intended application separately. Structural correctness does not establish units or source quality.


Can a generic Modbus driver read every file?


No. Confirm the driver's function support and the instrument's documented file organisation. A successful ordinary register read is insufficient evidence.


5. Recommended equipment and next action


The USB-to-RS485 interface linked above may form the physical bench connection when its suitability is confirmed. Select the decoding software and exact device documentation separately; no universal file-record support is implied by that equipment link.


For selection advice, provide the instrument model, firmware, transport, documented file definition and a redacted exchange. Ask for confirmation of the supported read route and the evidence required to validate its result before committing to a logging workflow.



Need help with your application?


Send the exact equipment and interface versions, the required outcome and a sanitised example. Ask for a confirmed scope and an acceptance check suited to your application.







Comments


bottom of page