binary introduction

Download Report

Transcript binary introduction

A-Level Computing
Data representation
Objectives
• Know how data can be represented in a
computer system
• Understand the need for various forms of
representation
• Be able to explain and convert from one form
to another
Data Representation
• Data on a computer system is stored in
electrical signals
• These represent binary data
• Can be one of two states
• Here they are represented as a 0 or 1
• Cannot be anything else
Data Representation
• A 0 or 1 is known as a BIT
• BITS are grouped into…….BYTES (8 BITS)
• A group of BYTES is a WORD
• The size of a word depends on the computer, a
64 bit machine has a word size of 8 bits.
Data Representation
• 4567
• Denary Notation – grouped into values of 10s
1000
4
100
5
10
6
1
7
Data Representation
• Binary representation is in the form of 2’s as
opposed to denary (base – 2)
128 64
1
0
32
0
16
0
8
0
4
0
2
1
1
1
Data Representation
• Binary addition similar to denary addition, when
a result is greater than 9 we ‘pass one over’
• 0+0=0
• 0+1=1
• 1 + 1 = 10 (carry 1 over)
• 1 + 1 + 1 = 11 (carry 1 over)
Data Representation
• Binary multiplication works in the same way as
denary (7 x 10 = 70)
• Move decimal point along by number of 0s
• 0X0=0
• 0X1=0
• 1X1=1
• 1 X 10 = 10
Data Representation
• Negative numbers are represented using two’s
compliment form
• Significant bit is Negative
-128 64
1
0
32
0
16
0
8
0
4
0
2
1
1
1
Data Representation
• Converting negative denary to binary
• Basic rule is to (invert the digits and add 1)
•3
• 00000011
• Convert = 11111100
• Add 1 = 11111101
Hexadecimal
• Binary can be complex for humans to
understand
• Hexadecimal is a ‘halfway house’
• Used as a shorthand form of binary
• In base 16
Data Representation
Denary
Hexadecimal
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
A
11
B
12
C
13
D
14
E
15
F
16
G
Data Representation
• Grouped into 4 bits
• Each group represents one number
• E.g. 11010011 = 211
• 1101 = 13 = D
• 0011 = 3 = 3
• = D3