MMW MSD Module 5 Codes
MMW MSD Module 5 Codes
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:
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.
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.
Digit 3 , 9 4 5 , 8 9 1
Value 3x106 9x105 4x104 5x103 8x103 9x101 1x100
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.
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.
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
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
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 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.
For the Boolean operator AND, all conditions have to be true for the statement to be true
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
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.
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
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)
Group yourselves into four and decode the message using ASCII code: