The University of Manchester · FACULTY OF ENGINEERING

AERO61021 Chap.8 Binary Number Formats in Data Acquisition

- one subject, every graph, every model, every mark
6 Chapters3-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 8 of 10 · AERO61021

Binary Number Formats in Data Acquisition

Binary Number Formats in Data Acquisition explains why the number a computer displays can differ from the value a sensor produced. Acquisition hardware stores every reading as bits, and software applies a rule to interpret them.

The chapter builds unsigned integers from powers of two, shows how a sign bit extends the idea to negative numbers, and explains why practical systems use two's complement, in which the leading bit of a byte carries a weight of minus 128 and a signed byte spans minus 128 to 127. It then follows what happens when a value is too large for its container: the stored pattern stays the same, but a signed reading can flip sign, and a counter wraps from 127 back to minus 128 without any warning.

A second family of faults comes from reading a floating-point word as an integer, which leaves the shape of the data intact while multiplying its magnitude enormously. The skills are practical: decode a byte under each rule, size a format to hold the largest value expected, and recognise the signatures of overflow and reinterpretation on a plot before blaming the sensor or the rig.

In this chapter

What this chapter covers

  • 01

    Unsigned integers from bit weights

  • 02

    Sign-magnitude representation and its two zeros

  • 03

    Two's complement bytes and their range

  • 04

    Overflow and wrap-around in signed formats

  • 05

    Floating-point words misread as integers

  • 06

    Choosing a data type for counters and averages

Worked example · free

Find where a stored byte lands on the wrap-around dial

Q [4 marks]. A program stores the value 230 in one byte and a second program reads that byte as a signed 8-bit integer. Write the bit pattern, then find the reading the second program displays. The weighting is AskSia's own and does not come from any University marking guide or official scheme.
One byte drawn as a dial: unsigned values on the outside rise clockwise from 0, while the signed reading inside jumps from +127 to minus 128 at the bottom, so 2One byte drawn as a dial: unsigned values on the outside rise clockwise from 0, while the signed reading inside jumps from +127 to minus 128 at the bottom, so 200 stored as a byte reads as minus 56. 064128200 0+64−128−56 U8 outsideI8 inside wrap point
One byte drawn as a dial: unsigned values on the outside rise clockwise from 0, while the signed reading inside jumps from +127 to minus 128 at the bottom, so 200 stored as a byte reads as minus 56.
  • 1Build 230 from bit weights: 128 + 64 + 32 + 4 + 2 = 230, so the pattern is 11100110.
  • 2In two's complement the leading bit weighs minus 128 and the other bits add 64 + 32 + 4 + 2 = 102, giving minus 128 + 102 = minus 26.
  • 1Check with the shortcut: because the leading bit is 1, the signed reading equals 230 minus 256, which is also minus 26.
The byte 11100110 holds 230 as an unsigned value but is displayed as minus 26 when read as a signed 8-bit integer. These marks are AskSia practice weighting and are not an official allocation from the University.
Sia tip — Before plotting, compare the largest value you expect with the top of the format: 127 for a signed byte, 255 for an unsigned byte.
Glossary

Key terms

Two's complement
A signed binary scheme in which the leading bit carries a negative weight, giving one unique zero.
Sign bit
The leading bit of a signed number, which marks the value as negative when it is set.
Wrap-around
The jump to the opposite end of a format's range when a value exceeds the largest number it can hold.
Floating-point number
A binary format that stores a sign, an exponent and a fraction so that non-integer values can be represented.
FAQ

Binary Number Formats in Data Acquisition FAQ

Why does my LabVIEW graph suddenly jump from 127 to minus 128?

The value has been converted to a signed 8-bit integer, whose largest value is 127. One step beyond that, the leading bit becomes 1 and is interpreted with a weight of minus 128, so the trace drops to the bottom of the range and starts climbing again. Use a wider integer or a floating-point type for the quantity.

Is sign-magnitude ever used for signed integers?

It is a useful teaching step, because it simply marks a number negative with its leading bit. Practical computers avoid it for integers, however, because both 00000000 and 10000000 would represent zero. Two's complement removes the duplicate zero and extends the negative range to minus 128 for a single byte.

How can a correct image come back with values in the billions?

If floating-point pixel values are saved and then reopened as 32-bit integers, each word is reinterpreted rather than converted. The spatial pattern survives because every pixel is affected in the same way, but the magnitudes become enormous. Converting one value back to its bits and testing the integer reading confirms the diagnosis.

Study strategy

Assessment move

Learn this topic by hand before relying on software. Write the eight bit weights, from 128 down to 1, at the top of a page and convert a dozen values in each direction until you can do it without counting on your fingers.

Then repeat the drill with the leading weight replaced by minus 128 so that two's complement becomes routine; check each answer with the shortcut that a signed reading equals the unsigned value minus 256 whenever the leading bit is set. Pair every conversion with a statement of the range of the format you are using, because most faults in acquisition code come from a value that did not fit.

Next, practise recognising symptoms rather than computing values. A trace that climbs steadily and then jumps to the opposite sign at a round binary boundary indicates overflow in a short integer. A trace whose shape looks right but whose magnitude is wrong by an enormous factor suggests that bits were reinterpreted between formats, often a floating-point value read as an integer.

A trace that seems clipped to a narrow positive band can mean a fractional value was forced into an integer type. In LabVIEW, look at the colour of each wire and the representation of each indicator, and watch for coercion dots where a conversion happens silently. Hovering over a wire with context help open shows its exact representation, which settles any doubt in seconds.

When you build the group project code, decide the data type of every stored or displayed quantity at the start and write it next to the variable, including counters, sample indices and averages. As a closing habit, keep a short log of any strange value you meet in the lab together with the bit pattern behind it; working back to the bits is the habit that turns a confusing plot into a precise fault report.

A+Everything unlocked
Unlocks this Bible + all 41 of your subjects at The University of Manchester, plus 1,000+ more Bibles across the AskSia library.
Sia - your AERO61021 tutor, unlimited, worked the way the exam marks it
The full 3-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works