Unit 1 Number System-1

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

Computer Applications in Pharmacy

UNIT – 1
Number System

Subject : Programming and


Solving
Unit1Contents
2

 Basic Concepts of computers: Architecture of


Types of Processor, Primary Storage, Secondary Storage,
computer,
Number Systems, Data Representation-Signed, Unsigned,
one’s complement, two’s complement, Floating point, char,
String. to system software: Operating system,
Introduction Compiler, Assembler, Loader.
Editor, Linker,
Introduction to Computer
3

 Computer:
 The word computer comes from the word “compute”, which means,
“to calculate”
 Computer is an electronic device that can perform arithmetic and
logical operations at high speed
 A computer is also called a data processor because it can store,
process, and retrieve data whenever desired
 Data is raw material used as input and information is processed
data obtained as output of data processing
Architecture of Computer
4
system
Generation of Computers
5

 “Generation” in computer talks about the step wise


advancement in the technology

 It provides a framework for the growth of computer


industry

 Originally it was used to distinguish between various


hardware technologies, but now it has been extended to
include both hardware and software

 Till today, there are five computer generations


Generations of Computers
6
Some First Generation
7
Computers
ENIAC: Electronic Numerical EDVAC: Electronic Discrete
Integrator and Calculator Variable Automatic Computer

EDSAC: Electronic Delay Storage UNIVAC: Universal Automatic


Automatic Calculator Computer
Generations of Computers
8

Note:
 SSI: Small Scale Integration
 MSI: Medium Scale Integration
 PDP: Programmable Data Processors
 CDC: Control Data Corporation
Generations of Computers
9

Note:
 VLSI: Very Large Scale Integration  VAX: Virtual Address Extension
Generations of Computers
10

Note:
 ULSI: Ultra Large Scale Integration  MPI: Message Passing
 RAID: Redundant Array of Independent Interface
Disks  SGI: Silicon Graphics Inc.
Generation of Computers
11

 Electronic Devices Used in Computers of


Different Generations
Generations of Computers
12

 How the hardware and Software has evolved over


a
period of time

1989 till now

1975 to 1989
1964 to 1975
1955 to 1964
1942 to 1955
Classification of Computer
13

 Computers can be classified as follows:


Classification of Computer
14

1. According to Type
i. Digital Computer
A computer that performs calculations and
logical operations with quantities represented
as digits, usually in the binary number system

ii. Analog Computer


An analog computer is a form of computer
that uses continuous physical phenomena
such as electrical, mechanical, or hydraulic
quantities to model the problem being solved

iii. Hybrid Computer


Exhibit of analog
features and digital
Classification of Computer
15

2. According to Size (capabilities)


i. Mini computer
A midsized computer. In size and
minicomputers lie power,
between mainframes. workstations
and
ii. Micro computer
 Desktop Computer: A personal or micro-mini
computer sufficient to fit on a desk
 Laptop Computer: A portable computer complete
with an integrated screen and keyboard. It is
generally smaller in size than a desktop computer
and larger than a notebook computer
 Palmtop Computer/Digital Diary /Notebook
/PDAs: A hand-sized computer. Palmtops have no
keyboard but the screen serves both as an input
and output device

iii. Mainframes
A very large and expensive computers capable of
supporting hundreds, or even thousands, of users
simultaneously
Classification of Computer
16

2. According to Size (capabilities)

iv. Super Computer


 The fastest and most powerful type of computer
 Supercomputers are very expensive and are
employed for specialized applications that require
immense amounts of mathematical calculations
 For example, weather forecasting requires
a supercomputer

v. Workstations
 A terminal or desktop computer in a network
 In this context, workstation is just a generic term for a
user's machine (client machine) in contrast to a
"server" or "mainframe"
Classification of Computer
17

3. According to Purpose
i. General Purpose
General purpose computers are
designed to perform a of
range tasks
e.g. Personal Computer

ii. Special Purpose


Specific purpose computers
designed to handle are a specific
problem or to perform a specific
task
e.g. Computers that control aircraft
and satellites
Types of Processor
18

 A processor, or "microprocessor," is a small chip that resides


in computers and other electronic devices
 A processor performs arithmetical, logical, input/output (I/O) and
other basic instructions that are passed from an operating system
(OS)
 Types of processor depends on the architecture of processor
Types of Processor
19
Types of Processor
20
Computer Storage
21

 A storage device is any computing hardware that is used for storing and
extracting data
 It can hold and store information both temporarily and permanently, and
can be internal or external to a computer, server or any similar computing
device
 There are two main types of storage devices: Primary and Secondary

Types of Computer Storage


Computer Storage
22

Primary Storage and Secondary Storage


