0% found this document useful (0 votes)
261 views32 pages

1.1.1 Information Representation: Unit 1: Theory Fundamentals

Unit 1 discusses information representation in computing systems. It covers number systems like binary, decimal, hexadecimal and how to convert between them. Binary addition and subtraction rules are explained along with representing positive and negative numbers using methods like sign-and-magnitude and two's complement. Character representation depends on the character set used, like ASCII or Unicode. Binary Coded Decimal is described for storing numbers. Practical applications of these concepts are also discussed.

Uploaded by

Ronald Porter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
261 views32 pages

1.1.1 Information Representation: Unit 1: Theory Fundamentals

Unit 1 discusses information representation in computing systems. It covers number systems like binary, decimal, hexadecimal and how to convert between them. Binary addition and subtraction rules are explained along with representing positive and negative numbers using methods like sign-and-magnitude and two's complement. Character representation depends on the character set used, like ASCII or Unicode. Binary Coded Decimal is described for storing numbers. Practical applications of these concepts are also discussed.

Uploaded by

Ronald Porter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

1

Unit 1: Theory fundamentals


1.1.1 Information representation
• Show understanding of the basis of different number systems
and use the binary, denary and hexadecimal number system
• Convert a number from one number system to another
• Express a positive or negative integer in two’s complement form
• Show understanding of, and be able to represent, character data
in its internal binary form depending on the character set used
(Candidates will not be expected to memorise any particular
character codes but must be familiar with ASCII and Unicode.)
• Express a denary number in Binary Coded Decimal (BCD) and
vice versa
• Describe practical applications where BCD is used

Write in books
1.1.1 Binary systems
• The Binary number system:
 Many electronic components are bistable – they
can be in either 2 states (such as on/off).
 These two possible states are denoted by 0 and 1.
 This is also the symbols used for the binary
number system. Binary digits are called bits for
short.
 This allows us to perform calculations using binary
arithmetic or base 2.

Write in books
3

1.1.1 Binary systems


Binary number system – see handout after hexadecimal slide 7

Place values in the binary


system go up in powers of two!

Units
U, 2, 4, 8, 16, 32, 64, 128
Don’t write in books
4

1.1.1 Hexadecimal
Notice that hexadecimal numbers
are represented by four binary
numbers or four bits! (Nibble)
Note that: 8 bits usually = one byte
The hexadecimal system is useful
because it can represent
every byte (8 bits) as two
consecutive hexadecimal digits.

It is easier for humans to read hexadecimal numbers


than binary numbers
Write in books
5

1.1.1 Binary to decimal to hexadecimal calculations


• Answer the questions below: Find the base 2, base 10 and base 16
Find the base 2 and base 10 equivalent equivalents.

A 0011 01102 A 1111 00112

B 0001 1100 01112 B 9910

C 0001 0101 01012 C 30010

D 5910 D 1010 1010 10102

E 28510 E DAD16

F 91110 F CAB16

Write in books
6

1.1.1 Binary to decimal to hexadecimal calculations – worksheet answers


answers Binary differences answers

A 0011 0110 = 54 A 24310 F316 = 1111 00112

B 0001 1100 0111 = 455 B 0110 00112 6316 = 9910

C Answers to Cquestions
0001 0101 0101 = 341 0001 0010 1100 12C = 300
2 16 10

D 59Remove
= 0011 1011 box
D to
2730seeAAA = 1010 1010 1010
10 16 2

E 285 = 0001 0001 1101 E 1101 1010 11012 350110 = DAD16

F 911 = 0011 1000 1111 F 1100 1010 10112 324310 = CAB16

Write in books
7

1.1.1 Binary: Data Codes


• The method of data representation in a computer system
depends upon the type of data which is being used. The types
of data which we will consider are
 Numbers, text and graphics.
• Regardless of the type of data, all data is ultimately stored as
binary numbers.
• You should know by now that a computer system is known as
a two-state machine. These two states are on and off and are
represented using 1 for on and 0 for off.
• The most widely used methods for numbers are sign-and-
magnitude, 2’s compliment and 1’s compliment for whole
numbers. Fixed point and floating point are used for
fractional results (storing real numbers).

Write in books
8

1.1.1 Binary: positive and negative numbers


• As discussed previously numbers are classified as real
numbers or integers. These numbers can either be positive or
negative numbers.
• Representing negative numbers in a computer system makes
it necessary to store the sign of the number i.e. whether the
number is positive (+) or negative (-)
• Generally in computing the three most common ways to code
negative whole numbers are sign-and-magnitude, two’s
compliment and ones compliment.
• However CIE state: Stress how to represent both positive and
negative numbers because many learners often only consider
the use of negative numbers. Regarding the above methods.

