Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 61

Number Systems

Deepanjal Shrestha
Lecturer
Pokhara University, School of
Business
The Number System
Basically 2 Types
• Decimal Number System denary (base 10)
number system which counts in multiples
of 10
The Number System
• The binary system based on the number 2
• Thus, only the two ‘values’ 0 and 1 can be
used in this system to represent each digit
Representation of Data in Computer Systems
Converting Binary Numbers
In your exam you will be expected to be able to convert a
denary number (the numbers humans work with (base 10)
into binary…

…and back again.


Representation of Data in Computer Systems
Converting from Binary to Denary (easy)
If you are given a binary number which is to be converted into denary do the
following:

1. Above each bit, write the value of that bit.

128 64 32 16 8 4 2 1

1 0 0 0 0 1 0 1
2. Then simply add the values where there is a 1 underneath, together.
Representation of Data in Computer Systems
Converting from Binary to Denary (easy)

128 64 32 16 8 4 2 1

1 0 1 1 0 0 1 1
1 0 0 0 1 1 1 1
0 0 1 1 1 1 0 0
1 0 1 1 1 1 0 0
Representation of Data in Computer Systems
Method 1: Converting from Denary to Binary

Converting from denary to binary is also quite straight forward.

If we wanted to convert 202 into binary we would do the following:

Does 128 fit into 202?


YES! So we add a 1 into the column and
subtract 128 from 202 (leaving 74)
128 64 32 16 8 4 2 1

1
Representation of Data in Computer Systems
Converting from Denary to Binary

Converting from denary to binary is also quite straight forward.

If we wanted to convert 202 into binary we would do the following:

Does 64 fit into 74?


YES! So we add a 1 into the column and
subtract 64 from 74 (leaving 10)
128 64 32 16 8 4 2 1

1 1
Representation of Data in Computer Systems
Converting from Denary to Binary

Converting from denary to binary is also quite straight forward.

If we wanted to convert 202 into binary we would do the following:

Does 32 fit into 10?


NO! So we add a 0 into the column
and move on…
128 64 32 16 8 4 2 1

1 1 0
Representation of Data in Computer Systems
Converting from Denary to Binary

Converting from denary to binary is also quite straight forward.

If we wanted to convert 202 into binary we would do the following:

Does 16 fit into 10?


NO! So we add a 0 into the column
and move on…
128 64 32 16 8 4 2 1

1 1 0 0
Representation of Data in Computer Systems
Converting from Denary to Binary

Converting from denary to binary is also quite straight forward.

If we wanted to convert 202 into binary we would do the following:

Does 8 fit into 10?


YES! So we add a 1 into the column and
subtract 8 from 10 (leaving 2)
128 64 32 16 8 4 2 1

1 1 0 0 1
Representation of Data in Computer Systems
Converting from Denary to Binary

Converting from denary to binary is also quite straight forward.

If we wanted to convert 202 into binary we would do the following:

Does 4 fit into 2?


NO! So we add a 0 into the column and
move on…
128 64 32 16 8 4 2 1

1 1 0 0 1 0
Representation of Data in Computer Systems
Converting from Denary to Binary

Converting from denary to binary is also quite straight forward.

If we wanted to convert 202 into binary we would do the following:

Does 2 fit into 2?


YES! So we add a 1 into the column and
subtract 2 from 2 (leaving 0)
128 64 32 16 8 4 2 1

1 1 0 0 1 0 1
Representation of Data in Computer Systems
Converting from Denary to Binary

Converting from denary to binary is also quite straight forward.

If we wanted to convert 202 into binary we would do the following:

Does 1 fit into 0?


NO! So we add a 0 into the column and
that is it!
128 64 32 16 8 4 2 1

1 1 0 0 1 0 1 0
Representation of Data in Computer Systems
Converting from Denary to Binary

So 202 in binary is:

Check that it works:


Activity 1.1
• Convert 234 into binary:

128 64 32 16 8 4 2 1
Mini Whiteboard Practice
• Convert 42 into binary:

128 64 32 16 8 4 2 1
Mini Whiteboard Practice
• Convert 175 into binary:

128 64 32 16 8 4 2 1
Converting from Denary to
Binary
Method 2:

This method involves successive division by 2.


The remainders are then read from BOTTOM to
TOP to give the binary value.
Converting from Denary to
Binary
Activity 1.2
• Convert the following denary numbers into
binary (using both methods):
1. 67
2. 86
3. 200
4. 255
Measurement of the size of
computer memories
• A binary digit is commonly referred to as a
BIT
• 8 bits are usually referred to as a BYTE.
• The byte is the smallest unit of memory in
a computer
• Larger bytes are always multiples of 8
(e.g. 16-bit systems and 32-bit systems).
Measurement of the size of
computer memories
Two ways of measuring memories
• Manufacturers of storage devices often
use the denary system to measure storage
size. For example,
• 1 kilobyte = 1000 byte
• 1 megabyte = 1000000 bytes
• 1 gigabyte = 1000000000 bytes
• 1 terabyte = 1000000000000 bytes and so
on.
Two ways of measuring memories
The International Electro-technical
Commission (IEC) convention for computer
internal memories (including RAM)
becomes:
• 1 kibibyte (1 KiB) = 1024 bytes
• 1 mebibyte (1 MiB) = 1048576 bytes
• 1 gibibyte (1 GiB) = 1073741824 bytes
• 1 tebibyte (1 TiB) = 1099511627776 bytes
and so on.
Example use of binary
• Introducing the idea of computer
REGISTERS
• A register is a group of bits; it is often
depicted as follows:
Further
• When computers (or microprocessors) are
used to control devices (such as robots),
registers are used as part of the control
system.
• The following example describes how
registers can be used in controlling a
simple device.
An Example
• A robot vacuum cleaner has three wheels,
A, B and C.
Further
• A rotates on a spindle to allow for direction
changes (as well as forward and backward
movement);
• B and C are fixed to revolve around their
axles to provide only forward and
backward movement, and have an electric
motor attached
Representation of States

If the register contains 1 0 1 0 1 0 1 0 this means ‘motor B


is ON and motor C is ON and both motors are turning to
produce FORWARDS motion’. Effectively, the vacuum
cleaner is moving forwards
Activity 1.3
• What would be the effect if the register
contained the following values?
1. 1 0 0 1 1 0 0 0
2. 1 0 1 0 0 1 0 1
3. 1 0 1 0 0 1 1 0
4. What would be the effect if the register
contained the following?
11111111
Activity 1.3
1. What would the register contain if motor
B and motor C were both ON but B was
turning in a backward direction and C
was turning in a forward direction?
2. What would the register contain if only
motor C was ON and the motors were
turning in a BACKWARDS direction?
The hexadecimal system
• Hexadecimal referred ‘hex’ is a base 16
system
• It uses 16 different ‘values’ to represent
each digit.
• 0 to 9 and the letters A to F are used to
represent each hexadecimal (hex) digit.
• (A = 10, B = 11, C = 12, D = 13, E = 14
and F = 15.)
The hexadecimal system
• Since 16 = 24 this means that FOUR
binary digits are equivalent to each
hexadecimal
The hexadecimal system
Converting Binary hexadecimal
• Starting from the right and moving left,
split the binary number into groups of 4
bits.
• Example 1
101111100001
First split this up into groups of 4 bits:
1011 1110 0001
Using Table we see that answer is
B E 1
Activity 1.4
• Convert the following binary numbers into
hexadecimal
•1001111111
•10011101110
•000111100001
•100010011110
•1111111101111101
•00110011110101110
Converting from hexadecimal to
binary
• Example 3
• 45A
• Using Table, find the 4-bit code for each
digit:
• 0100 0101 1010
• Put the groups together to form the binary
number:
• 010001011010
Example 4

• BF08
• Again just use Table
• 1011 1111 0000 1000
• Then put all the digits together:
• 1011111100001000
Activity 1.5
• Convert the following hexadecimal
numbers into binary:
• 59
• AA
• A00
• 40E
• BA6
• DA47
Hexadecimal to Denary
• Convert
–45A
• First multiply each digit by its value:

• Add the totals together:


• denary number = 1 1 1 4
Example 2
• Convert C 8 F
• First multiply each digit by its value:

• Add the totals together:


• denary number = 3 2 1 5
Activity 1.6
• Convert the following hexadecimal
numbers into denary:
• 6B
• 9C
• CA8
• 12AE
• AD89
Converting Denary to Hexadecimal
• This method involves successive division
by 16.
• The remainders are then read from
– BOTTOM to TOP to give the hexadecimal
value.
– See example
Method 2
Activity 1.7
• Convert the following denary numbers into
hexadecimal
• 98
• 227
• 490
• 511
Binary with Decimal Values
Binary with Decimal Values
Binary with Decimal Values
Activity
• 11.11
• 1010.1101
• 111.011
Use of the hexadecimal system
• Memory dumps
• When the memory contents are output to a
printer or monitor, this is known as a
MEMORY DUMP
• Hyper Text Mark-up Language (HTML)
• is used when writing and developing web
pages.
Activity 1.5
• Convert the following hexadecimal
numbers into binary:
• 59
• AA
• A00
• 40E
• BA6
• DA47
Use of Hexadecimal
• HTML code is often used to represent colours of
text on the computer screen.
• The values change to represent different
colours.
• The different intensity of the three primary
colours (red, green and blue) is determined by
its hexadecimal value.
• For example: • # FF 00 00 represents primary
colour red
• # 00 FF 00 represents primary colour green
• • # 00 00 FF represents primary colour blue
HTML
• A mark-up language is used in the
processing, definition and presentation of
text (for example, specifying the colour of
the text)
Memory Dumps example
Media Access Control (MAC)
• It is a number which uniquely identifies a
device.
• It refers to a Network Interface Card which
is a part of a device
• MAC is rarely changed
• NN:NN:NN:DD:DD:DD
• NN stands for identity number of the
manufacturer
• DD is the serial number of the device
Media Access Control (MAC)
• Types of MAC address
• Universally Administered MAC address
(UAA)
• Locally Administered MAN Address (LAA)

Web Addresses
• Every character on a computer has a
ASCII value.
• Web addresses are represented as hex
values
ASCII values
Representing a web address
Assembly and Machine Code
• Computer memory can be referred to
directly using machine code or assembly
code.
• JNZ FFA4 (assembly code)
• A5E4 FFA4 (machine code using
hexadecimal values)
• 1010 0101 1110 0100 1111 1111 1010
0100 (machine code using binary)
• Machine
Any Questions

You might also like