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

INTRODUCTION TO

DIGITAL CONCEPT
ANALOGUE AND DIGITAL
 Learning outcomes (LO)
◦ Define analogue and digital concepts.
◦ Compare differentiation between analogue and
digital signal .
ANALOGUE AND DIGITAL
 Analogue is a system that deals with
continuous varying quantities such as
voltage, temperature, pressure, velocity. Most
quantities in nature occur in analogue,
yielding an infinite number of different levels.
ANALOGUE AND DIGITAL
ANALOGUE AND DIGITAL
 Examples
 Mercury-filled tube thermometer.
 A baseball player swings a bat in an analogue motion.
 Velocity and force with which a musician strikes a
piano key.
ANALOGUE AND DIGITAL
 Digital refers to a system that deals with
discrete digits or quantities. Digital
electronics deals exclusively with 1s and 0s,
or ONs and OFFs. Digital codes such as ASCII
are then used to convert the 1s and 0s to a
meaningful number, letter or symbol for
some output display.
ANALOGUE AND DIGITAL
ANALOGUE AND DIGITAL
 Examples
 Compact disks (CD)
 Digital audio tapes (DAT’s)
 Digital watch
ANALOGUE AND DIGITAL
Analogue Signal
 Higher quality than digital if noise does not interface.
 Can also receive the information.
 Complexity of circuit design.
 Expensive equipment and larger size.

Digital Signal
 Immune to noise
 Flexibility storage
 Either 1’s or 0’s only.
 Easy to design.
 Cheaper equipment and smaller size.
NUMBERING SYSTEM
 Learning outcomes (LO)
◦ Understand basic numbering system format.

◦ Convert from one numbering system format to


another numbering system format.

◦ Solve basic arithmetic operation.


Number Systems - Intro
 What is number system??
◦ Number system consists of set of symbols called
digits with relation defined for addition (+),
subtraction (-), multiplication (x), and division.

◦ The radix or base of a number system refers to the


total number of symbols that a particular number
system will exploit.

◦ Decimal, binary, octal, hexadecimal.


Type of numbering system
 Decimal (base-10)
◦ Used widely in real world. E.g. 1,2,3,4,5 … 9, 10…

 Binary (base-2)
◦ Used widely in Digital Technologies. E.g. 000, 001, 010,
011, 100 etc
◦ There is a need to convert the binary and decimal
interchangeably in our current digital technology
Type of numbering system
 Octal (base-8) & Hexadecimal (base-16)
◦ as ‘shorthand’ to represent binary value as it is not
practical to list out or remember the long sequence of
binary digits.

 Octal
◦ Base 8 number system i.e. 8 digit symbols – 0, 1, 2, 3, 4,
5, 6, 7
◦ Weight based on position (8 to the power of its
positional value) as follows:
84 83 82 81 80 · 8-1 8-2 8-3
Type of Numbering System
 Hexadecimal
◦ Base 16 number system i.e. 16 digit symbols – 0, 1,
2 …8, 9, A, B, C, D, E, F

◦ Weight based on position the same as binary and


decimal – weighted as power of 16

164 163 162 161 160 · 16-1 16-2 16-3


Type of Numbering System
 Utility of hexadecimal >>
◦ Shorthand to represent strings of bits

◦ Convenience and less error - prone to write the binary


number in hex

◦ Easy to convert back and forth from binary to hex (only


need to remember the 4-bits binary pattern)

◦ Easier to read and remember and write

◦ (Used as a convenience for the humans involved but


digital machines all use binary signal)
Conversion
 Binary  Decimal
◦ Positional System
 100102 = 24 + 0 + 0 + 21 + 0 = 1810
 110110012 = Try this!

 Decimal  Binary
◦ 2 ways:
 Reverse the above process
 Repeated division
Conversion
 Reverse process
◦ 7610 = 26 + 0 + 0 + 23 + 22 + 0 + 0 = 1001100 2
◦ 3910 = Try this!

 Repeated division (logical)


◦ Repeatedly dividing the decimal number by 2 and jot down the
reminder after each division until the quotient of 0 is obtained.
 First remainder = LSB
 Last reminder = MSB
Conversion
 Example of calculation
◦ 10410 =
◦ 20010 =

 Counting Range
◦ For N bits – can count up to 2N different decimal
numbers ranging from 0 to 2N – 1

◦ e.g. 3 bits binary number


 different numbers can be counted = 8
 range of number = 0 to 8 – 1
◦ Please justify your calculation!
Conversion
 Octal  Decimal
24.68 = 2 x 81 + 4 x 80 + 6 x 8-1

= 20.75

3788 = 3 x 82 + 7 x 81 + 8 x 80 24.68 =2x

= 25010 = 20

77778 = Try this!


Conversion
 Decimal  Octal
◦ Repeated division by 8 and taking its remainder at
each division until the quotient is zero
◦ E.g. 26610 = XXX8  try this!
74610 = XXXX8  try this!

 Octal  Binary
◦ Group the binary number into 3 digits according to
the value of each octal digit. Refer table below:
Octal 0 1 2 3 4 5 6 7
Binary 000 001 010 011 100 101 110 111
Conversion
 Example:
4728 = 4 7 2 Convert the following into
? ? ? binary digits:
100 111 010  2618

54318 = 5 4 3 1
? ? ? ?  7358
101 100 011 001

 Likewise, reverse process for binary to octal


Conversion
 Hex  Decimal
◦ Based on the fact that each hex digit has a weight
that is a power of 16

◦ E.g. calculation:
 1D216 = 1 x 162 + 13 x 161 + 2 x 160 = 46610
 ADF16 = Try this!

 Decimal  Hex
◦ Repeated division by 16 (the same as the binary
repeated division by 2). Obtain the remainder (least
15 = F) until the quotient is 0
Conversion
 E.g. Calculation