Write in books
9

1.1.1 Binary: Sign-and-magnitude


• The digit with the highest place value is called the most
significant digit, and the one with the lowest place value the
least significant digit.
• In this code, one bit
represents the sign of
the number, and the
other bit represents the size (or the magnitude) of the number.
• The convention for the sign bit is that ‘1’ represents negative
and ‘0’ positive.
• The sign bit may be at either end of the binary number.

Notice the difference between


the second and forth examples

Write in books
10

1.1.1 Binary: Addition and Subtraction


• Before we look at 2’s compliment and 1’s compliment it would
be sensible to learn how to add and subtract binary numbers.
Although not directly on the syllabus it will help the
understanding both of the above mentioned methods.
• As with many types of mathematical problems we need to
understand and remember the rules to help us solve specific
problems.

Rules for adding Rules for subtracting

0+0=0 0-0=0
0+1=1 1-0=1
1+0=1 1-1=0
1 + 1 = 0, with a carry of 1 0 - 1 = 1 with a borrow of 1 from
the next column
1 + 1 + 1 = 1 with a carry of 1

Write in books
11

1.1.1 Binary: Adding


Rules for adding
0+0=0
0+1=1
1+0=1
1 + 1 = 0, with a carry of 1
1 + 1 + 1 = 1 with a carry of 1

Write in books
12

1.1.1 Binary: Adding

Write in books
13

1.1.1 Binary:
Subtracting
Rules for subtracting
0-0=0
1-0=1
1-1=0 See videos
0 - 1 = 1 with a borrow of 1 from
the next column
Because it is base 2
you borrow 2 every
time but it’s easier to
display it as two 1s
14

1.1.1 Binary: Addition and Subtraction – worksheet


• Answer the questions below:
Find the binary sums. Find the binary differences.

A 1101 + 111 A 111 – 101

B 110011 + 11101 B 110 – 11

C 11100111 + 11000011 C 1100 – 101

D 110.1101 + 1011.101 D 1100011 - 110111

E 11001 + 11100 + 1011 + 110011 E 10101010 - 110011

F 11.101 + 110.01 + 111.101 + 1101.1 F 110.001 - 11.111

Write in books
15

1.1.1 Binary: Addition and Subtraction – worksheet answers


Binary sums answers Binary differences answers

A 10100 A 10

B 1010000 B 11

C
Answers
110101010
to questions
C 0111

D
Remove
10010.0111
box
D
to see 0101100

E 1110011 E 1110111

F 11111.000 F 10.010

More questions at:


• http://www.cimt.plymouth.ac.uk/projects/mepres/book9/bk9i1/bk9_1i2.html
Binary Calculator:
• http://www.calculator.net/binary-calculator.html?number1=10101010&c2op=-
&number2=110011&calctype=op&x=98&y=12
Write in books
16

1.1.1 Binary: The Compliments


• The most common form of representation for negative binary
numbers is called two’s complement system. Using this
system the most significant bit of any binary number is
represents a negative quantity. For example for a 5-bit two’s
compliment number the column headings are:
-16s 8s 4s 2s 1s
• In 5-bit two’s compliment numbers, 10001 represents
-16 + 1 or -15
1. Change the 6-bit two’s compliment 2. Change -3 into a 4-bit two’s
number 100011 into a denary number. compliment number.

-32s 16s 8s 4s 2s 1s -8s 4s 2s 1s


1 0 0 0 1 1 1 1 0 1

Thus 100011 = -32 + 3 = -29 Thus -3 is -8 + 5 or 1101


17

1.1.1 Binary: The Compliments


• The example given by Cambridge asks you to imagine the
mileometer of a car set at 00000 miles. If the car goes forward
one mile the reading becomes 00001. if the meter was turned
back one mile the reading would be 99999 miles. This could
be interpreted as -1 mile.

Notice that if the number starts


11111101 = -3
with a 1, it represents a negative
11111110 = -2
number . Adding together the
11111111 = -1 binary equivalents for 3 and -3 we
00000000 = 0 obtain
00000001 = 1
This shows overflow
00000010 = 2
00000011 = 3 11111101
+ 00000011
(1) 00000000 the carry of 1 is ignored

Write in books
18

1.1.1 Binary: The Compliments


