You are on page 1of 43

BINARY CODES

FINALS
HE L LO
0100 1000 0100 0101 0100 1100 0100 1100 0100 1111
The utility of mathematics goes beyond the mundane (dull and
ordinary). Mathematics enables the development of codes and ciphers (
a way of changing message to keep it secret) that are
useful to individuals and to society.

Coding scheme (Tabut, 2015) is a convention that associates each


character with character set with a unique bit pattern – a binary
representation of the integers from 0.
ASCII, EBCDIC and UNICODE – common coding schemes
ASCII (American Standard Code for
Information Interchange)
It is the most common format for text file in computers and on the internet.
In an ASCII file, each alphabetic, numeric or special character in representation with
a 7-bit binary number (as string of 0’s or 1’s).
128 possible characters defined.
ASCII-7 ASCII-8
128 combination and represents 128 256 combination and represents 256
unique symbols unique symbols
3 bits for zone 4 bits for digits 4 bits for zone 4 bits for digits

It is widely used to represent data in computer.


A bit (shorter for binary digit) is the smallest unit of data in a
computer. A bit has a single binary value either 0 or 1. although
computers usually provided instructions that can test and
manipulate bits, they generally are designed to store data and
execute instructions in a bit multiplies called bytes.
EBCDIC (Extended Binary Coded
Decimal Interchange Code)
It is a binary code for alphabetic, numeric characters that IBM
developed for its largest systems. IBM (Internet Business Machines) is the
largest computer company in the world. IBM started in 1911 as a producer of
mainframe and minicomputers. It has 8-bit code, 4 bits for zone, and for 4
bits for digits. It allows 2^8 = 256 combinations and represents 256 unique
symbols. It is used mainly in mainframe computers.
UNICODE
UNIVERSAL CODE is the coding scheme that is new ANSI
(American National Standards Institute) standards. It supports
most of the world’s languages and becoming the internet standard.
It is a 16-bit coding scheme that has the capacity of representing
more than 65,000 characters and symbols.
It represents text, symbols, characters in multilingual
environment. It uniquely represents a symbol in language like
China and Japanese, etc. and mathematical and scientific symbols.
It has 32 bits and allows 2^32 approximately 4 billion
combinations. It is compatible and identical to ASCII-8. It is
implemented by character encoding and commonly used
encoding scheme. It uses 8-32 bits per code.
Unicode character
Symbol
encoding in MS-Word

Unicode Unicode
code in hex (hex)
Binary Code
Is the simplest form of computer code or programming
data. It is represented entirely by a binary systems of digits
consisting of a string of consecutive zeros and ones. Binary code
is often associated with machine code in that binary sets can be
combined to form raw code, which is interpreted by a computer
or other piece of hardware.
Binary Number System
The binary number system is a numbering system that
represents numeric values using two unique digits (0 and 1).
Most computing device use binary numbering to represent
electronic circuit voltage state. (i.e., on/off switch), which
considers 0 voltage input as off and 1 input as on. This is also
known as the base-2 numbering system, or the binary
numbering system.
Binary File
A binary file is a type of computer file that is used to store binary data. It may contain
any type of formatted or unformatted data encoded within binary format. It is used directly
by the computer and generally can’t be read by human. Binary files can also be called
binaries.
A binary file may consist of binary data stored by the computer or non-binary data
converted or encoded into binary data. A binary file generally remains native and resident
within the computer, but it can be converted/encoded to plain text if it needs to be
transmitted over a network/internet connection. A computer program file is one of the most
common examples of a binary file.
Binary Digit (Bit)

A binary digit, or bit is the smallest unit of


information in a computer. It is used for storing
information and has a value of true/false, or on/off. An
individual bit has a value of either 0 or 1, which is generally
used to store data and implement instructions in groups
of bytes.
Operations on Binary Numbers
Decimal
Let us have this example 329 for the base 10 or decimal.

Hundred Ten One


(10^2) (10^1) (10^0)
3 2 9

=three(100) + two (10) + 9(1) = three hundred + twenty + nine


