CE2704 · Digital Logic Design
Theme 1 · Numbers & codes

Register maps: reading a byte

Where everything so far pays off: a single byte is a chip's control panel. Learn to read it, and you can bring up almost any chip from its datasheet.

Built from first principles. This is the bridge to understanding microcontrollers.

Before you start

What you need first

  • Number bases & place value — the bit positions in a byte.
  • Base conversions — turning a hex byte into its 8 bits.

What you'll be able to do

  • Say what a register and a register map are.
  • Decode a byte into the settings of a bit-field table.
  • Avoid the three classic beginner mistakes.

A chip's control panel

Think of a chip as a tiny machine with a control panel inside. Each switch turns one feature on or off — and in real silicon those switches are just bits. A small group of bits is a register.

A register map is the table in the datasheet that says what each bit does. To configure the chip you write the right bit pattern into the right register; to see what it's doing you read a register and decode its bits.

This is why hex is everywhere: one hex digit = 4 bits, so a byte like 0xD8 shows all 8 switches at a glance.
An 8-bit register 1 1 0 1 1 0 0 0 bit 7654 321bit 0 = 0xD8
Eight little switches, packed into one byte.

Example: a desk fan's control register

Real sensors, motor drivers and displays all work this way — but let's use a familiar device. One 8-bit register holds all of a desk fan's settings, and the datasheet says what each bit (or group of bits) does:

Bit(s)NameWhat it controls
7POWER1 = fan ON, 0 = OFF
6–5SPEED00 low · 01 medium · 10 high · 11 turbo
4SWING1 = swing left–right, 0 = still
3TIMER1 = auto-off timer on
2BEEP1 = beep on button press
1–0unused (leave as 0)
SPEED uses two bits because it has four choices (2 bits = 4 options). Every other setting is a single on/off bit.
📐 Worked example

You read 0xD8 from the fan. What is it doing?

1Write the byte in binary:
$$ \mathtt{0xD8} = 1101\,1000 $$
2Match each bit (or group) to the table:
POWER (7)SPEED (6–5)SWING (4)TIMER (3)BEEP (2)
1 → ON10 → high1 → swing1 → on0 → off
So 0xD8 means: fan ON, running high, swinging, timer set, beep off — five settings packed into one byte.

✏️ Try it yourself

You read 0xA4 from the same fan. What is it doing?

Binary: 0xA4 = 1010 0100. Decode: POWER 1 = ON; SPEED 01 = medium; SWING 0 = not swinging; TIMER 0 = off; BEEP 1 = on. In words: ON at medium speed, not swinging, no timer, beeps on button press.

Three things beginners get wrong

  • Which end is bit 0? Most tables put bit 0 on the right (the smallest place value), but always check the datasheet's own picture before counting.
  • Leave "unused"/"reserved" bits as 0. Setting them to 1 can make the device behave strangely.
  • To change one switch, don't wipe the others. Read the current byte, change just that one bit, then write the whole byte back. This read–modify–write habit is essential.
Example of the third: the fan is at 0xD8 and you want to turn the beep on (bit 2). Writing 0x04 would switch everything else off. Instead, take 0xD8, set bit 2, and write that whole new byte (0xDC).

Why this skill matters

Every modern chip — a sensor, an ADC, a motor driver, a microcontroller peripheral — is configured and read through registers exactly like this. Whatever you build, the same skill applies: convert fluently between hex and bits, and read a bit-field table.

🔭 Looking ahead: a microcontroller has hundreds of these registers (Theme 7, peripheral registers), and a real sensor like the MPU6050 is read by pulling bytes out of its registers over a wire (Theme 8, I²C). You already have the core skill.

Recap — the whole topic on one screen

IdeaWhat you own now
RegisterA small group of bits (usually 8/16/32) inside a chip
Register mapThe datasheet table saying what each bit does
Decode a byteHex → bits → match each bit-field to the table
PitfallsBit-0 end · reserved bits stay 0 · read–modify–write

Next topic · Theme 2

Boolean basics & the AND/OR/NOT gates

You can now represent and read the numbers a chip holds. Next we learn how a chip decides — the logic of true/false, built from the three basic gates.

→ Boolean basics & gates