• If a single byte is available to store a number – two’s
compliment representation will allow us to store any whole
number from -128 to +127
From 1 0 0 0 0 0 0 0 (-128)

To 0 1 1 1 1 1 1 1 (+127)

• If we know the representation of any positive number in


binary, the two’s compliment representation of the
corresponding negative number is easily obtained from it. The
reverse is also true. This process of reversing the sign of a
binary number is called finding the two’s compliment of the
number.

Write in books
19

1.1.1 Binary: Two’s Compliment


Subtraction using two’s compliment.
Now that we know how to change a
binary number into either a positive
or negative number using two’s
128-104 = 24 compliment we can now look at why
it is used.

128-105 = 23 We can do a subtraction by adding a


positive number to negative number.
15 – 8 would be the same as 15+ (-8).
Adding in binary is much easier than
subtraction especially when
borrowing 1s.

Continued next slide:

Write in books
20

1.1.1 Binary: Two’s Compliment


• We can find what –8 is by using two’s compliment. We can
then find 15 and add the two resulting numbers together.

1. Work out the negative number first in two’s


compliment by writing the positive number,
reversing the bits and adding one.
2. Write down the positive number in two’s
compliment
3. Add the two’s compliment numbers together

• The bit in brackets is carried over from the -16 column. This
bit is called the overflow bit. We ignore this overflow bit so
15 – 8 = 00111 in two’s compliment,
when converted back to denary this is 7

Write in books
21

1.1.1 Binary: Two’s Compliment • As you can see below the two
• Calculate 31 – 17 using two’s bit patterns are different
compliment! because different bit lengths
have been used. So it is essential
that you know the bit length
before you answer the question.
The usual bit length is eight.
Answers to questions
Remove box to see

• An important note on storing numbers in two’s


compliment: when you answer questions involving
two’s complement, you must know how many bits the
number should occupy. It should always tell you the
number of bits in the question you are answering. As
the most significant bit (the one over to the left) is
always negative in two’s compliment. This will affect
the number of different bit lengths used.
Write in books
22

1.1.1 Binary: The Compliments Summary


• Converting a negative denary number to binary:
 Find the binary value of the equivalent positive decimal number
 Change all the ones to zeros and zeros to ones – add one to the result
• Converting a two’s compliment number into denary
 You can either flip the bits and add one then work out the positive
equivalent or use place values
 Write the binary digits down under the headings 1, 2, 4, 8 etc. noting
that the leftmost bit has a negative place value. The add up all the
headings which has a one under them.

Hints
A positive number always has ZERO as the MSB (most significant bit)
A negative number always has a ONE as the MSB
An even number always has a ZERO as the LSB (least significant bit)
An odd number always has a ONE as the LSB

Write in books
23

1.1.1 Binary: Answer the questions below – show working out:

1 4

5
2

Answers in word document called slide 23 answers


24

1.1.1 Binary: BCD or binary coded decimal


• BCDs are not actually real numbers! Imagine adding or subtracting
barcodes from one another the answer is meaningless.
• BCD is simply a way of encoding numbers usually digit by digit.
Each digit is changed into a four bit binary number that is then
placed after one another in sequence.
Weighted 8-4-2-1 BCD Code
• The bits are given from the left to the right, the
weights 8, 4, 2 and 1 respectively. Since these weights
are just the place values in the binary system, a
decimal digit is encoded as its binary representation.
The 8-4-2-1 BCD representation of N i.e. 469 is:
4 6 9
0100 0110 1001

On the other hand a straight binary representation of N is:


0001 1101 0101
Write in books
25

1.1.1 Binary: BCDs advantages and disadvantages.


• The advantage of BCD is the ease of conversion from BCD to decimal
and vice versa. For example, when binary numbers have to be
electronically decoded for a pocket calculator display, a number held in
BCD format simply has to be split into groups of four bits and each
group converted directly to the corresponding decimal digit.
• The BCD's main plus, is its more accurate representation and
rounding of decimal quantities (no round off error in BCD coding, but
there may be in straight binary). In BCD each decimal digit is encoded
separately using as many bits as necessary to represent the complete
number exactly.
• BCD's principal drawbacks are a small increase in the complexity of the
circuits needed to implement basic arithmetic's. More bits are also
required to store a number compared to pure binary. Also calculations
are more complex than with pure binary.

Write in books
26

1.1.1 Binary: Where it is used today!