=three hundred twenty-nine = 329.
Suppose the number 101 is in base 2 or binary.
four Two One
(2^2) (2^1) (2^0)
1 0 1

= one (4) + zero (2) + one (1) = 4 + 0 + 1 = 5


So, 101 in binary = 5 in decimal.
1 0 0 1 0 1 1
64 32 16 8 4 2 1
1 0 0 0 1 1 1 0
128 64 32 16 8 4 2 1
75 ÷ 2 = 37 r. 1 Least significant bit
37 ÷ 2 = 18 r. 1
18 ÷ 2 = 9 r. 0
9÷2=4 r. 1
4÷2=2 r. 0
2÷2=1 r. 0
1÷ 2=0 r. 1 Most significant bit
142 ÷ 2 = 71 r. 0 Least significant bit
71 ÷ 2 = 35 r. 1
35 ÷ 2 = 17 r. 1
17 ÷ 2 = 8 r. 1
8÷2=4 r. 0
4÷2=2 r. 0
2÷2=1 r. 0 Most significant bit
1÷2=0 r. 1
1 0 1 0
0x1=0
1x2=2
0x4=0
1x8=8
1 0 0 1 0 1 1
1x1=1
1x2=2
0x4=0
1x8=8
0 x 16 = 0
0 x 32 = 0
1 x 64 = 64
1 0 0 0 1 1 1 0
0x1=0
1x2=2
1x4=4
1x8=8
0 x 16 = 0
0 x 32 = 0
0 x 64 = 0
1 x 128 = 128

142
Decimal to binary
1. 50 = 1 1 0010
2. 23 = 1 0111
3. 45 = 1 0 1101
4. 81 = 1 0 1 0001
5. 64 = 1 0 0 0000
Binary to decimal

6. 1 1 0 0 0 1 1 = 99
7. 1 1 0 0 1 1 0 = 102
8. 1 0 0 0 0 0 = 32
9. 1 0 1 1 = 11
10. 1 1 0 0 1 = 25
Addition of Binary Number
To add binary number,

0+0=0
1+0=1
0+1=1
1 + 1 = 10
1 + 1 + 1 = 11
a. 1 0 1 0 + 1 0 1 0 = 1 0 1 0 0

b. 1 1 1 0 1 + 1 0 1 0 = 1 0 0 1 1 1

c. 1 1 1 1 1 + 1 1 1 1 1 = 1 1 1 1 1 0
Subtraction of Binary Number
To subtract binary number,

1-1=0
0-0=0
1-0=1
0 - 1 = 1 but carry is required 10 – 1 = 1
• Example1:

1 0 1 1 1 = 16 + 4 + 2 + 1 = 23
- 1 0 1 0 1 = 16 + 4 + 1 = 21
0 0 0 1 0 =2 =2

Example2:

1 1 0 = 1 0 10 (borrow 1 from 1 to make 0 to be 10) = 4 + 2 = 6


- 1 0 1 =1 0 1 =4+1=5
0 0 1 1
d. 1 0 0 1 - 1 1 = 1 1 0

e. 1 0 0 0 1 - 1 0 0 = 1 1 0 1
Multiplication of Binary Numbers
To multiply binary number, we will do the same process as
decimals.

0 1 0 1 =4+1 =5
x 1 0 1 1 =8+2+1 = 11
0 1 0 1 55
0 1 0 1
0 0 0 0
0 1 0 1 .
1 1 0 1 1 1 = 32 + 16 + 4 + 2 + 1 = 55
f. 1 0 1 x 1 0 = 1 0 1 0

g. 1 0 1 1 x 1 1 = 1 0 0 0 0 1
Division of Binary Numbers
h. 1 0 1 1 1 1 / 1 0 = 1 0 1 1 1
ENCODING AND DECODING
Encoding as an element of communication is the process of
assembling the message (information, ideas, and thoughts) into a
representative design with the objective of ensuring that the receiver can
comprehend it. While, decoding is listening and reading directions
carefully.
In computer application, encoding is the process of converting the
characters to integers and decoding converts back to characters.

You might also like