BINARY CODE Juzen A. Lusica Mary Grace E. Salavaria
BINARY CODE
Juzen A. LusicaMary Grace E. Salavaria
Objectives
• Define what is a Binary Code
• Learn how to calculate a binary code
• Learn how to write in binary numbers and transform a binary code to an English Language Letters
BINARY CODEis a base 2 number system invented by Gottfried Leibniz where numeric values are represented by different combinations of 0 and 1, also known as OFF or ON.
Is the simplest form of computer code or programming data.
HOW TO READ A BINARY CODEThe following chart illustrates the binary number 01101000. In this example, we get the total value by reading the chart from right to left and adding each column's value to that of the previous column: (8+32+64) = 104. As you can see, we do not count the bits with a 0 because they're "turned off."
VALUE 128 64 32 16 8 4 2 1
ON/OFF 0 1 1 0 1 0 0 0
CONVERTING A TEXT INTO A BINARY CODE
In converting a text to binary code we will use the ASCII or American Standard Code for Information Interchange. ASCII codes represent text in computers, telecommunications equipment, and other devices. Most modern character-encoding schemes are based on ASCII, although they support many additional characters
Letter Code Decimal Letter Code Decim
al
A 01000001 65 N 0100111
0 78
B 01000010 66 O 0100111
1 79
C 01000011 67 P 0101000
0 80
D 01000100 68 Q
01010001
81
E 01000101 69 R
01010010
82
F 01000110 70 S 0101001
1 83
G 01000111 71 T 0101010
0 84
H 01001000 72 U
01010101
85
I 01001001 73 V 0101011
0 86
J 01001010 74 W 0101011
1 87
K 01001011 75 X
01011000
88
L 01001100 76 Y
01011001
89
M 01001101 77 Z 0101101
0 90
ASCII
EXAMPLE:1. Convert the word CAT into a binary
code.First, we need to identify first the binary number of each letter in the word CAT. In the letter C base on the ASCII it is equal to 67
VALUE 128 64 32 16 8 4 2 1
ON/OFF 0 1 0 0 0 0 1 1
In the letter A base on the ASCII it is equal to 65VALUE 128 64 32 16 8 4 2 1
ON/OFF 0 1 0 0 0 0 0 1 In the letter T base on the ASCII it is equal to 84 VALUE 128 64 32 16 8 4 2 1
ON/OFF 0 1 0 1 0 1 0 0
Lastly, we will just combine their binary numbers.
C A T
01000011 01000001 01010100
Hence, the binary code of CAT is 010000110100000101010100.
2. Translate this binary code 01010011010101000100010101001101 into a word.
01010011 01010100 01000101 01001101
VALUE 128 64 32 16 8 4 2 1
ON/OFF 0 1 0 1 0 0 1 1
VALUE 128 64 32 16 8 4 2 1
ON/OFF 0 1 0 1 0 1 0 0
VALUE 128 64 32 16 8 4 2 1
ON/OFF 0 1 0 0 0 1 0 1
VALUE 128 64 32 16 8 4 2 1
ON/OFF 0 1 0 0 1 1 0 1
64+16+2+1=83 S
64+8+4+1=77 M
64+4+1=69 E
64+16+4=84 T
Hence, the word STEM is the text of the binary code 01010011010101000100010101001101