A binary counting chart maps base-2 bit patterns (0s and 1s) to their base-10 decimal and base-16 hexadecimal equivalents. For standard 8-bit unsigned registers, the count spans 0 to 255. For 16-bit unsigned registers, it spans 0 to 65,535. When writing firmware for microcontrollers like the Arduino Uno (ATmega328P) or the ESP32-WROOM-32, knowing these boundary values and bit-weight columns by heart prevents overflow bugs, eliminates mid-debug calculator trips, and clarifies exactly what your hardware is doing at the silicon level.

The chart below provides the definitive lookup for the most critical boundary values, powers of two, and overflow thresholds encountered in embedded systems programming and digital logic design.

The Master Binary Counting Chart (0–255 & Key 16-Bit Bounds)

How to read this table: This chart is based on the base-2 positional numeral system, formalized in NIST guidelines for binary mathematics and prefixes and standard digital logic conventions (ISO/IEC 80000-2). The Binary column shows the raw bit states from Most Significant Bit (MSB, left) to Least Significant Bit (LSB, right). The Hex column provides the base-16 shorthand used in C/C++ programming (prefixed with 0x). The Decimal column shows the human-readable base-10 value. The Application Note column explains why this specific row matters in embedded firmware.

Binary (8-bit / 16-bit)HexDecimalApplication Note
0000 00000x000Ground state; cleared register; logic LOW.
0000 00010x011LSB set; minimum positive step; bitmask for Bit 0.
0000 00100x022Bit 1 set; often used for I2C stop conditions or flags.
0000 01110x077Lower 3 bits set; bitmask for 3-bit timers or prescalers.
0000 10000x088Bit 3 set; standard byte boundary marker.
0000 11110x0F15Lower nibble max; used for masking 4-bit ADC outputs.
0001 00000x1016Bit 4 set; base of hexadecimal counting.
0001 11110x1F31Lower 5 bits set; common bitmask for 5-bit PWM channels.
0010 00000x2032Bit 5 set; 32-byte boundary; common I2C address base.
0100 00000x4064Bit 6 set; 64-byte boundary; UART FIFO depth on some MCUs.
0111 11110x7F127Max positive value for an 8-bit signed integer (Two's Complement).
1000 00000x80128MSB set; minimum negative value (-128) in signed 8-bit math.
1111 11110xFF255All bits set; max 8-bit unsigned; standard 'blanking' or 'pull-up' state.
0000 0001 0000 00000x01002568-bit overflow threshold; requires 16-bit register (e.g., Timer1).
0111 1111 1111 11110x7FFF32,767Max positive value for a 16-bit signed integer.
1000 0000 0000 00000x800032,76816-bit MSB set; minimum negative value (-32,768) in signed math.
1111 1111 1111 11110xFFFF65,535All 16 bits set; max 16-bit unsigned; standard 16-bit timer overflow.
Bookmark Quick-Jumps for Common Debugging Scenarios:
  • Why did my 8-bit timer reset to 0 at 256? See row 0x0100 (8-bit overflow).
  • Why is my sensor reading -1 instead of 255? See row 0xFF (Signed vs. Unsigned interpretation).
  • How do I mask the lower 4 bits of an I2C byte? See row 0x0F (Bitwise AND masking).

Which Column Applies to Your Register and How Shifting Modifies Values

In wire ampacity charts, you look at temperature columns to find your safe limit. In a binary counting chart, which column applies to your installation depends entirely on your microcontroller's architecture and the specific peripheral register you are addressing. If you are bit-banging an I2C line or configuring a GPIO pin on an ATmega328P, you are usually manipulating the LSB (Bit 0) or MSB (Bit 7) columns directly using bitwise operators. However, if you are configuring a 32-bit ARM Cortex-M4 (like the STM32F103) or an ESP32, you are often writing to 32-bit registers where the lower 16 bits might control one peripheral feature and the upper 16 bits control another.

Furthermore, you must understand how derating rows modify the base value. In electrical tables, derating reduces ampacity based on ambient heat. In binary counting, 'derating' the base positive value occurs when you switch from unsigned to signed integers using Two's Complement mathematics. By reserving the Most Significant Bit (MSB) as a sign bit, you effectively derate your maximum positive range by 50% to accommodate negative numbers. An 8-bit unsigned register gives you 0 to 255. 'Derate' it to a signed integer, and your positive range drops to 127 (0x7F), while the upper half of the chart (0x80 to 0xFF) now represents -128 to -1.

Shifting also modifies the base value exponentially. A left bitwise shift (<<) multiplies the decimal value by 2 for every position moved. Shifting 0x01 (1) left by 4 positions yields 0x10 (16). If you shift 0x80 (128) left by one position in an 8-bit register, the MSB falls off the edge, resulting in 0x00 (0) — a classic overflow bug that silently corrupts data in C/C++ firmware if you fail to cast the variable to a 16-bit uint16_t before shifting.

What the Chart Cannot Tell You: Endianness and Hardware Mapping

While this binary counting chart gives you the mathematical truth of base-2 conversions, what the table cannot tell you is how your specific hardware stores multi-byte values in physical memory. This is governed by endianness.

If your code writes the 16-bit decimal value 258 (0x0102) to memory, the chart tells you the binary is 00000001 00000010. But it does not tell you which byte gets written to the lower memory address. On a Little-Endian system (like the ARM Cortex-M series in most modern STM32 and ESP32 chips), the least significant byte (0x02) is stored at the lowest memory address. On a Big-Endian system (common in older network protocols and some DSPs), the most significant byte (0x01) goes first. If you cast a uint16_t pointer to a uint8_t array to transmit over UART without accounting for endianness, your receiving device will read the bytes backward, interpreting 258 as 513 (0x0201).

Additionally, the chart cannot tell you the physical memory-mapped address of the register you are trying to manipulate. Setting the 5th bit to 1 (0x20) only turns on an LED if you write that value to the correct GPIO Output Data Register (e.g., GPIO_OUT_W1TS_REG on the ESP32, as detailed in the Espressif ESP32 Technical Reference Manual). Writing 0x20 to the wrong memory address could inadvertently disable a hardware watchdog timer or trigger a brownout reset. Always cross-reference your binary bitmasks with the specific silicon datasheet for your exact MCU variant before compiling.