BIN2DEC


Converts a binary number to decimal.

Syntax:

BIN2DEC(binarynumber)

returns a (decimal) number, given binarynumber, which may be text, or a number containing only digits 1 and 0 (thus the number appears to be binary although it is not).

binarynumber may have up to ten bits in two's complement representation; positive numbers are 0 to 111111111 (nine bits representing 0 to 511 decimal) and negative numbers 1111111111 to 1000000000 (ten bits representing -1 to -512 decimal)

Example:

BIN2DEC("110")

returns 6 as a number.

BIN2DEC(110)

returns 6. The number 110 has only 1 and 0 digits, and may be read as binary.

BIN2DEC("1111111110")

returns -2.


Application:

Let's consider a simple application of the BIN2DEC function from the world of digital electronics: an 8-bit digital-to-analog converter (DAC) that controls the brightness of a light. The input to the DAC is an 8-bit binary number, and the output is an analog voltage that controls the light's brightness. The range of the binary number is from 00000000 to 11111111, which corresponds to a decimal range of 0 to 255.


A microcontroller sends a binary number to the DAC. We can use the BIN2DEC function in a spreadsheet to see the decimal value that corresponds to each binary input, which helps us understand the brightness level.

Example Scenario

Imagine we have a spreadsheet to monitor the input values sent to the DAC. We want to know the decimal value for each binary input to understand the brightness level on a scale of 0 to 255.

Binary Input

Formula

Decimal Value (Brightness Level)

A
B
C
1
00000000
BIN2DEC("00000000")
0 (Off)
2
00000001
BIN2DEC("00000001")
1
3
00000010
BIN2DEC("00000010")
2
4
01011001
BIN2DEC("01011001")
89
5
10101010
BIN2DEC("10101010")
170
6
11111111
BIN2DEC("11111111")
255 (Full Brightness)

In this example:

  • The "Binary Input" column represents the 8-bit binary number sent from the microcontroller.
  • The "Formula" column shows the BIN2DEC function.
  • The "Decimal Value" column displays the result of the function, which in this context represents a brightness level from 0 to 255. A value of 0 is off, and a value of 255 is the maximum brightness.


This simple example illustrates how the BIN2DEC function provides a bridge between the binary world of digital electronics and the more human-readable decimal system.





This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof