0% found this document useful (0 votes)
4 views21 pages

Binary Codes

Uploaded by

irylleblanza06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views21 pages

Binary Codes

Uploaded by

irylleblanza06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Binary Codes

Department of Mathematics and Natural


Sciences

Math 031- Mathematics in the Modern World 1


An understanding of binary numbers, the binary
system, and how to convert between binary and
decimal is essential for anyone involved in
computers, coding, and networking.
At the end of this section, you are expected to:
1 Use coding schemes to encode and decode
different types of information for
identification, privacy, and security
2 purposes.
Exemplify honesty and integrity when using
codes for security purposes.

Math 031- Mathematics in the Modern World 2


Definitio
n binary code represents text, computer processor
A
intructions, or any other data using a two-
symbol system.

Math 031- Mathematics in the Modern World 3


Conversion Binary to
Decimal
In a binary system, each digit represents an
increasing power of 2, with the rightmost digit
representing 20, the next 21, then 22, and so on.
A binary number can be converted into its
equivalent decimal reprsentation by summing
up the power of 2 which each digit represents.
Example
Convert the binary number 10011010 into
decimal.

Math 031- Mathematics in the Modern World 4


Conversion Binary to
Decimal
The symbols 0’s and 1’s will serve as the
coefficient/factors of power of 2’s.
Start counting the power from the rightmost digit;
for the binary number 10011010, there are 8
digits, thus the highest power of 2 is 7.
We have now the conversion:
7 6
5
4
3
100110102 = 1 × 2 + 0 × 2 + 0 × 2 + 1 × 2 +
1×2
2
1
0
+0×2 +1×2 +0×2
= 128 + 0 + 0 + 16 + 8 + 0 + 2 + 0
=World
Math 031- Mathematics in the Modern 15410 5
Conversion Binary to
Decimal PRACTICE 1
Convert the given binary numbers into
decimal.
1 110011
1
2 1000000
01
3 111111
01
Note: For answers please refer to the last part of this
presentation.

Math 031- Mathematics in the Modern World 6


Conversion Decimal to
Binary
An easy method of converting decimal to binary
number equivalents is write down the decimal
number and to continually divide by 2 to give a
quotient and a remainder of either 1 or 0 until
the final quotient is 0.
Example
Convert the decimal 45 into binary equivalent.

Math 031- Mathematics in the Modern World 7


Conversion Decimal to
Binary
45 ÷ 2 = remainder
22 =1
22 ÷ 2 = remainder
11 =0
11 ÷ 2 = remainder
5 =1
5÷2= remainder
2 =1
Then right down
2 ÷ the
2 =remainders from bottom
remainder
to top. 1 =0
1÷2= remainder
Answer: 101101
0 =1

Math 031- Mathematics in the Modern World 8


Conversion Decimal to
Binary
PRACTICE 2
Convert the given binary numbers into
decimal.
1 10
7
2 6
8
3 20
5
Note: For answers please refer to the last part of this
presentation.

Math 031- Mathematics in the Modern World 9


Rema
rk
Conversion from binary to decimal and from decimal to
binary can be done using your scientific calculator. All you
have to do is set the mode of your calculator to ”Base N”.
Decimal to Binary
Press ”Dec” and input the number/given
Press ”Bin” and you will the binary equivalent of the
given decimal number
Binary to Decimal
Press ”Bin” and input the number/given
Press ”Dec” and you will the decimal equivalent of the
given binary number

Math 031- Mathematics in the Modern World 10


Integers in
Computer
1 Bit - consists of 2
bits
2 Nibble or Quad - consists of 4
bits
3 Byte - consists of 8
bits
4 Word - consists of 16
bits

Math 031- Mathematics in the Modern World 11


ASCII
Code
The most widely accepted code is called the American
Standard Code for Informaation Interchange (ASCII). The
ASCII code associates an integer value for each symbol
in the character set, such as letters, digits, punctuation
marks, special characters, and control characters.
Computers convert text and other data into binary by
using an assigned ASCII value. Once the ASCII value is
known, that value can be converted into binary.
The
ASCIIfollowing
65 66 ASCII
67 68 code
69 70of 71
CAPITAL
72 73 letters
74 75 from
76 77 A to Z
Character A B C D E F G H I J K L M

ASCII 78 79 80 81 82 83 84 85 86 87 88 89 90
Character N O P Q R S T U V W X Y Z

Math 031- Mathematics in the Modern World 12


ASCII
Code
Example
To print the word ”HELLO” what is the required binary
digits that the computer can understand?
Solution
Use the ASCII code for each letter. Convert each ASCII
to binary digits. It will be our convention to use Byte or
8 bits in each letter.
The word ”HELLO” has four distinct letters ”H” ”E”
”L” and ”O”

Math 031- Mathematics in the Modern World 13


ASCII
Code
Example
To print the word ”HELLO” what is the required binary
digits that the computer can understand?
Solution

LETTER H E L O
ASCII 72 69 76 79
Binary 01001000 01000101 01001100 01001111
Equivalent
Note: A 0 is added to the left in order to have an 8-
digit binary equivalent for each letter and binary
equivalent of ”L” must be written twice.
Final Answer:
0100100001000101010011000100110001001111

Math 031- Mathematics in the Modern World 14


ASCII
Code
Example
A certain binary digits
010000010100101001000001 are detected
after an input in the keyboard. What will be
the expected letters that will appear in the text
editor?
Solution
Group the binary digits by 8 or in Bytes.
Convert each group to its corresponding
decimal equivalent to get the ASCII
value.
Withe given ASCII values above
Math 031- Mathematics in the Modern World 1
ASCII
Code
Example
A certain binary digits 01000001 01001010 01000001
are detected after an input in the keyboard. What will
be the expected letters that will appear in the text
editor?
Solution
Binary 01000001 01001010 01000001
Equivalent
ASCII 65 74 65
LETTER A J A
Note: ASCII values that we have are for CAPITAL
letters only.
Final Answer: AJA

Math 031- Mathematics in the Modern World 16


ASCII
Code
PRACTICE 3
Translate the following binary codes into
english
1 words:
0101010001001000010000010100111001
001011
2 01011001010011110101
0101
3 01000010010110010100
0101
Note: For answers please refer to the last part of this
presentation.

Math 031- Mathematics in the Modern World 17


ASCII
Code
ACTIVITY 3

Translate the following binary codes into


english
1 words:
010010110100010101000101010
1 0000
2 010100110100000101000110010
00101
3 0100101101001001 01000100
01010011

Math 031- Mathematics in the Modern World 18


Answers to
Practice 1

1 10
3
2 25
7
3 25
3

Math 031- Mathematics in the Modern World 19


Answers to
Practice 2

1 110101
1
2 100010
0
3 110011
01

Math 031- Mathematics in the Modern World 20


Answers to
Practice 3

1 THAN
K
2 YO
U
3 BY
E

Math 031- Mathematics in the Modern World 21

You might also like