Primary Storage
23

 Primary storage (also known as main storage or memory) is the


area in a computer in which data is stored for quick access by the
computer's processor. It consists of Registers, Cache and Main
Memory
Primary Storage
24

 Main Memory consists of Random Access Memory (RAM) and


Read Only Memory (ROM)
Random Access Memory
25
(RAM)
 It is a read/write (R/W) memory which is volatile
 This means when power is turned off, all the
contents are destroyed
 It can be accessed that is,
randomly: memory can any byte of
be accessed preceding bytes without touching
 RAM is the most common type of thememory found
in computers and other devices such as printers
 There are two basic types of RAM:
 Dynamic RAM (DRAM)
 Static RAM(SRAM)
Types of RAM
26

 DRAM:
 DRAM needs to be refreshed thousands of times per second
 DRAM stores a bit of data using a transistor and capacitor pair,
which together comprise a memory cell
 The capacitor holds a high or low charge (1 or 0, respectively), and
the transistor acts as a switch that lets the control circuitry on the
chip read the capacitor's state of charge or change it
 As this form of memory is less expensive to produce than SRAM,
it is the predominant form of computer memory used in modern
computers.

 SRAM:
 SRAM does not need to be refreshed, which makes it faster, but it is
more expensive than DRAM
 In SRAM, a bit of data is stored using the state of a flip-flop
 This form of RAM is more expensive to produce, but is generally
faster and requires less power than DRAM and, in modern
computers, is often used as cache memory for the CPU
Read Only Memory (ROM)
27

 ROM is non-volatile which means it retains


the stored information even if power is turned
off
 It is used to store programs that

boot the computer


 and perform diagnostics
 Different types of ROM as follows:

  Programmable ROM (PROM)


  Erasable Programmable ROM (EPROM)
  Electrically Erasable Programmable ROM (EEPROM)
Types of ROM
28

 PROM (Programmable ROM):

 A PROM is a memory chip on which data can be written onto only once. Once
a program is written onto a PROM chip, it remains there forever
 Unlike RAM, PROM retains its contents when the computer is turned off
 The difference between a PROM and a ROM is that a PROM is manufactured as
blank memory and programmed later with a special device called PROM
programmer or the PROM burner, whereas the ROM is programmed during
manufacturing process.
 The process of programming a PROM is sometimes called burning a PROM

 EPROM (Erasable Programmable ROM) :

 An EPROM is a special type of PROM that can be erased by exposing it to


ultraviolet light
 Once erased, it can be reprogrammed. An EPROM is similar to a PROM except
that it requires ultraviolet radiation to be erased
Types of ROM
29

 EEPROM (Electrically Erasable Programmable ROM):

 EEPROM is a special type of PROM that can be erased by exposing it


to an electrical charge
 Like other types of PROM, EEPROM retains its contents even when the
power is turned off
 Also, like other types of ROM, EEPROM is not as fast as RAM
 EEPROM is similar to Flash Memory (sometimes called flash
EEPROM)
 The principal difference is that EEPROM requires data to be written or
erased one byte at a time whereas flash memory allows data to be
written or erased in blocks
Secondary Storage
30

 Secondary Storage is referredto


external alternatively memory, as memory
auxiliary storage secondary
 Secondary storage device is a non-volatile or device that
holds data until it is deleted or overwritten
 Primary storage  Secondary storage
 Volatile  Nonvolatile
 Temporary
 Permanent
 It loses all of its contents  Writing : is the process
when power to the system
of saving information
unit is shut off
 Reading: is the
process of accessing
information
Secondary Storage
31

 Secondary Storage devices are classified as follows:


Secondary Storage
32

 Sequential-access Storage Devices


 Arrival at the desired storage location may be preceded by sequencing through
other locations
 Data can only be retrieved in the same sequence in which it is stored
 Magnetic tape is a typical example of such a storage device
Secondary Storage
33

 Direct-access Storage Devices


 Devices where any storage location may be selected and accessed at
random
 Permits access to individual information in a more direct or immediate
manner
Memory Storage Devices
 Magnetic and optical disks are typical examples of such a storage
: USB
device
(Universal Serial Bus)

Magnetic Disks
Number System
34

 A number system is a collection of


various symbols which are called digits

 Two types of number systems are:


 Non-positional Number Systems
 Positional Number Systems
Non-positional Number System
35

 Characteristics
 Use symbols such as I for 1, II for 2, III for 3 etc
 Each symbol represents the same value regardless of its position
in the number
 The symbols are simply added to find out the value
of a
particular number

 Difficulty
 It is difficult to perform arithmetic with such a number system
