0% found this document useful (0 votes)
36 views

Chapter 1 Number Systems - v6

Uploaded by

Zion Lau
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)
36 views

Chapter 1 Number Systems - v6

Uploaded by

Zion Lau
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/ 20

Official (Closed) - Non Sensitive

Chapter 1 Number Systems


Electrical & Electronics Technology
(29EAET)
Official (Closed) - Non Sensitive

Instructional Objectives
• Perform decimal to binary or hexadecimal conversion and vice versa.
• Express decimal numbers using the Binary-Code- Decimal (BCD) code.
• Explain the need for ASCII Code.
• Understand the need for Gray code
YouTube video
a) This video provides a basic introduction into number systems such decimal, binary, octal and
hexadecimal numbers:
https://www.youtube.com/watch?v=FFDMzbrEXaE&t=415s

b) This video tutorial explains how to convert hexadecimal to binary numbers.


https://www.youtube.com/watch?v=D_YC6DSPpQE

2
Official (Closed) - Non Sensitive

1.1 Number Systems


Most common number systems in use are
Decimal, Binary and Hexadecimal.
Decimal System Binary System Hexadecimal System
(1) Number of
symbols
used 012345 0123456789
01
6789 ABCDEF
(2) Base and
Weight Base: 10 Base: 2 Base: 16
Weight: Weight: Weight:
10K 2K 16K

3
Official (Closed) - Non Sensitive

1.1.1 Binary Numbers


• Binary system is used in digital systems, such as computers.
• It uses two symbols “0” & “1” called bits,

• Least significant bit (LSB) is the bit position in a binary number giving the
least value.
• Most significant bit (MSB) is the bit position in a binary number having the
greatest value.
• Easy to design electronic circuits to operate with two voltage levels,
representing the 2 symbols in a binary system

4
Official (Closed) - Non Sensitive

1.1.1 Binary Numbers


For an n-bit binary number,
• the total number of decimal equivalents or combinations = 2 n
• The largest decimal number = (2n - 1)
• Ranges from 0 to (2n - 1)

• Number of bits, n=3


• Total number of combinations = 23 = 8 (000,001,010,…111)
• The largest decimal number in the range
= (2n - 1) = 23 -1 =7
• The number ranges from: 010 to 710

5
Official (Closed) - Non Sensitive

1.1.1 Hexadecimal Numbers


In this system there are 16 symbols or possible digit values from 0 to 9, followed by six
alphabetic characters -- A, B, C, D, E and F.
Hexadecimal Binary Decimal
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15

6
Official (Closed) - Non Sensitive

1.2 Conversion Between Number Systems


1.2.1 Binary to Decimal Conversion
Example
Convert the following Binary numbers to their Decimal equivalents
using sum of position weights method.
(a) 110101012
= 1 x 27 + 1 x 26 + 1 x 24 + 1 x 22 + 1 x 20 (the weight is highlighted)
= 128 + 64 + 16 + 4 + 1 (positional value)
= 21310
Each binary digit has its value expressed in powers of 2, depending on its position

7
Official (Closed) - Non Sensitive

1.2.2 Decimal to Binary Conversion


Convert the following Decimal numbers to their Binary
equivalents using repeated division by 2 method.
Example – convert 5710 to binary

Many students missed this digit in their answer

8
Official (Closed) - Non Sensitive

1.2.3 Hexadecimal to Decimal Conversion


Convert the following Hex numbers to their Decimal equivalents
using sum of position weights method.
Example – convert 2C716 to decimal

= 2 x 162 + 12 x 161 + 7 x 160


= 2 x 256 + 12 x 16 + 7 x 1 (positional value)
= 71110

Each HEX digit has its value expressed in powers of 16, depending on its position

9
Official (Closed) - Non Sensitive

1.2.4 Decimal to Hexadecimal Conversion

Example
Convert the following Decimal numbers to their Hexadecimal
equivalents using repeated division by 16 method.
(a) 29910 Many students made a mistake here

10
Official (Closed) - Non Sensitive

1.3 Encoding and Codes


