Specialist Supplier of Crystals & Frequency Control Componentssales@mecxtal.com.cn0755-26500570
MERLIN home / Rednote / System Validation and Replacement

Diagnosing an ADC Zero-Crossing Jump by Comparing Offset Binary and Two's Complement | Crystal & Oscillator Handbook

An industrial acquisition module records a slowly rising bipolar analog input. The test repeats at room temperature and shows the same result. Near zero, the software trace jumps from close to its upper limit to close to its lower limit. Retain the converter's raw output words and check whether they use offset binary or two's complement. If the device sends offset binary but the software reads the same bits directly as two's complement, a small continuous change at the input can turn into a large digital jump. This trace alone does not establish that the input jumped or that the sampling oscillator drifted.

This example uses only saved data from an in-house low-voltage sample and synthetic words. It requires no connection to production sensors or changes to registers or hardware. First see whether the same raw data regain a continuous trend under the documented interpretation. Then distinguish real overrange, misordered bytes, incompatible coding, and other causes. Keep evidence for each conclusion so an “ADC read error” does not become an unspecified fault label.

Raw bits need a coding convention to represent positive or negative values

Assume 12-bit bipolar data with an ideal center sample corresponding to zero. Offset binary places values near negative full scale at the lowest unsigned codes, zero at the center of the code range, and the positive end near the highest unsigned codes. For zero-centered counts, interpret the word as unsigned and subtract the midpoint, 2,048. Two's complement represents zero with an all-zero word and negative values with the most significant bit set. To interpret a 12-bit two's-complement word with that bit set, subtract 4,096 from its unsigned value.

The change in coding is independent of byte order. A change in output format can alter the physical value assigned to the same bit pattern without changing bit order. For the ideal conversion between the two formats, flip the most significant bit within the valid width, then interpret the result as two's complement at that width. Establish width and alignment first. For a 12-bit sample in a 16-bit container, some positions can be extension or padding bits. Check their definition before interpreting the value.

Some ADCs offer these two encodings or other formats, and the default can differ from the assumption in legacy software. Even for a configurable part family, use the current, verifiable settings to establish the format. Interpret the zero input condition according to the device configuration. Equal voltages at a pair of differential inputs are not equivalent to a pin voltage of zero relative to ground. Zero in the example denotes the predefined ideal center code and says nothing about actual board offset.

Example with a one-code increase interpreted as a jump across the signed range

These three samples lie near the center of an ideal 12-bit range. Hexadecimal notation displays the raw code and adds no sign of its own.

Expected centered countRaw offset-binary wordCorrectly decoded countMisread as 12-bit two's complement
−10x7FF−1+2,047
00x8000−2,048
+10x801+1−2,047

The raw sequence increases by one code between the first two samples. The final column falls from +2,047 to −2,048, a change of −4,095 in one step. The sign boundary in the decoding rule created the discontinuity. It does not show that the analog input changed by the same amount. If the ADC actually uses two's complement, the ideal raw sequence for those samples is 0xFFF, 0x000, 0x001. The code appears to wrap from the highest word to zero while the properly decoded values stay continuous.

Neither example guarantees static codes for a real device. Real samples may reflect noise, offset, input range, and calibration, and archived readings may have been scaled or converted before export. Use these examples to check offline decoding without reconstructing device inputs from the examples or changing operating equipment. Raw codes and physical values require a matching interpretation even when the code sequence itself appears discontinuous.

Distinguish coding issues from clipping and dropped samples

Save raw words around the affected part of the trace, together with the sample identifier, valid width, container alignment, and coding for that acquisition. A rendered voltage trace alone cannot show whether the jump came from the original capture or a later decoding step. Verify the analysis tool using synthetic raw words with known properties, then compare against recorded samples without reconfiguring the device.

Check whether the jump recurs at the same type of code boundary, independent of clock time. If synthetic data that sweep slowly through center remain continuous after correct decoding, and the other format reproduces the jump, decoding and physical overrange can be examined separately. If the raw values stay at the applicable input limit for an extended interval under both interpretations, check the analog range, front end, or conversion state. A trace that looks smooth after one recalculation does not rule out electrical problems. Confirm that the chosen decoding matches the actual output definition.

Two other cases are easy to confuse with coding. If bytes or channels are out of order, reconstruct each valid word before investigating its sign bit. A receiver can also decode correctly, followed by a second sign conversion during export. Audit device output, acquisition files, exported data, and display separately. Hexadecimal notation alone does not identify where a conversion belongs.

Specify how the receiving software interprets the raw words

For an in-house acquisition board that needs a 25 MHz CMOS active reference, the Epson SG-210STF X1G004171003300 from Japan is one candidate. Review supply, receiver logic levels, package, enable function, and the actual clock path against the design. The example does not identify a part installed on a finished module or imply that it can directly drive any high-speed converter. The output coding is a separate requirement. A correct clock frequency does not change the sign interpretation.

For a converter module, ask the manufacturer for the effective width, actual encoding, container alignment, modes that change the format, and where those modes can be verified. Sample files should cover a negative reference, near-center points, and a positive reference on the same channel with paired raw codes and engineering values. An effective-resolution screenshot or a smooth-looking plot alone cannot verify correct handling of the zero crossing. When switching between modules with the same resolution, verify that their coding matches or that software performs the agreed conversion.

Place the width, raw code, software interpretation, expected engineering value, and clock reference in separate fields. Compare two interpretations of the same data when investigating a discrepancy. If replacement modules can negotiate or change formats through configuration, assign responsibility for storing those parameters so replay does not revert to an old default.

Frequently asked questions

Does a sign change at zero mean the analog input exceeded its range? If raw offset-binary codes merely cross the midpoint while software expects two's complement, the large jump can come entirely from the mapping. Check the raw codes, acquisition status, and actual output definition together.

Does flipping the highest bit repair all such data? The equivalence applies to verified offset binary and two's complement and requires the highest bit of the valid sample word. It cannot repair byte order, invalid samples, other formats, or data already converted correctly.

WeChat

MERLIN · TIMING COMPONENTS

Scan with WeChat to contact Sales

Add our WeCom contacts from your usual WeChat app.

On desktop, scan with your phone. On mobile, save the QR image and select it from your album in WeChat Scan.