Positional Number System
36

 Characteristics
 Use only a few symbols called digits
 These symbols represent different values
depending on the position they occupy in the number
 The value of each digit is determined by:
1. The digit itself
2. The position of the digit in the number
3. The base of the number system (Base = total number of digits in
the number system)
 The maximum value of a single digit is always equal to one
less than the value of the base
Positional Number System
37

 There are four Positional Number Systems: Binary ( )2, Decimal ( )10,
Octal ( )8 and Hexadecimal ( )16

Decimal 8 4 2 1
00 0 0 0 0
01 0 0 0 1
02 0 0 1 0
03 0 0 1 1
04 0 1 0 0
05 0 1 0 1
06 0 1 1 0
07 0 1 1 1
08 1 0 0 0
09 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
Binary Number System
38

 Characteristics:

 Has only 2 symbols or digits (0 and 1). Hence its base = 2

 The maximum value of a single digit is 1 (one less than the value of
the base)

 Each position of a digit represents a specific power of the base


(2)

 This number system is used in computers


Decimal Number System
39

 Characteristics:

 Has 10 symbols or digits (0, 1, 2, 3, 4, 5, 6, 7,8, 9). Hence, its base


= 10

 The maximum value of a single digit is 9 (one less than the value of the
base)

 Each position of a digit represents a specific power of the base (10)

 We use this number system in our day-to-day life


Octal Number System
40

 Characteristics:

 Has total 8 symbols or digits (0, 1, 2, 3, 4, 5, 6, 7). Hence, its base


=8

 The maximum value of a single digit is 7 (one less than the value of the
base)

 Each position of a digit represents a specific power of the base (8)

 Since there are only 8 digits, 3 bits (23 = 8) are sufficient to represent
any octal number in binary
Hexadecimal Number System
41
 Characteristics:
 Has total 16 symbols or digits (0, 1, 2, 3, 4, 5, 6, 7,8, 9, A, B, C, D, E,
F). Hence its base = 16

 The symbols A, B, C, D, E and F represent the decimal values 10, 11, 12,
13, 14 and 15 respectively

 The maximum value of a single digit is 15 (one less than the value of the
base)

 Each position of a digit represents a specific power of the base (16)

 Since there are only 16 digits, 4 bits (24 = 16) are sufficient to
represent
any hexadecimal number in binary
Number System conversion Basic
Rules
42

 Decimal number system to any number System(Octal,


Binary, Hexadecimal) use division method
 Any number system System(Octal, Binary,
Hexadecimal) to Decimal number system use
multiplication method.
 Any to any number system, use bit system or
convert it to Decimal and then in another number
Conversions
43

 Decimal to Binary
 Here is an example of using repeated division to convert
1792 decimal to binary:

 Reverse the remainders, we get 11100000000


 (1792)10 = (11100000000)2
Conversions
44

 Decimal to Octal
 Here is an example of using repeated division to convert
1792 decimal to octal:

 Reverse the remainders, we get 3400


 (1792)10 = (3400)8
Conversions
45

 Decimal to Hexadecimal
 Here is an example of using repeated division to convert
1792 decimal to hexadecimal:

 Reverse the remainders, we get 700


 (1792)10 = (700)16
Conversions
46

 The only addition to the algorithm when converting from decimal to


hexadecimal is that a table must be used to obtain the hexadecimal
digit if the remainder is greater than decimal 9.

 For example, 590 decimal converted to hex


is:Decimal Number Operation Quotient Remainder
Hexadecimal
590 ÷ 16 = 36 14 E
Result
36 ÷ 16 = 2 4 4
2 ÷ 16 = 0 2 2
0 done.

 Reverse the remainders, we get 24E


 (590)10 = (24E)16
Conversion from other to decimal
47
number system
Conversion from Binary to octal
48

 Step 1 − Divide the binary digits into groups of three


(starting from the right).
 Step 2 − Convert each group of three binary digits to
one octal digit.
 Example
Binary Number − 101012
Calculating Octal Equivalent −
Step Binary Number Octal Number
1. 101012 010 101
2. 101012 28 58
3. 101012 258
Binary Number − 101012 = Octal Number − 258
Use table to convert Binary to
49
Octal and Octal to Binary
Octal is having the base of ( )8
Hence, Think what should be the power of 2 to get 8 so we need
to
do 23= 8 i. e. 2X2X2 = 8 will create 3 columns and 8
rows Now create a reference table by using:
8/2=4
4/2=2
2/2=1
4 2 1
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
Conversion from Octal to Binary
50

 Step 1 − Convert each octal digit to a 3 digit binary


number (the octal digits may be treated as decimal for
this conversion).
 Step 2 − Combine all the resulting binary groups (of 3
digits each) into a single binary number.
 Example
