0% found this document useful (0 votes)
37 views5 pages

Binary Codes

share our discussion from school in mathemathic in modern world

Uploaded by

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

Binary Codes

share our discussion from school in mathemathic in modern world

Uploaded by

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

COMPREHENSIVE NOTES ON BINARY CODES

Objectives:
By the end of this lesson, students will be able to:
1. Understand the concept of binary code and its role in computer systems.
2. Convert decimal numbers to binary and vice versa.
3. Interpret simple binary codes as characters using ASCII.
4. Apply knowledge of binary systems in simple encoding and decoding activities.

I. Introduction to Binary Code

What is Binary Code?


 Binary Code is a system of representing information using only two digits: 0 and 1.
 This is known as the base-2 numeral system, where:
 0 represents an "OFF" state (no electrical signal).
 1 represents an "ON" state (presence of an electrical signal).
 Binary is the fundamental language of computers because digital electronics work with two
states, ON and OFF.

Why Use Binary?


 Computers operate on electrical circuits that have two states: high voltage (1) and low
voltage (0).
 Using binary simplifies the representation of data in computer systems, making it efficient
for processing and storage.

II. Binary vs. Decimal System

1. Decimal System (Base 10)


 The decimal system is the number system we use in everyday life.
 It is a base-10 system, meaning it uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
 Place values in decimal increase by powers of 10.

2. Binary System (Base 2)


 The binary system uses only two digits: 0 and 1.
 Place values in binary increase by powers of 2:

III. Converting Between Decimal and Binary

1. Decimal to Binary Conversion


Method: Divide the decimal number by 2 repeatedly and record the remainders.
Steps:
1. Divide the number by 2.
2. Record the remainder (either 0 or 1).
3. Continue dividing the quotient by 2 until you reach 0.
4. The binary equivalent is the sequence of remainders read bottom to top.

2. Binary to Decimal Conversion


Method: Multiply each binary digit by its corresponding power of 2 and sum them up.
Steps:
1. Write down the binary number and its place values.
2. Multiply each digit by 2^n, where n is its position from right (starting at 0).
3. Sum all the products to get the decimal number.

IV. Binary Code for Text: ASCII Representation

1. What is ASCII?
 ASCII stands for American Standard Code for Information Interchange.
 It is a character encoding standard that uses 7-bit binary numbers to represent text
characters in computers.
 Each character (letters, digits, symbols) is assigned a specific binary code.

V. Real-World Applications of Binary Code

1. Data Transmission:
 Data is transmitted as binary signals (1s and 0s) through various media like fiber optics,
Ethernet cables, and wireless networks.

2. File Formats:
 All digital files (images, audio, video) are stored as binary data.
 For example: JPEG images, MP3 audio, and MP4 videos are encoded in binary formats for
compression and transmission.

3. Programming and Machine Code:


 The instructions written in programming languages are converted into machine code,
which is a binary format that the computer's processor can execute directly.

VII. Summary
 Binary Code is the fundamental language of computers, using only 0s and 1s to represent
information.
 Conversions between decimal and binary are key skills in understanding how computers
process numerical data.
 ASCII encoding allows computers to represent text characters using binary numbers.
 Understanding binary is crucial for interpreting how computers perform tasks, process data,
and communicate information.
Practice Problems
1. Convert the decimal number 45 to binary.
2. Convert the binary number 11011 to decimal.
3. Encode the word "Cat" using ASCII in binary form.
4. Decode the binary message 01000110 01010101 01001110.
COMPREHENSIVE NOTES ON ASCII

What is ASCII?

 ASCII stands for American Standard Code for Information Interchange.


 It is a character encoding standard used in computers and other devices to represent text.
 ASCII assigns a unique binary number (7-bit code, ranging from 0000000 to 1111111) to
each character, including:
 Letters (both uppercase and lowercase)
 Digits (0-9)
 Punctuation marks (e.g., period, comma)
 Special control characters (e.g., newline, tab)

Importance of ASCII:
 ASCII was developed in the early 1960s to standardize text encoding in computers and
communications equipment.
 It is the basis for most modern character encoding systems, including UTF-8 and Unicode,
which extend ASCII to support more characters and languages.

Examples of ASCII Encoding

1. Encoding Words to Binary Using ASCII


Example: Encoding "Hello":
H = 72 = 01001000
e = 101 = 01100101
l = 108 = 01101100
l = 108 = 01101100
o = 111 = 01101111
Binary Representation: 01001000 01100101 01101100 01101100 01101111

Example: Encoding "123":


1 = 49 = 00110001
2 = 50 = 00110010
3 = 51 = 00110011
Binary Representation: 00110001 00110010 00110011

2. Decoding Binary to Text Using ASCII


Example: Decode 01001000 01101001:
01001000 = H
01101001 = i
Text: "Hi"
Example: Decode 01000010 01111001 01100101:
01000010 = B
01111001 = y
01100101 = e
Text: "Bye"

Applications of ASCII
1. Text Files: Plain text files (like .txt) use ASCII encoding to represent letters, numbers, and
symbols.
2. Programming: Most programming languages, including Python, Java, and C++, use ASCII
codes for handling characters and strings.
3. Data Transmission: ASCII is widely used in internet communication protocols (like HTTP,
SMTP) for data encoding.
4. Keyboard Input: Each keystroke on a keyboard generates an ASCII code that the computer
processes.

Practice Problems
1. Convert the text "GOOD" into binary using ASCII codes.
G = 01000111
O = 01001111
O = 01001111
D = 01000100
Binary Representation: 01000111 01001111 01001111 01000100

2. Decode the following binary code to text: 01110010 01110101 01101110.


01110010 = r
01110101 = u
01101110 = n
Text: "run"

3. What is the ASCII decimal value for the character '$'?


Answer: 36

4. Write the binary code for the lowercase letter 'z'.


z = 122 = 01111010

Summary
 ASCII is a foundational text encoding standard, using binary numbers to represent
characters in computers.
 It simplifies text storage, transmission, and processing in digital systems.
 Understanding ASCII helps us bridge the gap between human-readable text and machine-
readable binary code.

You might also like