A hex and binary table translates base-16 (hexadecimal) and base-2 (binary) into human-readable base-10 (decimal) formats. For embedded developers wiring ESP32-WROOM-32 modules, programming AVR shift registers, or debugging I2C buses, this is not just abstract math. It is the exact map used for GPIO pin masking, memory allocation, and peripheral addressing. The most critical values to memorize are the nibble boundaries (0x0 to 0xF) and the alternating bit patterns (0x55 and 0xAA) used for hardware bus testing.

How to Read the Hex and Binary Conversion Table

Before scrolling to the data, understand how to read the columns. The Hex column represents a single base-16 digit (0-F). The Binary column shows the exact 4-bit nibble equivalent, which is how the microcontroller's ALU actually processes the data. The Decimal column provides the base-10 integer value. Finally, the Hardware Application column maps the abstract number to a real-world embedded task, such as setting a specific GPIO pin high or configuring an I2C address. The table below is constructed in accordance with standard digital logic conventions (referencing M. Morris Mano's Digital Design) and aligns with the register mapping definitions found in the Espressif ESP32 Technical Reference Manual.

Table 1: Nibble and Common Hardware Constants (Source: ISO/IEC 80000-13 binary prefixes & Espressif TRM register definitions)
Hex (Base-16) Binary (Base-2) Decimal (Base-10) Hardware Application / Register Use
0x000000Clear register / Pull-down state
0x100011Set Pin 0 high (Bit 0)
0x200102Set Pin 1 high (Bit 1)
0x300113Pins 0 & 1 high (UART TX/RX mask)
0x401004Set Pin 2 high (Bit 2)
0x501015Pins 0 & 2 high
0x601106Pins 1 & 2 high
0x701117Lower 3 bits set (7-segment decoder)
0x810008Set Pin 3 high (Bit 3 / SPI CS)
0x910019Pins 0 & 3 high
0xA101010Pins 1 & 3 high (I2C SDA/SCL alt)
0xB101111Pins 0, 1, 3 high
0xC110012Pins 2 & 3 high
0xD110113Pins 0, 2, 3 high
0xE111014Pins 1, 2, 3 high
0xF111115Lower nibble fully set (4-bit bus mask)
0x550101010185Alternating bits (SPI clock phase testing)
0xAA10101010170Alternating bits (SRAM/Flash burn-in test)
0xFF11111111255Full 8-bit byte set (Max PWM duty cycle)

Which Base Applies to Your Embedded Installation?

In electrical wiring, you select a specific ampacity column based on your insulation temperature rating. In embedded systems, you select your numerical base based on the specific hardware interface you are manipulating. You rarely use raw decimal when interacting directly with silicon.

Rule of Thumb: Use Hexadecimal when addressing memory, defining I2C peripheral addresses, or writing color codes. Use Binary when performing bitwise logic, configuring GPIO pin masks, or clocking data into shift registers like the 74HC595.
Criteria Hexadecimal (Base-16) Binary (Base-2)
Primary Use Case I2C addressing (e.g., 0x3C for SSD1306 OLED), MAC addresses, memory pointers. GPIO port manipulation, bitwise AND/OR/NOT operations, shift register payloads.
Human Readability High. Condenses 32-bit registers into 8 readable characters (e.g., 0xDEADBEEF). Low. A 32-bit register requires 32 digits, but visually maps 1:1 with physical pins.
IDE Syntax (C/C++) Prefixed with 0x (e.g., 0xFF). Prefixed with 0b (e.g., 0b11111111) in GCC/Arduino environments.
Error Spotting Harder to spot a single flipped bit in a long hex string. Instantly obvious if a specific pin (bit) is set high or low.

How Bit-Masking and Shifting Modify Base Values

In wire sizing, derating rows modify the base ampacity based on ambient temperature and conduit fill. In digital logic, bit-shifting and masking modify the base binary value based on register width and logical operations. You rarely write a raw static binary number to a microcontroller register; instead, you derive it dynamically.

Consider setting Pin 5 high on an 8-bit GPIO register without affecting Pins 0-4 or 6-7. You do not write 0b00100000 directly, because that would overwrite the entire register and turn off other active pins. Instead, you use a bit-shift operation:

  • The Shift: 1 << 5 takes the binary value 00000001 (Hex 0x01) and shifts it left by 5 positions, resulting in 00100000 (Hex 0x20, Decimal 32).
  • The OR Mask (Setting a bit): REG |= (1 << 5); forces Bit 5 high while leaving all other bits in their current state.
  • The AND Mask (Clearing a bit): REG &= ~(1 << 5); inverts the shifted value to 11011111 (Hex 0xDF) and forces Bit 5 low while preserving the rest.

Understanding the hex and binary table allows you to instantly verify these operations. If your logic analyzer shows a register value of 0x24, you can mentally split the hex into nibbles: 2 (0010) and 4 (0100), combining them to 00100100. You immediately know that Pins 2 and 5 are high.

What This Table Cannot Tell You: Endianness and Signed Integers

A standard hex and binary table assumes unsigned, single-byte, big-endian representation. When you move from 8-bit logic to 16-bit or 32-bit microcontrollers (like the 32-bit Xtensa LX6 cores in the ESP32), the table falls short in three critical areas. For a deeper dive into foundational logic gates and binary arithmetic, refer to the All About Circuits Digital Textbook.

1. Signed vs. Unsigned (Two's Complement)

The table shows 11111111 as Hex 0xFF and Decimal 255. This is true for an uint8_t (unsigned 8-bit integer). However, if that same byte is read as an int8_t (signed integer), the most significant bit (MSB) acts as a sign flag. In Two's Complement arithmetic, 11111111 evaluates to -1, not 255. Always check your variable type in the C/C++ code before assuming the decimal equivalent.

2. Endianness (Byte Order in Memory)

The table maps a single value, but it does not tell you how multi-byte values are stored in RAM. The ESP32 and most ARM-based microcontrollers are Little-Endian. If you write the 32-bit hex value 0x12345678 to memory, it is physically stored in reverse byte order: 78 56 34 12. If you are writing a custom bootloader or reading raw SPI flash dumps, assuming Big-Endian byte order will result in corrupted memory pointers and hard faults.

3. Floating Point Representation (IEEE 754)

You cannot use a standard hex table to map floating-point numbers. The hex value 0x41200000 does not equal decimal 1,092,616,192 when interpreted as a 32-bit float. Under the IEEE 754 standard, that specific hex sequence represents the decimal value 10.0. When debugging sensor data (like temperature readings from a BME280) transmitted as raw hex bytes over UART, you must cast the memory pointer to a float rather than relying on base conversion tables.