◦ Convert 12310 to hex

◦ Convert 147310 to hex


Conversion
 Hex  Binary
◦ Each hex digit is converted to its respective 4-bit
binary equivalent.
Hexadecimal 0 1 2 3 ….. 9 A B C
Binary 0000 0001 0010 0011 ….. 1001 1010 1011 1100

◦ e.g. calculation
 2F16  ??
 BA616  ??
Conversion
 Binary  Hex
◦ Reverse the process above – grouping into 4-bits
and converts each group-bits to its respective hex
number.

11001101102 = 0011 0101 1010


? ? ?
3 5 A
Arithmetic Operation
 Binary Addition
◦ Binary numbers are added like decimal numbers

◦ In decimal, when numbers sum more than 9, a carry


results

◦ In binary when numbers sum more than 1, a carry


takes place

◦ Addition is the basic arithmetic operation used by


digital devices to perform subtraction,
multiplication and division
Arithmetic Operation
 Decimal addition
 carry 1 results  carry
1 1 1
376 888
+461 +888
837 1776

 Now take notes on binary addition principles:


1. 0+0=0
2. 0+1=1
3. 1 + 1 = 10  0 + carry of 1 into next position
4. 1 + 1 + 1 = 11  1 + carry of 1 into next position
Arithmetic Operation
 E.g. Calculation
a) 11 b) 1111 c) 111 1
011 (3) 1001 (9) 11.011
+110 (6) +1111 (15) +10.110
1001 (9) 11000 (24) 110.001
Arithmetic Operation
 These binary numbers we were dealing now
in better known as unsigned binary number

 i.e. no positive or negative sign, only shows


the magnitude of the number.

 How do we represent -810 in binary number?


Signed Number
 Signing the binary numbers:
◦ Since it is only possible to show magnitude with a
binary number, the sign (+ or -) is shown by adding
an extra “sign” bit.

◦ A sign bit of ‘0’ indicates a positive number.

◦ A sign bit of ‘1’ indicates a negative number.

◦ The 2’s complement system is the most common


way to represent signed numbers.
Signed number
 Representation of signed numbers in sign-magnitude
form:
A6 A5 A4 A3 A2 A1 A0
0 1 1 0 1 0 0 = +5210
? Magnitude = 5210
Sign bit (+)

A6 A5 A4 A3 A2 A1 A0
1 1 1 0 1 0 0 = -5210
? Magnitude = 5210
Sign bit (-)

 # Remembers that the 2’s complement system is the


most common way to represent signed numbers.
1’s and 2’s complement
 In order to change binary number to 2’s
complement it must first be changed to 1’s
complement (opposite).

 Add 1 to get 2’s complement

1 0 1 1 0 1  Original binary number


0 1 0 0 1 0  Complement each bit to form 1’s
complement
+ 1  Add 1 to form 2’s complement
0 1 0 0 1 1  2’s complement of the original
number
1’s and 2’s complement
 Representing signed numbers using 2’s
complement
◦ For + 4510 
A6 A5 A4 A3 A2 A1 A0
0 1 0 1 1 0 1
? Magnitude = 4510 (truly binary)
Sign bit (+)
0101101 = +4510

A6 A5 A4 A3 A2 A1 A0
◦ For1 - 45100  1 0 0 1 1
? Magnitude = 4510 (2’s complement)
Sign bit (-)
1010011 = -4510
Addition in 2’s Complement System
 Case 1: Two positive numbers
◦ Consider the addition of +9 and + 4

+9 0 1001 (augend)
+4 0 0100 (addend)
+13 0 1101 (sum = +13)

 Case 2: Positive
+9 number
0 and
1001 smaller negative number
◦ Consider the–4
addition1 of 1100
+9 and –4
+5 1 0 0101
Addition in 2’s Complement System
 Case 3: Positive number and larger negative number
◦ Consider the addition of –9 and +4

–9 1 0111
+4 0 0100
–5 1 1011

 Case 4: Two negative numbers


–9 1 0111
◦ Consider the addition of –9 and –4
–4 1 1100
–13 1 1 0011
Addition in 2’s Complement System
 Case 5: Equal and Opposite Numbers
◦ Consider the addition of –9 and +9

–9 1 0111
+9 0 1001
0 1 0 0000


Subtraction in The 2’s Complement
System
 The number subtracted (subtrahend) is
negated

 The result is added to the minuend.

 The answer represents the difference.

 If the answer exceeds the number of


magnitude bits an overflow results.
Subtraction in The 2’s Complement
System
 Consider the subtraction of +4 from +9 
(+9) – (+4)

Minuend (+9)  01001 01001 (+9)


Subtrahend (+4)  00100 +11100 (–4)
100101 (+5)
Negate the subtrahend = 11100 = –4
This carry is disregarded
Subtraction in The 2’s Complement
System
 Consider the subtraction of +9 from –4  (–
4) – (+9)

Actual 11100 (–4)


form – 01001 (+9)
11100
Minuend (–4)  11100 +10111
Subtrahend (+9)  01001 110011
Negate the subtrahend = 10111 = –9
This carry is disregarded
Overflow
 Overflow happens when the sum of signed
binary numbers including the sign bit it out
of range >> (bit number range)

 Consider this 4-bit operation:


1
0101 (+5) The answer is wrong due to overflow.
+ 0100 (+4) Overflow happens when the sum is
(0) 1001 (looks like -7) out of range. In this case, for 4-bit, -8
< sum < +7
Overflow
 Consider this 5-bit operation:

01001 (+9) The answer is wrong due to overflow.


+ 01000 (+8) Overflow happens when the sum is
(0) 10001 (looks like –15) out of range. In this case, for 5-bit, -
16 < sum < +15

You might also like