If you need to know how to convert from binary to denary for the 8-bit sequence 11001010, the direct answer is 202. In electrical and embedded systems, we don't just memorize charts; we use the positional weight formula: D = Σ(bi × 2i). Substituting our values from right to left (bit 0 to bit 7): (1 × 27) + (1 × 26) + (0 × 25) + (0 × 24) + (1 × 23) + (0 × 22) + (1 × 21) + (0 × 20), which simplifies to 128 + 64 + 0 + 0 + 8 + 0 + 2 + 0 = 202. But raw denary is only half the battle on the bench—the physical meaning of that "202" shifts entirely depending on your system's voltage scaling and data assumptions.

The Core Conversion Formula and Neighboring Values

The base-2 positional weight system means every step leftward doubles the previous value. When debugging a microcontroller register or a PLC input byte, it helps to know the neighborhood of your target value to spot off-by-one errors or ADC jitter. Below is a spec-sheet-table of denary values within a ±20% range of our target (roughly 162 to 242), showing how the binary sequence shifts.

Denary (Base-10) Binary (8-Bit) Hexadecimal Deviation from 202
165 10100101 A5 -18.3%
180 10110100 B4 -10.8%
202 11001010 CA 0.0% (Target)
220 11011100 DC +8.9%
240 11110000 F0 +18.8%

What Assumptions Fix the Answer? (Bit-Width and Sign)

In AC power theory, power factor and phase angle are the assumptions that fix your real power calculation. In binary math, bit-width and signedness are the assumptions that fix the denary answer. The sequence 11001010 only equals 202 if we assume it is an unsigned 8-bit integer.

If your C++ code or PLC environment defines this register as a signed 8-bit integer (int8_t), the system uses Two's Complement. The leading 1 in the most significant bit (MSB) flags the number as negative. To find the denary value, you invert the bits (00110101) and add 1 (00110110), which equals 54. Therefore, the signed denary answer is -54.

Similarly, if this byte is padded into a 16-bit register (0000000011001010), it remains a positive 202. Always verify your variable type in the IDE or PLC tag database before trusting the conversion.

Scaling Raw Denary to Physical Voltage (120V vs 230V vs 3-Phase)

A common mistake among hobbyists and junior technicians is treating a raw ADC denary value as a universal physical measurement. An ESP32 or a PLC analog input card doesn't read "Volts"; it reads binary counts. How the answer shifts for 120V vs 230V vs 3-phase systems depends entirely on your sensor's scaling factor.

Assume our 11001010 (202) comes from an 8-bit ADC register where 255 represents the full-scale maximum voltage of your sensor circuit. Here is how that raw denary count translates to physical AC voltages across different global standards:

  • 120V AC Branch Circuit (US/NA): If the sensor is scaled to 120V RMS at full scale, the physical voltage is (202 / 255) × 120V = 95.0V.
  • 230V AC Mains (EU/UK/AU): If the same 8-bit register is mapped to a 230V nominal line, the physical voltage shifts to (202 / 255) × 230V = 182.1V.
  • 400V 3-Phase Industrial: On a 3-phase system scaled to 400V line-to-line, that exact same binary sequence represents (202 / 255) × 400V = 316.8V.

Safety Caveat: Never assume a raw ADC denary value represents a universal voltage. The scaling factor is hardcoded by your sensor's resistor divider network or potential transformer (PT). Always consult the sensor datasheet before probing live mains.

When Binary-to-Denary Conversion is Meaningless

Just like calculating Watts without knowing the power factor yields useless data, converting binary to denary is mathematically correct but practically meaningless if the encoding isn't a pure base-2 integer. According to the Modbus Application Protocol Specification, industrial registers frequently use alternative encodings:

  • BCD (Binary Coded Decimal): Used in older digital panels and RTC (Real Time Clock) chips. The binary 1001 0010 in BCD means "92" (9 and 2). If you convert it as pure binary, you get 146, which will cause your time-sync logic to fail.
  • IEEE 754 Floating Point: If you pull a 32-bit register from a power meter holding the value 3.14, converting that raw binary to a pure denary integer yields 1078523331. You must use a float-cast function in your code, not a base-2 integer conversion.
  • ASCII Text: On an RS-485 bus, 01000001 converts to 65 in denary, but to the receiving UART, it is the text character "A".

Frequently Asked Questions About Binary Conversion

How do you convert a 16-bit binary number to denary?

You use the exact same positional weight formula, but extend the powers of 2 up to 215 (32,768). For example, the 16-bit binary 0000000011001010 is calculated as (1 × 128) + (1 × 64) + (1 × 8) + (1 × 2) = 202. The leading zeros simply add 0 to the sum. If the MSB (bit 15) is a 1, the maximum unsigned value is 65,535.

Why is denary called base-10 and binary base-2?

"Denary" (more commonly called decimal in the US) is base-10 because it uses ten distinct symbols (0-9) per positional column before rolling over to the next column. Binary is base-2 because it uses only two symbols (0 and 1), rolling over after every single increment. This maps perfectly to physical electronics, where a transistor is either off (0V / Low) or on (VCC / High). For a deeper dive into base systems, Khan Academy's digital information module provides excellent visual breakdowns.

Can I use C++ to convert binary to denary on an ESP32?

Yes. In the Arduino IDE or ESP-IDF, you don't need to write manual conversion loops. The compiler handles binary literals natively using the 0b prefix. If you are reading a string from a serial terminal, use strtol(). Here is the exact implementation for an ESP32 ADC reading:

// Native binary literal assignment
uint8_t raw_binary = 0b11001010; 
int denary_value = raw_binary; // Compiler stores as 202

// Converting a string from Serial input
char serial_string[] = "11001010";
int parsed_denary = strtol(serial_string, NULL, 2); // Base 2
Serial.println(parsed_denary); // Outputs: 202