Sie sind auf Seite 1von 49

SEE202: Digital Electronics

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Topic 1 – Objectives
• Describe the advantages, disadvantages of, and
main differences between analogue and digital
systems

• Identify typical digital signals

• State the main differences between parallel and


serial data transmission

• Perform conversions among decimal, binary and


hexadecimal number systems

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Topic 1 – Objectives cont.
• Express decimal numbers using BCD code

• Describe the need for alphanumeric codes

• Use the ASCII code to encode and decode


information

• Determine the parity of digital data and describe


how parity can be used to detect errors in data.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Where are Digital Systems?
• Communications • Industrial controls

• Telemetry • Consumer equipment

• Test instruments

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Analog (continuous) Signals
• Analog signals are AC or DC currents or
voltages which vary smoothly or continuously.
• Analog signals do not generally change abruptly
or in steps
• For example, the speed of a car can take any
value between zero and 130 km/hr.
• In an analog speedometer, the deflection of the
needle is proportional to the car’s speed.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Analog (continuous) Signals

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Digital (discrete) Signals
• Digital signals are a series of pulses or rapidly
changing voltage levels that vary in discrete
steps or increments.
• The two-voltage level, off/on or up/down fast-
switching characteristic is a fundamental of all
digital signals.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Digital (discrete) Signals

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Digital (discrete) Signals
• There has been an increasing shift over the
years from analog devices to digital devices:
• analog telephone systems to digital telephone
systems
• vinyl analog records to digital compact discs
• Analog VHS video tapes to digital video discs
• Analog computers to digital computers

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Why Digital over Analog?
• Greater accuracy - it is easier to count
pulses than measure the size of voltages.
• Greater dynamic range - dynamic range
is the difference between the upper and
lower data values that a system or
instrument can handle.
Analog systems are generally limited to
100 000 to 1 whereas digital systems are
unlimited.
Lecturer: Ben Horan SEE103: Electronics March 11, 2015
Why Digital over Analog?
• Greater stability - temperature changes
effect R, L and C values as well as
semiconductor materials. Hence distortion
and gain changes can occur for analog
circuits.
• Digital circuits are not greatly affected.

• Convenience - less error in reading.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Why Digital over Analog?
• Automation - digital signals can be more
easily used to control and monitor
operations.
• Simpler Design - simpler circuits using
digital ICs.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


One Key Problem
• The real world is analog!

• Steps to use analog signals in digital


electronics:

1. convert the real-world analog quantities into


a digital form
2. perform the necessary operations on the
digital quantities
3. convert the digital outputs back into analog

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Decimal Number Systems
• Our normal number system is the decimal
system and requires 10 different symbols to
represent all possible values
• Decimal has a radix or base of 10
• In the decimal system a quantity is represented
by the value and the position of a digit
• For example: 7321.45 can be represented as:

7 × 103 + 3 × 102 + 2 × 101 + 1 × 100 + 4 × 10–1 + 5 × 10–2

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary Number Systems
• Binary number systems have 2 distinct states

One State True High Up Pulse Hot Closed North Yes


Other State False Low Down No Pulse Cold Open South No

• States in a Modern Digital Electronic Systems:

(open) 0 or 1 (closed)
base of 2 or radix of 2

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary Number Systems
• Binary number systems have a base of 2 or
radix of 2.
• The binary system, like the decimal, is positional
however is based on powers of 2.
• What is the decimal value of the following binary
number?
101011 ?

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary Number Systems cont.
• Example: 101011 is equal to 43 decimal
25 24 23 22 21 20
Least Significant Bit (LSB)
(1)
1 0 1 0 1 1 1x 20 + (2)
1x 21 + (0)
Most Significant Bit (MSB)

0x 22 + (8)
1x 23 + (0)
0x 24 + (32)
1x 25 = 43
Lecturer: Ben Horan SEE103: Electronics March 11, 2015
Binary Number Systems cont.
• When a binary number is written down, the right
hand bit is called the least significant bit (LSB)
and the left most bit is called the most significant
bit (MSB).
• To indicate the number system in use the base is
often written as a subscript.
Thus 1010112 = 4310
• This is to avoid ambiguity
eg. 3 = 11 should be written as 310 = 112

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary Number Systems cont.
• Fractional numbers can also be represented in
binary.
• In the binary number 10.1112

21 20 2-1 2-2 2-3


2-1 = 0.5; 2-2 = 0.25 and 2-3 = 0.125.
• The decimal equivalent of 10.1112 is hence 2.875.
• Lets look at another example

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary Number Systems cont.
• Example:
Convert the binary number 1011.1001 to its decimal
equivalent.