Binary Number − 101012
Calculating Octal Equivalent −
Step Octal Number Binary Number
1. 258
210 510
2. 258
0102 1012
3. 258
0101012
Octal Number − 258 = Binary Number − 101012
Conversion from binary to
Hexadecimal
51

 Step 1 − Divide the binary digits into groups of four


(starting from the right).
 Step 2 − Convert each group of four binary digits to one
hexadecimal symbol.
 Example
Binary Number − 101012
Calculating Octal Equivalent −
Step Binary Number Hexadecimal Number
1. 101012 0001 0101
2. 101012
116 516
3. 101012 1516
Binary Number − 101012 = Hexadecimal Number − 1516
Conversion from Hexadecimal to
52
binary
 Step 1 − Convert each hexadecimal digit to a 4 digit
binary number (the hexadecimal digits may be treated
as decimal for this conversion).
 Step 2 − Combine all the resulting binary groups (of 4
digits each) into a single binary number.
 Example
Binary Number − 101012
Calculating Octal Equivalent −
Step Hexadecimal Number Binary Number
1. 1516
110 510
2. 1516
00012 01012
3. 1516
00010101
Hexadecimal Number − 1516 = Binary Number − 1010122
Use table to convert Binary to Hexadecimal
and Hexadecimal to Binary
53

8 4 2 1
Hexadecimal is having the base of
0 0 0 0 0
( )16 Hence, think what should be the
1 0 0 0 1
power of 2 to get 16, so we need to do 2 0 0 1 0
24= 16 i. e. 2X2X2X2 = 16 3 0 0 1 1
Now create a reference table by 4 0 1 0 0
using: 4 columns & 16 rows: 5 0 1 0 1
6 0 1 1 0
16/2=8 7 0 1 1 1
8/2=4 8 1 0 0 0
4/2=2 9 1 0 0 1
2/2=1 A 1 0 1 0
B 1 0 1 1
C 1 1 0 0
D 1 1 0 1
E 1 1 1 0
F 1 1 1 1
Octal to Hexadecimal
54

 When converting from octal to hexadecimal, it is often easier to


first convert the octal number into binary and then from binary into
hexadecimal.
 For example, to convert 345 octal into hex:(from the
previous example)
 Octal =345
Binary =011 100 101

Drop any leading zeros or pad with leading zeros to get groups
of four binary digits (bits):
Binary 011100101 = 1110 0101

Then, look up the groups in a table to convert to hexadecimal digits.


 Binary =1110 0101 Hexadecimal =E5= E5 hex
55

Decimal 8 4 2 1
00 0 0 0 0
01 0 0 0 1
02 0 0 1 0
03 0 0 1 1
04 0 1 0 0
05 0 1 0 1
06 0 1 1 0
07 0 1 1 1
08 1 0 0 0
09 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
Hexadecimal to Octal
56

 When converting from hexadecimal to octal, it is often easier to


first convert the hexadecimal number into binary and then from
binary into octal.
 For example, to convert A2DE hex into octal:
 Hexadecimal =A 2 D E
 Binary =1010 0010 1101 1110 = 1 010 001 011 011 110
 Add leading zeros or remove leading zeros to group into
sets of three binary digits.

Binary: 1010001011011110 = 001 010 001 011 011 110
 Then, look up each group in a table:
Binar 000 001 010 011 100 101 110 111
y
Octal 0 1 2 3 4 5 6 7

Binary =001010001011011110 Octal =121336


Practice examples
 1)Convert binary to Hexadecimal
(01010001)2 =( )16
(001010111010)2 =( )16
2) Convert decimal to hexadecimal
(526)10 = ( )16
Data Representation:
Signed and Unsigned
59

 Integers, for example, can be


represented in 8-bit, 16- bit, 32-bit or
64-bit

 Besides bit-lengths, there are two


representation schemes for integers:
1. Unsigned Integers: can represent zero
and positive integers
2. SignedIntegers: can represent
zero, positive and negative
integers
Complement of a number
65

 Complements are used in the digital computers in order


to simplify the subtraction operation and for the logical
manipulations
 Binary system complements
 As the binary system has base r = 2. So the two types of
complements for the binary system are 2's complement and 1's
complement

 1's complement
 The 1's complement of a number is found by changing all 1's to
0's and all 0's to 1’s.
 Example of 1's Complement :
Complement of a number
66

 2's complement
 The 2's complement of binary number is obtained by adding 1 to
the Least Significant Bit (LSB) of 1's complement of the number.
 2's complement = 1's complement + 1

 Example of 2's Complement is as follows:

2’s complement

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy