0% found this document useful (0 votes)
16 views

MMW MSD Module 5 Codes

The document discusses codes and binary code. It defines codes as a set of rules to represent information in another form. Binary code represents information using only 1s and 0s and is the system used by modern computers. Each binary digit is called a bit, and 8 bits form a byte which can represent 256 possible combinations. Boolean logic uses 1s and 0s to represent true and false values and are the basis for logical operations in computing.

Uploaded by

l.labaupa
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)
16 views

MMW MSD Module 5 Codes

The document discusses codes and binary code. It defines codes as a set of rules to represent information in another form. Binary code represents information using only 1s and 0s and is the system used by modern computers. Each binary digit is called a bit, and 8 bits form a byte which can represent 256 possible combinations. Boolean logic uses 1s and 0s to represent true and false values and are the basis for logical operations in computing.

Uploaded by

l.labaupa
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/ 8

52

UNIT V. CODES
by Joseph R. Del Carmen

Overview

Code is a set of rules for covering information such as letters, words, sound effects, or gestures into another form
or representation, often shortened or hidden for communication through a channel or storage medium. An invention of
language that allowed a person to convey what he or she saw, heard, felt or thought to others through communication is
called codes.

Learning Objectives:

At the end of the lesson, you are expected to:


1. Describe and apply the decimal number system
2. Explain and perform the Binary Code
3. Discuss and compute the Boolean Logic

Lesson Proper

Our usual number system is called the decimal number system. For all of our numbers we use ten symbols:
0,1,2,3,4,5,6,7,8, and 9. The decimal method is useful because it is user friendly. However, we make use of another
method for computers due to physical limitations.

Positional Notation

More symbols may we added to represent more essential numbers. It is too much, though! Imagine having a
symbol memorized for each number. We use these 10 symbols instead of variations using the notion of positional
notation.

The position of the digits indicates their place values

Digit 3 , 9 4 5 , 8 9 2
Value
Millions

Thousands
Hundred

Thousands
Ten

Thousands

Hundreds

Tens

Ones
Each place value takes a power of ten.

BASE 106 105 104 103 102 101 100


VALUE

Digit 3 , 9 4 5 , 8 9 1
Value 3x106 9x105 4x104 5x103 8x103 9x101 1x100

We simply add the entries to get the value of the number.


Value Expanded
3x106 3,000,000
3x105 900,000
4x104 40,000
5x103 5,000
8x103 800
9x101 90
1x100 1
Sum 3,945,891
53
Binary Code

Modern day-to-day computers use electricity to operate and are switched on or off within a microchip.

The system is called a binary system, represented by multiples of 1 and 0. Binary codes are the blood of our
computers.

Source: PCMag

They tell our computers that you have pressed a key or clicked a button. It can enter a text character on the
screen, or it can allow us to reach another page.

Source: DevianArt
54
In short, as we interact with computers, the binary codes are the commands or instructions that it executes.

Source: The independent

The preference for a binary system can we traced back to the past of the early computers that used a switch to
calculate. In two states, Binary represents: on and off. The on-state, meaning electricity flows, expressed true for
computers. On the other side, the off-state reflects wrong, meaning no electricity flows.
Many early computers were three (ternary) or five-state(quinary) computers. It meant the electrical signal was
flowing through the circuits at varying rates of current.
Nevertheless, when interaction with the circuit occurs, the instability of the currents scales presents a challenge—
these rendered error-prone calculations.
This simpler form a binary system to say apart from the details. It's either on or off, and nothing stands in
between.

Source: Cited by Frontlearners

The basic idea of on-and-off switches, which developed from mechanical relays, thermal valves, and to today's
transistors, shifted from the analog to the digital computing age.

Binary codes are identical to the decimal system, and the binary system uses position notation. Nevertheless, we
use powers of two instead of ten for every position value.

Example: What does the binary number 1001001 represent in the decimal number system?

Solution:
Binary 1 0 0 1 0 0 1
Number
Base of 2 26=64 25=32 24=16 23=8 22=4 21=2 20=1
Value 1x64 0x32 0x16 1x8 0x4 0x2 1x1
64+8+1=73
Therefore, the binary number 1001001 is equivalent to 73 in the decimal system. In equation form,
10010012=7310

Bits and Bytes

A bit is the lowest unit of storage.


1 0 0 1 0 0 1 0
Bit Bit Bit Bit Bit Bit Bit Bit
Byte
It stores either 0 or 1. A group of 8 bits together make one byte.

There are 256 possible combinations of 0s and 1s for a byte means that a byte can represent from 0 to 255 or -
128 to 127.

The first digit referred to as high order bit. The last digit referred to as a low order bit. For the binary number
1000010,
55

For longer strings of bytes, we use the following prefixes:


Units No. of Bytes
Kilobyte (kB) 1 thousand bytes
Megabyte (MB) 1 million bytes
Gigabyte (GB) 1 billion bytes
Terabyte (TB) 1 trillion bytes