• BCD was used in many early decimal
computers, and is implemented in the
instruction set of machines such as the IBM
System/360 series and its descendants
and Digital's VAX.
• Although BCD is not as widely used as in
the past and is no longer implemented in
computers instruction sets, decimal fixed-
point and floating-point formats are still
important and continue to be used in
financial, commercial, and industrial
computing, where subtle conversion
and fractional rounding errors that are
inherent in floating point binary
representations cannot be tolerated.

Write in books
27

1.1.1 Character sets


• The complete set of characters that a computer uses is
know as the character set.
• Each character in a character set must have it’s own binary
value, which is the code by which the computer recognises
it – for example ‘A’ could be represented by 000.
• The size of the character set depends on what the computer
is supposed to do. Some systems don’t need to be able to
recognise a lot of characters so they only need a few bits for
each character.
• A good example of this would be an
ATM machine which needs very few
characters to operate its interface.

Write in books
28

1.1.1 Character sets – problems


• Over the years different computer designers have
used different sets of codes for representing characters.
This has led to great difficulty in transferring information
from one computer to another.
• Most personal computers nowadays use the ASCII code
(American standard code for information interchange).
• However many mainframe computers still use a code called
EBCDIC which uses 8 bits to encode each character.
• ASCII originally used a 7-bit code. The 128 bits
combination can represent letters, numbers and special
symbols. Later the 8th bit was added to allow an extra 128
characters which is know as ASCII extended.

Write in books
29

1.1.1 Use of binary codes to represent characters


Starts at 0 and finishes 255

Don’t write in books


30

1.1.1 ASCII continued:


• Unicode is a 16-bit code that uses two bites,
16-bits represents over 65’000 characters.
• Therefore all of the world’s languages can be
represented. This is useful particularly if a
single document needs to be written in
English, Arabic and Chinese.
• In ASCII the first 32 codes are used for
communication protocols.
• Please read Handout 2 ASCII

Write in books
31

CIE Recommended Websites


9608 specimen papers and Step by step explanation of how to Notes on hexadecimal:
9691 past question papers are convert from decimal to binary: http://courses.cs.vt.edu/~csonline/NumberSystems/Les
available at http://courses.cs.vt.edu/~csonline/ sons/HexAndOctalNumbers/index.html
http://teachers.cie.org.uk NumberSystems/Lessons/DecimalT
oBinaryConversion/index.html
Interactive binary number Video of lecture on binary numbers Comprehensive notes for binary and hexadecimal with
conversion test game: (11:40 minutes). exercises:
www.pwnict.co.uk/binaryGrid/ Interesting:introduction explaining http://en.wikibooks.org/wiki/A-level_Computing/AQA/P
index.html place value: roblem_Solving,_Programming,_Data_Representation_a
www.youtube.com/watch?v=biqp0 nd_Practical_Exercise/Fundamentals_of_Data_Represen
tation/Binary_number_system
HjJmfk
Video of binary revision lesson Class activities to introduce binary Game to test learners’ binary number conversion skills:
(1:12 minutes): numbers: http://forums.cisco.com/CertCom/game/binary_game_
www.youtube.com/watch?v=_ http://csunplugged.org/binary-num page.htm
Supto87ZD4 bers
Notes on 2’s complement: Sequence of two videos of very Notes and exercises for two’s complement showing two
http://courses.cs.vt.edu/~csonl detailed explanation (with different methods of conversion (binary subtraction not
ine/NumberSystems/Lessons/T background) of how to store required):
wosComplement/index.html
negative integers: http://en.wikibooks.org/wiki/A-level_Computing/AQA/P
www.youtube.com/watch?v=Ys_t6i roblem_Solving,_Programming,_Data_Representation_a
SjboM nd_Practical_Exercise/Fundamentals_of_Data_Represen
tation/Two%27s_complement
(17:05 minutes)
 
www.youtube.com/watch?v=hksGd
VX5NBQ
(12:38 minutes)

Write in books
32

CIE Recommended Websites


Comprehensive notes and exercises for ASCII: Comprehensive notes and exercises on Notes on BCD:
http://en.wikibooks.org/wiki/A-level_Computing/AQ Unicode: http://en.wikipedia.org/wiki/Bi
A/Problem_Solving,_Programming,_Data_Represent http://en.wikibooks.org/wiki/A-level_C nary-coded_decimal
ation_and_Practical_Exercise/Fundamentals_of_Dat omputing/AQA/Problem_Solving,_Prog
a_Representation/ASCII ramming,_Data_Representation_and_P
ractical_Exercise/Fundamentals_of_Dat
a_Representation/Unicode

Write in books

You might also like