A binary and hexadecimal table maps base-10 integers to base-2 (binary) and base-16 (hex) formats, serving as the foundational lookup for microcontroller register manipulation, I2C addressing, and bitwise logic. In embedded systems, you use hexadecimal to read memory pointers and I2C addresses, and binary to configure hardware registers via bitwise operators. The table below provides the complete 8-bit mapping, prioritizing the boundary values and bit-masks most frequently queried by Arduino and ESP32 developers.

How to Read This Binary and Hexadecimal Table

Before jumping to the data, understand the assumptions and columns used in this reference chart. This table assumes an 8-bit unsigned integer format (0 to 255), which is the standard byte width for GPIO port registers, I2C addresses, and SPI command bytes.

  • Decimal: The human-readable base-10 value. Used primarily for setting PWM duty cycles (0-255) or ADC thresholds.
  • 8-Bit Binary: The base-2 representation, padded to 8 bits. Used for visualizing bitwise operations (AND, OR, XOR) and hardware register states.
  • Hexadecimal: The base-16 representation, prefixed with 0x. Used for I2C device addresses, memory pointers, and color codes.
  • Bitmask / Use Case: The practical application of this specific value in embedded C/C++ programming.
Bench Tip: When reading binary aloud or debugging logic analyzer traces, group the bits into nibbles (4-bit chunks) separated by a space (e.g., 0011 1100 instead of 00111100). This instantly maps to the hex digits 3 and C, saving you from doing mental math while probing a live bus.

The Complete 8-Bit Reference Chart

The following table covers the fundamental 0-15 sequence (the base hex nibble) and the critical power-of-2 boundaries used in 8-bit register mapping. Data conventions align with Arduino Bitwise Reference and standard ISO/IEC 80000-13 binary prefix definitions. Bookmark the specific id anchors for quick lookups.

Decimal 8-Bit Binary Hexadecimal Common Embedded Use Case
00000 00000x00Clear register / GPIO LOW
10000 00010x01Bit 0 mask (1 << 0)
20000 00100x02Bit 1 mask (1 << 1)
30000 00110x03Lower 2-bit mask
40000 01000x04Bit 2 mask (1 << 2)
50000 01010x05Alternating low nibble
60000 01100x06Standard I2C control byte
70000 01110x07Lower 3-bit mask (0x07)
80000 10000x08Bit 3 mask (1 << 3)
90000 10010x09Common I2C register pointer
100000 10100x0ALine feed / SPI command
110000 10110x0BConfig register default
120000 11000x0CBit 2 & 3 mask
130000 11010x0DCarriage return (UART)
140000 11100x0ELower 3 bits inverted
150000 11110x0FLower nibble mask (0x0F)
160001 00000x10Bit 4 mask (1 << 4)
320010 00000x20Bit 5 mask / Space char
390010 01110x27PCF8574 I2C LCD Address
640100 00000x40Bit 6 mask (1 << 6)
600011 11000x3CSSD1306 OLED I2C Address
1270111 11110x7FMax 7-bit signed integer
1281000 00000x80Bit 7 mask (MSB set)
2551111 11110xFFFull byte mask / GPIO HIGH

Applying the Table to Microcontroller Registers

Which Column Applies to Your Installation

Your 'installation' in embedded systems is the specific hardware bus or code block you are manipulating. Use the Hexadecimal column when configuring I2C addresses (e.g., initializing a Wire library with 0x3C) or reading memory-mapped registers in the Espressif ESP32 Technical Reference Manual. Use the Binary column when writing bitwise logic to toggle specific pins without affecting others (e.g., REG |= 0b00000100). Use the Decimal column strictly for human-facing outputs, like mapping an analog sensor reading to a 0-255 PWM duty cycle.

How Logic Thresholds and Masking 'Derate' the Base Value

In wire ampacity tables, derating reduces current capacity based on heat. In digital logic, the equivalent concept is how voltage thresholds and bitwise masking modify the effective base value. A binary 1 is not universally a 1. If you are driving an ESP32-WROOM-32 GPIO pin (3.3V CMOS logic), the datasheet specifies a high-level input voltage (VIH) minimum of roughly 2.3V. If your signal source is a 1.8V sensor, the physical voltage 'derates' your logical 1 down to a 0 (unrecognized). Furthermore, applying a bitmask like & 0x0F derates an 8-bit value down to a 4-bit nibble, intentionally stripping the upper four bits to isolate a specific sensor reading.

What This Table Cannot Tell You

This chart assumes standard unsigned, big-endian byte ordering. It cannot tell you:

  • Endianness: Whether a 16-bit value like 0x1234 is stored in memory as 12 34 (Big-Endian) or 34 12 (Little-Endian). The ESP32 (Xtensa LX6) is Little-Endian.
  • Signed vs. Unsigned: The binary 1111 1111 is 255 in unsigned math, but -1 in Two's Complement signed math. Always cast your variables explicitly in C++.
  • Floating Point: Hexadecimal representations of floats follow the IEEE 754 Standard. The hex value 0x41200000 does not equal decimal 1,092,616,192 in this context; it represents the float 10.0.
Safety Warning: Never connect a 5V Arduino Nano I2C bus directly to a 3.3V ESP32 without a logic level shifter (like the BSS138 MOSFET bi-directional shifter). The 5V 'HIGH' binary state will exceed the ESP32's absolute maximum ratings and permanently brick the silicon.

Frequently Asked Questions

How do I convert a hexadecimal I2C address to binary for bit-banging?

Break the hex address into two nibbles. Take the common SSD1306 OLED address 0x3C. The first digit 3 maps to 0011, and the second digit C (which is 12 in decimal) maps to 1100. Combine them to get 0011 1100. When bit-banging I2C over GPIO pins, you shift this binary value left, reading the Most Significant Bit (MSB) first to toggle your SDA and SCL lines.

Why does my ESP32 read 0xFFFFFFFF instead of a standard hex value?

If you are reading a sensor via SPI or I2C and receive 0xFFFFFFFF (all binary 1s), it rarely means the actual value is 4,294,967,295. In embedded diagnostics, a bus reading all 1s indicates a floating bus or a disconnected device. The internal pull-up resistors are pulling the data line HIGH because the slave device is not acknowledging or driving the line LOW. Check your wiring, verify the slave device has power, and ensure your I2C/SPI clock speed isn't exceeding the sensor's maximum rating.

What is the fastest way to toggle a single bit using this binary and hexadecimal table?

Use the bitwise XOR operator (^) combined with a bit-shift. If you want to toggle Bit 3 on a hardware register, look up Bit 3 in the table: Decimal 8, Hex 0x08, Binary 0000 1000. In your code, write REG ^= (1 << 3);. If the bit was 0, XOR makes it 1. If it was 1, XOR makes it 0. This avoids the need for if/else conditional checks, executing in a single CPU clock cycle.