• Encoding is to represent numerical quantities, alphanumeric
characters or words by a group of symbols.
• The group of symbols is called a code.
• Most commonly seen codes:
Straight binary code
Binary coded decimal code (BCD code)
Gray code
Alphanumeric code
11
Official (Closed) - Non Sensitive

1.3.1 Binary Coded Decimal (BCD)


• BCD is a 4-bit binary number used to represent decimal digits.
• Only TEN 4-bit binary codes are used to represent decimal
numbers ranging from 0 to 9.
Decimal 0 1 2 3 4 5 6 7 8 9
BCD code 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001

Decimal 10 11 12 13 14 15

Invalid BCD 1010 1011 1100 1101 1110 1111


code

Invalid code
12
Official (Closed) - Non Sensitive

Example
Convert the following decimal numbers to their equivalent
BCD codes.

(a) 3610 = 0011 0110BCD


BCD code contains
groups of 4-bit binary number
(b) 32410 = 0011 0010 0100BCD

13
Official (Closed) - Non Sensitive

Example
Convert the following BCDs to their decimal equivalents
respectively.

(a) 001010010001BCD = 0010 1001 0001BCD


= 2 9 110

(b) 101000110110BCD = 1010 0011 0110BCD


= not possible as
Steps:
1010 is an illegal code
start from the right and group the bits into 4 bits,
then replace every group of 4 bits with the equivalent decimal digit.

14
Official (Closed) - Non Sensitive

Example Convert the following BCDs to their HEX equivalents


(a) 001010010001BCD = 0010 1001 0001BCD
= 2 9 110
16|_291
16|_ 18 ---- r 3
16|_ 1 ---- r 2
0 ---- r 1
001010010001BCD = 12316
2-step process
Convert the BCDs to their decimal equivalents, then make a conversion to HEX
15
Official (Closed) - Non Sensitive

Example Convert the following BCDs to their HEX equivalents


(b)001100101000BCD = 0011 0010 1000BCD
= 32810
16|_328
16|_ 20 ---- r 8
16|_ 1 ---- r 4
0 ---- r 1
0011 0010 1000BCD = 14816
Steps
start from the right and group the bits into 4 bits and convert the BCDs to their decimal
equivalents, then convert the decimal number into Hexadecimal, using repeated division by 16
method 16
Official (Closed) - Non Sensitive

Summary
Decimal Straight Binary BCD Hex Binary ( Hex Equ)

10 1010 0001 0000 A 1010


11 1011 0001 0001 B 1011
12 1100 0001 0010 C 1100
13 1101 0001 0011 D 1101
14 1110 0001 0100 E 1110
15 1111 0001 0101 F 1111
16 10000 0001 0110 10 0001 0000
17 10001 0001 0111 11 0001 0001
18 10010 0001 1000 12 0001 0010
19 10011 0001 1001 13 0001 0011
20 10100 0010 0000 14 0001 0100
21 10101 0010 0001 15 0001 0101

| | | | |
| | | | |
| | | | |
31 11111 0011 0001 1F 0001 1111
32 100000 0011 0010 20 0010 0000

17
Official (Closed) - Non Sensitive

1.3.2 GRAY code (reference)


• This is also known as unweighted code. This is used to
represent decimal value but the bit position is unweighted
• It is also known as minimum-change code as the adjacent
numbers have a single digit differing by 1.
3-bit Gray Code 3-bit Gray Code

Outer track digit is highlighted in blue


18
Official (Closed) - Non Sensitive

1.3.2 Gray Code (reference)


If using Binary Code in encoder tracks, there are many positions where several tracks change
state simultaneously. This may easily result in an error due to misalignment.
However, Gray code reduces the bit change to only one data bit per measuring step at a time.
So then, if an error occurs, the resulting error will be only one bit.

Binary Gray Binary Gray


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

4-bit Gray Code


When code 3 changes to code 4, the bit change is illustrated in BLUE

The far-right digit is the Outer Track digit

19
Official (Closed) - Non Sensitive

1.3.2 Other Types of Codes (reference)


American standard code for Information Interchange (ASCII)
• A 7-bit code that represents numbers, alphabets and control
information.
• For example, 100 0001 represents character “A”
0000 0001

000
001
010
011
100
101
110
111
20

You might also like