BradJolly

ECE Student Success Toolkit - Generalized Number Bases

Blog Post created by BradJolly Employee on Oct 25, 2018

A motivated high school student can usually obtain appropriate high school math preparation for an electrical and computer engineering (ECE) or computer science course of study. Algebra, geometry, trigonometry, and calculus are widely available in many high schools, and these are mostly sufficient for a freshman engineering student.

 

However, some topics needed for ECE are often covered briefly at best in the secondary math curriculum. One such topic is generalized number bases, including binary, hexadecimal, and octal numbers. A surprising number of freshman ECE students, even at highly respected universities, have no idea how to convert among numbers expressed in the following bases:

 

Base

Name

10

Decimal

2

Binary

8

Octal

16

Hexadecimal

 

Overview of binary numbers

Binary numbers are the basis of modern computers, which use 0 and 1 to represent OFF and ON states in digital circuits. Just as the decimal number system uses the ten digits 0 through 9, the binary number system uses the two digits 0 and 1. For example, a binary number might be written as shown below.

Figure 1: A binary number

 

In addition, just as the place values of the base ten system are 100, 101, 102, 103, 104, and so on, the place values of base 2 begin with 20, 21, 22, 23, 24, as shown below.

Figure 2: A binary number with base ten place values

 

Therefore, the value of the binary number above is the sum of the place values with 1’s in them:

Value of binary number = 32,768+16,384+4,096+1,024+512+256+8+2 = 55,050

 

Overview of octal and hexadecimal numbers

One challenging aspect of binary numbers is that they are long and difficult to read. While it is easy to read “fifty-five thousand, fifty”, the number “one, one, zero, one, zero, one, one, one, zero, zero, zero, zero, one, zero, one, zero” is a bit awkward (apologies for the pun).

 

To reduce the awkwardness of binary numbers, we often group binary digits into groups of three or four digits from right to left. Groups of three bits are represented as 0 to 7 (octal), and groups of four bits are represented as 0 to F (hexadecimal), as shown below.

 

Decimal

Three Bits

Octal

Four Bits

Hexadecimal

0

000

0

0000

0

1

001

1

0001

1

2

010

2

0010

2

3

011

3

0011

3

4

100

4

0100

4

5

101

5

0101

5

6

110

6

0110

6

7

111

7

0111

7

8

 

 

 

N/A

1000

8

9

1001

9

10

1010

A

11

1011

B

12

1100

C

13

1101

D

14

1110

E

15

1111

F

 

The place values of octal numbers are 80, 81, 82, 83, and so on. We can therefore convert a binary number to octal three bits at a time and evaluate it as shown below:

Figure 3: Converting a binary number to octal, three bits at a time

 

Adding the numbers shown in the Product row, we see that the octal number 153412 is equivalent to the base 10 number 55,050.

 

A hexadecimal example

Finally, we can group the bits four at a time to convert them to base 16 (hexadecimal), as shown below.

Figure 4: Converting a binary number to hexadecimal, four bits at a time

Practice converting between bases

To practice these conversions, consider using Excel to generate test cases. Excel has 12 functions, named DEC2BIN, HEX2OCT, OCT2DEC, and so on that convert among the various number bases. You simply specify the input number and, in some cases, the number of digits you want in the output. For example, =DEC2BIN(185,10) converts the decimal number 185 into the 10-digit binary number 0010111001.

 

Summary

University ECE departments expect incoming students to understand number bases, but many students never receive appropriate instruction on this in high school. Students who are unfamiliar with these concepts should spend some time studying them before they arrive on campus to start studying ECE or computer science.

Outcomes