Binary acquisition can improve transfer efficiency, but an incorrect decoder can produce numeric values from the wrong interpretation of the bytes. The resulting array may even look smooth. Validate the format and scaling against known data before using decoded readings in a PCB test decision.

Python’s binary packing documentation makes byte order, size, and alignment explicit choices. Those choices illustrate the decoding contract; the instrument’s own programming documentation must define the actual transmitted sample format and any accompanying header.

Capture the complete format definition

Record the instrument model, acquisition mode, transfer command, byte order, signedness, sample width, and number of samples. Identify whether values are integers requiring conversion or floating-point values already representing a physical quantity. Keep scaling and offset metadata with the data to which they apply.

Separate transport framing from sample decoding. A block header may state a payload byte count, while the waveform metadata states a sample count. Header bytes and trailing terminators should not become samples merely because the total response can be divided into equal chunks.

Use discriminating validation signals

Condition Purpose
Known positive and negative levels Checks signed representation and offset
Distinctive changing pattern Reveals byte or sample ordering errors
Known number of samples Checks payload completeness
Independent reference reading Checks physical scaling

Where supported, compare a small acquisition through both documented text and binary paths. Use the same captured data if the instrument allows it, so that differences do not merely reflect a changed input waveform. Record the source of any expected rounding difference.

Validate before accepting a record

  1. Check the reported and received payload lengths.
  2. Decode using the explicit instrument format.
  3. Verify sample count and status information.
  4. Apply the matching scaling metadata once.
  5. Store the decoded result with its acquisition identity.

Do not guess a different format until the plot looks plausible. Several incorrect combinations can produce bounded values. Resolve format uncertainty from the source documentation and command configuration, then use the known signal to verify the implementation.

Retain representative raw payloads and metadata as regression examples. Include truncated data and an intentionally wrong byte-order case so that failures remain detectable after parser changes. A decoder should reject incomplete records rather than filling absent samples with zeros or recycling bytes from a previous acquisition.

The released conversion should explain how each physical value is obtained from its bytes. That traceability is essential when a later instrument or firmware change modifies the transfer format without changing the test’s visible name.

Move from reading to a build-ready project

Use the fabrication and assembly checklists to prepare drawings, production files and test requirements.

Open the DFM checklist