1011.10012 = (1× 23 ) + (0 × 2 2 ) + (1× 21 ) + (1× 20 )


+ (1× 2 −1 ) + (0 × 2 − 2 ) + (0 × 2 −3 ) + (1× 2 − 4 )
= 1 + 2 + 0 + 8 + 0.5 + 0 + 0 + 0.0625
= 11.5625

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary Number Systems cont.
• Converting Decimal to Binary:

• Process
• To convert a decimal integer to its binary
equivalent, progressively divide the decimal
number by 2, noting the remainder.
• The remainder is taken in reverse order to form
the binary number.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary Number Systems cont.
• Converting Decimal to Binary:

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary Number Systems cont.
• Converting Decimal fractions to Binary:

• Process
• To convert a decimal fraction to its binary
equivalent, progressively multiply the fraction by
2, removing and noting the carries.
• The carries taken in forward order form the
binary equivalent.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary Number Systems cont.
• Converting Decimal fractions to Binary:

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary Number Systems Cont.
• Largest Number Representable
– Decimal: (n digits) = 10n – 1
For example: highest 3 digit number : 103 -1 = 999

– Binary: (n digits) = 2n – 1
For Example: highest 3 digit word: 23 -1 = 7

• Number of bits (B) for decimal quantity N:


B = 3.32 log10N.
For example, if the max decimal number to be represented is 500, the
number of bits required is:
B = 3.32 log10500 = 3.32 × 2.6897 = 8.96 = 9 bits are required

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Octal Number Systems
• The Octal Number System is: base 8

84 83 82 81 80 8-1 8-2 8-3 8-4 8-5



Octal Point

• Converting octal numbers to decimal follows the


same procedure as converting binary to decimal. One
simply adds up the appropriate powers of 8.
3738 = (3 × 8 ) + (7 × 8 ) + (3 × 8 )
0 1 2

= 3 + 56 + 192 = 25110
Lecturer: Ben Horan SEE103: Electronics March 11, 2015
Octal Number Systems
• For example: convert the octal number 373 to
decimal:

3738 = (3 × 8 ) + (7 × 8 ) + (3 × 8 )
2 1 0

= 192 + 56 + 3 = 25110

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Octal Number Systems
• For example: convert the octal number 25.6 to
its decimal equivalent.

25.68 = (2 × 81 ) + (5 × 80 ) + (6 × 8−1 )
= 16 + 5 + 0.75 = 21.7510

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Octal Number Systems cont.
• Converting Decimal numbers to Octal:
For example: Convert the decimal number 267 to its
octal equivalent.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Octal Number Systems cont.
• Lets have a closer look at the Octal number
system

• Consider octal number 178

1*81 + 7*80
1510
001 111 = 001111 2

25 24 23 22 21 20
Lecturer: Ben Horan SEE103: Electronics March 11, 2015
Octal Number Systems cont.
• Converting back and forth between octal and
binary is easy!
Just convert each octal digit to its binary equivalent:
Octal digit: 0 1 2 3 4 5 6 7
Binary equivalent: 000 001 010 011 100 101 110 111

For example: Convert the 5 7 2


octal number 572 to its   
binary equivalent: 101 111 010
So, 5728 = 1011110102
Lecturer: Ben Horan SEE103: Electronics March 11, 2015
Octal Number Systems cont.
• What do we do if we have a binary number of
bit length not divisible by 3?
Eg. Convert binary11010 to Octal

Start grouping into three bits from the right

011010

3 2 = 328
Add leading zeros to complete the last group
Lecturer: Ben Horan SEE103: Electronics March 11, 2015
Hexadecimal Systems
• The Hexadecimal system is a number system
with a base or radix of 16.
• In order to use 16 distinct symbols hexadecimal
uses 0 to 9 plus the letters A through to F.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Hexadecimal Systems

Decimal Binary Hexadecimal Decimal Binary Hexadecimal


0 0000 0 8 1000 8
1 0001 1 9 1001 9
2 0010 2 10 1010 A
3
4
0011
0100
3
4
// 11
12
1011
1100
B
C
5 0101 5 13 1101 D
6 0110 6 14 1110 E
7 0111 7 15 1111 F

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Hexadecimal Systems cont.
• To convert from hexadecimal to decimal we
make use of the fact that each hex digit position
has a value which is a power of 16.

For example: the hex number 123416 has a decimal


equivalent given by:

123416 = 1 × 163 + 2 × 162 + 3 × 161 + 4 × 160