Integers in Computers

In the context of computer programming, an integer is a type of data used to present real numbers that have no
fractional values. The integers that can we represented can either be signed (indicates whether positive or negative) or
unsigned (naturally positive) data.
For example, a byte (8bit) can we used to represent 256 integers.
For signed, it can represent from -128 to 127.
For Unsinged, it can represent from 0 to 255.

Boolean Logic

Boolean Logic named after George Boole, who wanted to formalize the logical reasoning method, using symbols
rather than words.

Boolean algebra provides us a basic logic for operation on binary numbers.


True = 1; False = 0

Boolean logic covers three basic terms identified as Boolean operators: “Or,” “And,” and “Not.”

Source: Frontlearners

For the Boolean operator OR, as long as one condition is true, then the statement is true.

Input A Input B Output


True True True
True False True
False True True
False False False
In binary form
Input A Input B Output
1 1 1
1 0 1
0 1 1
0 0 0

For the Boolean operator AND, all conditions have to be true for the statement to be true

Input A Input B Output


True True True
True False False
False True False
False False False
In binary form
Input A Input B Output
1 1 1
1 0 0
0 1 0
0 0 0
56
The value of the input is reversed to the Boolean operator NOT.

Input Output
True False
False True
In binary form
Input Output
1 0
0 1

Computer Addition
The sum of binary numbers is similar to the addition of decimal numbers. We have the following results for the
addition of 1’s and 0’s:
0+0=0
0+1=1
1+1=10

Example: Add the binary numbers: 1001001 and 1010101.

Solution: This table can help us add the following strings of binary numbers. Similar to how we add decimal numbers, we
align the digits based on their respective place value. Our comparison is the same. We have the two entries in this table
stacked on top of each other. We've got a row above the rows of the two entries for the carry over.

Carry Over 1
Entry 1 1 0 0 1 0 0 1
Entry 2 1 0 1 0 1 0 1
Answer 10 0 1 1 1 1 0
Therefore, the sum of the two binary numbers, 1001001 and 1010101, is 10011110

We can check our results by converting the binary numbers to decimal numbers.

Binary Decimal
Entry 1 1001001 73
Entry 2 1010101 85
Answer 10011110 158

Thus, since 10011110 in Binary is equivalent to 158 in decimal, our answer is correct.

ASCII Code

We view text data on monitors or displays for our computers to be usable, given our lack of coding and
programming. On our screens, text that we see is transmitted dynamically by our machines in binary codes. Standards
translate such binary codes into text.

American Standard Code for Information Interchange (ASCII) code is a standard for numerical representation for
characters such as "a" or "@." This 1963 developed 7-bit method was among the first standard used to display the text in
numerical values. It had provided 128 different values as a 7-bit code.
57
Example: How to we spell “Binary” in decimal and binary system using the ASCII code?

Solution:
Characters B i n a r y
Decimal 66 105 110 97 114 121
Binary

To change from decimal to binary, we divide the number in the decimal system by 2 and take note of the
remainder. If none, we note it as “0.” If there is a remainder, we drop this for the next computation and note it as “1.” We
do this repeatedly.

For “B,” we have as ASCII decimal equivalent of 66.


Divide by Result Remainder
66 33 0
33 16 1
16 8 0
8 4 0
4 2 0
2 1 0
1 0 1
The first remainder is the last digit, while the last remainder is the first digit of our binary number. Therefore, to
represent “B” in Binary, we have 1000010.

Now try the other characters.


Characters B i N a r y
Decimal 66 105 110 97 114 121
Binary 100010 1101001 1101110 1100001 1110010 1111001

Unfortunately, the ASCII was designed only for English and could only represent the alphabet with roman characters. Was
replaced by Unicode, which made use of 16 bit represent more characters.

References

Frontlearners (2020, July 22). Retrieved from https://frontlearners.com/blended/

La Putt, Juny (2007). Baguio Research and Publishing Center. Introduction to Computer Concepts.

Reyes; Cordial; Ang; Cruz; Castriciones; Cuy; Ancheta; Corpuz; Vargas (2018). Panday-Lahi Publishing House, Inc.
Mathematics in the modern world.
58
Assessing Learning (Unit 5-A)

Name: _______________________________________________________Score: ______________________________

Course/Year/Section: ___________________________________________ Date: _______________________________

Add the following binary numbers:


1.) 10101001+10110110
2.) 11011011+11001100
3.) 10001011+10010010
4.) 10100100+10000001
5.) 11111111+11111111
59
Assessing Learning (Unit 5-B)

Name: _______________________________________________________Score: ______________________________

Course/Year/Section: ___________________________________________ Date: _______________________________

Group yourselves into four and decode the message using ASCII code:

1000101 1110010 1010010 1101111 1010010


1000100 1100101 1110100 1000101 1100011
1010100 1101001 1101110 1000111 1000011
1001111 1100100 1000101 1010011 0000100

You might also like