OLevel

## Binary Systems

Binary Systems

### Binary Systems

• The positive integers represented by the sequence of 1s and 0s are known as the binary numbers or the base 2 numbers.
• Whereas the base 10 numbers are known as denary numbers.

### Why We Use Binary Numbers?

• Transistors are used by the microprocessors that identify voltage levels instead of decimal numbers.
• High voltage in a microprocessor is identified as an ON state or a '1' whereas, a low voltage is identified as an OFF state or a '0'.
• The low voltage level is usually 0V while high voltage varies from 3.3V to 5V.
• Different hardware uses different ways to identify the binary number system e.g. in CD ROMs, tiny black spots are considered as ‘0’ and shiny spot represents a ‘1’.

### What is a Bit?

• The smallest representation of binary numbers can be broken down into ‘bits.
• Bits in binary numbers can be considered as ‘digits’ in the denary numbers.
• In denary numbers, a digit is a place that holds values between 0 to 9 whereas in binary numbers a bit is a place that can hold value ‘0’ or ‘1’ only.
• In denary numbers, a group of digits form larger numbers e.g. 67 has two digits, 984 has three digits, etc.
• In 67, ‘7’ holds the ‘1s’ place and ‘6’ holds ‘10s’ place.
• In 984, ‘4’ holds the ‘1s’ place, ‘8’ holds ‘10s’ place and ‘9’ holds ‘100s’ place.

### Number Representation in Denary:

• Let’s take 984 for understanding the number representation.

1st Method:

#### (9 x 100) + (8 x 10) + (4 x 1) = 900 + 80 + 4 = 984

• In this method we simply multiply each digit with the place it fills.

2nd Method:

#### (9 x 102) + (8 x 101) + (4 x 100) = 900+ 80 + 4 = 984

• In this method, starting from right to left, each digit is multiplied by 10x.
• The power of 10 is least i.e. zero at the R.H.S and highest on the L.H.S.

### Number Representation in Binary:

• In binary, we use the 'raised to the power' method to find out the value of the binary number.
• This method is exactly the same, however, instead of 10x, we will use 2x.

### Example:

• Let’s find out the value of binary number 1010.

• Using the raised to the power method,

### Binary to Denary Conversion:

• Converting a binary number to denary is simple and we already discussed it in the previous heading.

• It involves multiplication of each bit with 2x where ‘x’ is lowest at R.H.S and highest at L.H.S.

• Just to revise it, let’s take a binary number 10111.

### Denary to Binary Conversion:

• There are two methods to convert a denary number to its binary representation.
• The first method is 'trial and error' while the second method involves the successive division of the number by 2.
• Let’s understand both with an example.

### Method 1 - Trial & Error Method:

• This method involves placing ‘1’ and ‘0’ at correct places so that the sum equals the denary value.
• Let’s see the conversion of 107.

• Do not feel confused with the numbers above ‘1’ and ‘0’ as it represents 2x.
• From R.H.S, 20 = 1, 21 = 2, 22 = 4, 23 = 8, 24 = 16, 25 = 32, 26 = 64 and 27 = 128.
• The binary number representation contains 8 bits (standard) that’s why used 2 raised to the power 0 till 7.
• If you see a representation that contains less than 8 bits e.g. 1011. The rest 4 bits on the left side were '0s'. 00001011 and 1011 represent the same number and both ways are correct.

### Method 2 – Successive Division Method:

Let’s use 107 to understand this method.

In this method 107 is divided again and again until the value becomes 0.

• We divided 107 by 2, it gave us 53 and remainder 1.
• 53 divided by 2, gave us 26 and remainder 1.
• 26 divided by 2, gave us 13 and remainder 0.
• 13 divided by 2, gave us 6 and remainder 1.
• 6 divided by 2, gave us 3 and remainder 0.
• 3 divided by 2, gave us 1 and remainder 1.
• 1 divided by 2, gave us 0 and remainder 1.
• Now that the number became 0, we can add 0s on the L.H.S to make it an 8-bit number.

### What is a Byte & Memory Size?

• One binary digit is known as a ‘bit’ while 8 binary bits make a ‘byte.
• It is the smallest unit of memory in a computer.
• Some systems use larger bytes e.g. 16-bit, 32-bit, etc. but memory size is always a multiple of 8.
• A single letter or character uses 1 byte of memory but many special characters and characters from foreign languages use more than one byte.

### Example Use of Binary System:

• The computer system uses registers to control devices like robotics, digital instruments, and power systems.
• The registers are made up of binary bits i.e. ‘0’ and ‘1’.
• Following is an example of a robot vacuum cleaner that will help you understand how registers are used to control devices.

• As shown in the figure above, there are three wheels in a robot vacuum cleaner.
• Wheel ‘A’ rotates on a spindle while Wheels ‘B’ and ‘C’ are fixed and attached to a motor.
• Wheel ‘A’ also facilitates in direction changes.
• An 8-bit register is used to control the vacuum cleaner.

• If the register contains the value 10101010 then Motor B and C both are on and the vacuum cleaner will move forward.