= 1 × 4096 + 2 × 256 + 3 × 16 + 4 × 1
= 466010.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Hexadecimal Systems cont.
• To convert from decimal to hexadecimal we
repeatedly divide the decimal number by 16. The
remainder in each division forms the
hexadecimal digit of the number.
For example:
Convert 45710 to hex
÷ Remainder
16 457 9
16 28 12 (C)
16 1 1
0

Solution: 1C9

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Hexadecimal Systems cont.
• Lets have a closer look at the Hexadecimal
number system

• Consider the hex number 1F16

1*161 + 15*160

0001 1111 = 00011111 2

27 26 25 24 23 22 21 20
Lecturer: Ben Horan SEE103: Electronics March 11, 2015
Why Use Octal or Hex?
• Computers and digital systems deal with binary
data.
• In a computer it is common to have strings as
long as 64 bits.
• They often represent other information, in
addition to numbers.
• It is often hard to us work with binary numbers.
• When dealing with large numbers of bits, it is
often easier and less error prone to work in octal
or hexadecimal.
Lecturer: Ben Horan SEE103: Electronics March 11, 2015
Why Use Octal or Hex?
• Octal and hexadecimal is a human-friendly way
of represent binary numbers, strings of bits.
• Although it would seem logical to work with
decimal (base 10) octal and hexadecimal have
the advantage of very simple conversion to
binary
• This is because hexadecimal (and octal) both
map to a whole number of bits, (4 bits and 3 bits
respectively)

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Why Use Octal or Hex?
• For instance, suppose you have the task of
reading a printout of 50 memory locations; each
is a 16-bit number.
• You are checking the printout against a list.
• Which is easier, checking
01101110011001112 or 6E6716
• Clearly, the reader is less likely to make a
mistake with the latter number.
• However, keep in mind that computers and
digital circuits work in binary!
Lecturer: Ben Horan SEE103: Electronics March 11, 2015
Why Use Octal or Hex?
• Lets consider the following 18 bit binary word
0111101011010100102
• Converting to decimal (base 10):

6553610 + 3276810 + 1638410 + 819210 + 204810 +


51210 + 25610 + 6410 + 1610 + 210

=12577810

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Why Use Octal or Hex?
• Now Converting to octal (base 8):
011110101101010 0102

3 6 5 5 2 2

= 3655228

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Why Use Octal or Hex?
• Now Converting to hexadecimal (base 16):
0111101011010100102

0001=1 14 11 5 2

1 E B 5 2
=1EB5216

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Why Use Octal or Hex?
• It is interesting to note that several languages
including the Pamean language in Mexico use an
octal number system
• This originated from the fact that they counted the
spaced between their fingers (on both hands) and
not the fingers themselves.
• Octal offers the advantage of not requiring any
extra characters (i.e. A-F)
• However hexadecimal results in smaller numbers

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Why Use Octal or Hex?
• The early IBM mainframes utilised 24 and 36 bit
words
• At this time Octal gained popularity because of
its ability to concisely represent these words
• More recently modern computers use 16, 32 or
64 bit words.
• As such, hexadecimal has grown in popularity

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary, Octal, Decimal and Hex?
• You can use the Windows calculator to double
check your conversions.
• In assignments you do need to show your
working

You need to select


Scientific mode

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Binary, Octal, Decimal and Hex?
• The Windows calculator is a useful tool
• However, it is limited to integers!

You can chose the


base,
Enter data then change
the base to convert

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Terminology
• A bit is a basic unit for information storage
– A bit can hold information with two distinct states 0 or 1
• A nibble is a group of 4-bits
– A nibble also corresponds to a single hexadecimal digit
so is often referred to as a ‘hex digit’
• A byte is a group of 8-bits
– Remember that a nibble is smaller than a byte
• A word is a fixed size of bits used by a digital
system
– Common word sizes are 16, 32 or 64 bits

Lecturer: Ben Horan SEE103: Electronics March 11, 2015


Conversions
1. To convert from binary, octal, or hex to decimal, take the
weighted sum the each digit.
2. When converting decimal to binary (also octal and hex), use
the technique of repeated division by 2 (or 8, or 16), and
collecting the remainders into the desired number.
3. When converting binary numbers to octal or hex, put the
binary number in groups of 3 or 4, as appropriate. Then
convert each group into its 3-bit or 4-bit equivalent.
4. When converting octal or hex to binary, work the other way
around. Convert each digit into its 3-bit or 4-bit binary
equivalent.
5. When converting from octal to hex, or hex to octal, first
convert the number to binary, then convert the resulting
binary number into the desired number system.

Lecturer: Ben Horan SEE103: Electronics March 11, 2015

Das könnte Ihnen auch gefallen