0% found this document useful (0 votes)
21 views14 pages

112 Note I

Digital electronics is a branch of electronics focused on digital signals for system control and processing, contrasting with analog electronics which deals with continuously varying signals. The document explains various number systems including decimal, binary, octal, and hexadecimal, along with methods for converting between these systems. It also covers computer codes like EBCDIC and ASCII that represent characters in binary format.

Uploaded by

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

112 Note I

Digital electronics is a branch of electronics focused on digital signals for system control and processing, contrasting with analog electronics which deals with continuously varying signals. The document explains various number systems including decimal, binary, octal, and hexadecimal, along with methods for converting between these systems. It also covers computer codes like EBCDIC and ASCII that represent characters in binary format.

Uploaded by

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

DIGITAL ELECTRONICS NOTES (1)

INTRODUCTION TO DIGITAL ELECTRONICS


Digital Electronics
Definition: Digital Electronics is the sub-branch of electronics which deals with digital signals for processing and
controlling various systems and sub-systems. In various applications like sensors and actuators, usage of digital
electronics is increasing extensively. In short, digital electronics is entirely the field in which digital signals is used.

Analog vs. Digital


The world of electronics can be divided into two distinct categories: the “analog” world and the “digital” world. The
analog world generally refers to any natural phenomenon that varies its own properties over a period of time. Take the
outside temperature, for example. We notice that it changes rather slowly throughout the day, and at any instant we
can measure how hot or cold it really is by using a simple thermometer.

It’s the job of the analog electronics engineer to deal with many of these thermal, magnetic, optical, acoustical,
biological, chemical, or electrical “signals” by designing the appropriate analog sensors and control circuitry.

Digital electronics, on the other hand, is completely different. In the digital realm (i.e., digital electronic circuits), there
are only two “states” that are important: ON or OFF. For example, when you flip the light switch on in your bathroom,
you know there are only two possible positions the light switch can be in (i.e. ON or OFF). It’s of no real concern to you
that there could be 110, 113, 120, or 125 volts (i.e., fluctuating analog “signal”) running through the electrical wiring
connected to the light switch.

Thus, digital electronics are based on a “switching logic” (ON or OFF). On the other hand, analog electronics are more
concerned with a fluctuating (constantly changing) electrical quantity like voltage and/or current.

Number Systems
When we type some letters or words, the computer translates them in numbers as computers can understand only
numbers. A computer can understand positional number system where there are only a few symbols called digits and
these symbols represent different values depending on the position they occupy in the number.
A value of each digit in a number can be determined using
 The digit
 The position of the digit in the number
 The base of the number system (where base is defined as the total number of digits available in the number
system).
1. Decimal Number System
The number system that we use in our day-to-day life is the decimal number system. Decimal number system has base
10 as it uses 10 digits from 0 to 9. In decimal number system, the successive positions to the left of the decimal point
represent units, tens, hundreds, thousands and so on.
Each position represents a specific power of the base (10). For example, the decimal number 1234 consists of the digit
4 in the units position, 3 in the tens position, 2 in the hundreds position, and 1 in the thousands position, and its value
can be written as
(1x1000)+ (2x100)+ (3x10)+ (4x1)
(1x103)+ (2x102)+ (3x101)+ (4x100)
1000 + 200 + 30 + 4
1234

2. Binary Number System

1
Characteristics of binary number system are as follows:
 Uses two digits, 0 and 1.
 Also called base 2 number system
 Each position in a binary number represents a power of the base 2. Example 20
 Last position in a binary number represents a x power of the base 2. Example 2 x where x represents the last or
leftmost position.
Example
Binary Number: 101012

Calculating Decimal Equivalent:

Step Binary Number Decimal Number

Step 1 101012 ((1 x 24) + (0 x 23) + (1 x 22) + (0 x 21) + (1 x 20))10

Step 2 101012 (16 + 0 + 4 + 0 + 1)10

Step 3 101012 2110

3. Octal Number System


Characteristics of octal number system are as follows:
 Uses eight digits, 0,1,2,3,4,5,6,7.
 Also called base 8 number system
 Each position in an octal number represents a power of the base 8. Example 80
 Last position in an octal number represents a x power of the base 8. Example 8 x where x represents the last
position .
Example
Octal Number : 125708

Calculating Decimal Equivalent:

Step Octal Number Decimal Number

Step 1 125708 ((1 x 84) + (2 x 83) + (5 x 82) + (7 x 81) + (0 x 80))10

Step 2 125708 (4096 + 1024 + 320 + 56 + 0)10

Step 3 125708 549610

4. Hexadecimal Number System


Characteristics of hexadecimal number system are as follows:
 Uses 10 digits and 6 letters, 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.
 Letters represents numbers starting from 10. A = 10. B = 11, C = 12, D = 13, E = 14, F = 15.
 Also called base 16 number system
2
 Each position in a hexadecimal number represents a 0 power of the base (16). Example 16 0
 Last position in a hexadecimal number represents a x power of the base (16). Example 16 x where x represents
the last position - 1.
Example
Hexadecimal Number : 19FDE16

Calculating Decimal Equivalent:

Step Binary Number Decimal Number

Step 1 19FDE16 ((1 x 164) + (9 x 163) + (F x 162) + (D x 161) + (E x 160))10

Step 2 19FDE16 ((1 x 164) + (9 x 163) + (15 x 162) + (13 x 161) + (14 x 160))10

Step 3 19FDE16 (65536+ 36864 + 3840 + 208 + 14)10

Step 4 19FDE16 10646210

Note : 19FDE16 is normally written as 19FDE.

Number Conversion
There are many methods or techniques which can be used to convert numbers from one base to another. We'll
demonstrate here the following:

 Decimal to Other Base System


 Other Base System to Decimal
 Other Base System to Non-Decimal
 Shortcut method - Binary to Octal
 Shortcut method - Octal to Binary
 Shortcut method - Binary to Hexadecimal
 Shortcut method - Hexadecimal to Binary
Decimal to Other Base System
steps
 Step 1 - Divide the decimal number to be converted by the value of the new base.
 Step 2 - Get the remainder from Step 1 as the rightmost digit (least significant digit) of new base number.
 Step 3 - Divide the quotient of the previous divide by the new base.
 Step 4 - Record the remainder from Step 3 as the next digit (to the left) of the new base number.
Repeat Steps 3 & 4, getting remainders from right to left, until the quotient becomes zero in Step 3.
The last remainder thus obtained will be the most significant digit (MSD) of the new base number.
Example
Decimal Number : 2910
Calculating Binary Equivalent:

3
Step Operation Result Remainder

Step 1 29 / 2 14 1

Step 2 14 / 2 7 0

Step 3 7/2 3 1

Step 4 3/2 1 1

Step 5 1/2 0 1

As mentioned in Steps 2 and 4, the remainders have to be arranged in the reverse order so that the first remainder
becomes the least significant digit (LSD) and the last remainder becomes the most significant digit (MSD).

Thus Decimal Number : 2910 = Binary Number : 111012.

Other base system to Decimal System


Steps
 Step 1 - Determine the column (positional) value of each digit (this depends on the position of the digit and the
base of the number system).
 Step 2 - Multiply the obtained column values (in Step 1) by the digits in the columns.
 Step 3 - Sum the products calculated in Step 2. The total is the equivalent value in decimal.
Example
Binary Number : 111012
Calculating Decimal Equivalent:
Step Binary Number Decimal Number

Step 1 111012 ((1 x 24) + (1 x 23) + (1 x 22) + (0 x 21) + (1 x 20))10

Step 2 111012 (16 + 8 + 4 + 0 + 1)10

Step 3 111012 2910

Binary Number : 111012 = Decimal Number : 2910

Other Base System to Non-Decimal System


Steps
 Step 1 - Convert the original number to a decimal number (base 10).
 Step 2 - Convert the decimal number so obtained to the new base number.
Example
Octal Number : 258
Calculating Binary Equivalent:
Step 1 : Convert to Decimal
Step Octal Number Decimal Number

4
Step 1 258 ((2 x 81) + (5 x 80))10

Step 2 258 (16 + 5 )10

Step 3 258 2110

Octal Number : 258 = Decimal Number : 2110


Step 2 : Convert Decimal to Binary
Step Operation Result Remainder

Step 1 21 / 2 10 1

Step 2 10 / 2 5 0

Step 3 5/2 2 1

Step 4 2/2 1 0

Step 5 1/2 0 1

Decimal Number : 2110 = Binary Number : 101012


Octal Number : 258 = Binary Number : 101012

Shortcut method - Binary to Octal


Steps

 Step 1 - Divide the binary digits into groups of three (starting from the right).
 Step 2 - Convert each group of three binary digits to one octal digit.

Example
Binary Number : 101012
Calculating Octal Equivalent:
Step Binary Number Octal Number

Step 1 101012 010 101

Step 2 101012 28 58

Step 3 101012 258

Binary Number : 101012 = Octal Number : 258


Shortcut method - Octal to Binary
Steps
 Step 1 - Convert each octal digit to a 3 digit binary number (the octal digits may be treated as decimal for this
conversion).
 Step 2 - Combine all the resulting binary groups (of 3 digits each) into a single binary number.

5
Example
Octal Number : 258
Calculating Binary Equivalent:
Step Octal Number Binary Number

Step 1 258 210 510

Step 2 258 0102 1012

Step 3 258 0101012

Octal Number : 258 = Binary Number : 101012


Shortcut method - Binary to Hexadecimal
Steps
 Step 1 - Divide the binary digits into groups of four (starting from the right).
 Step 2 - Convert each group of four binary digits to one hexadecimal symbol.
Example
Binary Number : 101012
Calculating hexadecimal Equivalent:
Step Binary Number Hexadecimal Number

Step 1 101012 0001 0101

Step 2 101012 110 510

Step 3 101012 1516

Binary Number : 101012 = Hexadecimal Number : 1516


Shortcut method - Hexadecimal to Binary
steps
 Step 1 - Convert each hexadecimal digit to a 4 digit binary number (the hexadecimal digits may be treated as
decimal for this conversion).
 Step 2 - Combine all the resulting binary groups (of 4 digits each) into a single binary number.
Example
Hexadecimal Number : 1516
Calculating Binary Equivalent:
Step Hexadecimal Number Binary Number

Step 1 1516 110 510

Step 2 1516 00012 01012

Step 3 1516 000101012

Hexadecimal Number: 1516 = Binary Number: 101012


6
COMPUTER CODES
The letters, numbers and special characters that we input into the computer are stored using a computer code. The
computer code is a way of representing each character using only the 0 and 1 binary bits that the computer
understands. Two computer codes that are used today are EBCDIC and ASCII. ASCII is the code that is used on your
microcomputer.

1. EBCDIC (Extended Binary Coded Decimal Interchange Code):


EBCDIC is an 8-bit code where the left four bits are called the zone and the right four bits are called the digit portion. The
zone part of the code tells what “group” the character is part of, while the digit part of the code identifies the specific
character within the group. EBCDIC has codes for upper case and lower-case letters, numbers and special characters.
This handout will deal only with upper case letters and numbers.
The structure of the EBCDIC code is:
_ _ _ _ _ _ _ _
e
z o n d i g it
/

Zone: 1 1 The 11 in the first two digits of the zone indicates an upper-case letter or a number.
The last two digits of the zone represent the group or range:
code range
00 A-I
01 J-R
10 S-Z
11 numbers

digit: __ __ __ __
23 22 21 20
8 4 2 1

Using the binary powers of 2, we can determine a value for each bit within the digit portion of the code. For example,
since A is the first character in its group (A - I), we would use the digit portion of the code to indicate a 1. Since B is the
second character in the group A - I, we would use the digit portion of the code to indicate a binary equivalent of a 2.
Since C is the third character in the group A - I, we would use the digit portion of the code to indicate the binary
equivalent of a 3.

Examples:
1. If we want to represent the letter F, we will first determine the digit portion of the code. We first determine that
it is the 6th letter within the range (range A - I). Now we have to figure out how to express 6 in binary. We find
that by turning on (putting a 1) over the positional value of 4 (22) and turning on (putting a 1) over the positional
value of 2 (21) we have the equivalent of 6 (4 + 2 = 6). We do not need the 8 (23) or the 1 (20) so we put a 0 in
these positions.

0 1 1 0
23 22 21 20
8 4 2 1
2. Note: 4 and 2 turned on and 4 + 2 = 6

Looking at the zone portion, we know that F is upper case so we put a 11 in the first two characters of the zone.
7
We also know that it is in the range A - I and we know that the range A - I calls for entering 00 in the last two
characters of the zone. This gives us a zone of: 1 1 0 0
Combining the zone portion of 1 1 0 0 and the digit portion of 0 1 1 0 we find that the EBCDIC code for the letter
F is 1 1 0 0 0 1 1 0.

3. The character M: M is the 4th letter in the range J Ð P

The zone is: 1 1 for upper case followed by 0 1 for the range J - R.

The digit is: since M is the 4th letter in the range, the position with the value of 4 is turned on by placing a 1
there and the other positions are turned off by using 0.

0 1 0 0
23 22 21 20
8 4 2 1
4. The EBCDIC code for the character M is: 1 1 0 1 0 1 0 0

5. The number 9: 9 is the 9th number in the number group

The zone is: 1 1 for upper case letter or number followed by 1 1 for the numbers range.

The digit is: since 9 is the 9th number in the range, we need to find a way to represent a 9. Turning on the 8 and
the 1 will accomplish this, so a 1 is placed in these two positions. This means the positions with a value of 4 and
2 are not used, so a 0 is placed in these positions.

1 0 0 1
23 22 21 20
8 4 2 1
6. The EBCDIC code for the number 9 is: 1 1 1 1 1 0 0 1

7. The letter S: There are only 8 characters in the range S - Z, so S is considered the second character in the range
while Z is the 9th (in other words, there is no first character in the range S - Z).

The zone is: 1 1 for upper case followed by 1 0 for the range S - Z.

The digit is: Since S is considered the second letter in the range, we need to represent the number 2 by turning
on (putting a 1) in the position with a value of 2 and 0 in all other positions.

0 0 1 0
23 22 21 20
8 4 2 1
8. The EBCDIC code for the letter S is: 1 1 1 0 0 0 1 0

Hexadecimal translation of EBCDIC:


Instead of dealing with the 8-bit binary code when looking at memory dumps etc., the programmer usually deals with
the hexadecimal translation of EBCDIC. One hexadecimal character is used to translate the 4-bit digit portion of the
EBCDIC. Hexadecimal is used to represent EBCDIC because of their unique relationship: any 4-bit binary number can be
represented by a single hexadecimal character and any hexadecimal character can be represented by 4 binary bits.

8
Binary Hexadecimal
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F

Examples:
1. F = 11000110 1100 0110 in EBCDIC
hexadecimal translation of
C 6
EBCDIC
M=
2. 1101 0100 in EBCDIC
11010100
hexadecimal translation of
D 4
EBCDIC
3. 9 = 11111001 1111 1001 in EBCDIC
hexadecimal translation of
F 9
EBCDIC
4. S = 11100010 1110 0010 in EBCDIC
hexadecimal translation of
E 2
EBCDIC

Looking at all of the upper-case letters and the numbers or digits from 0 to 9, it can be seen that there is a pattern. For
example, any character in the range A - I has a zone of 1100 which can be represented by hexadecimal C. This means
that if we are looking at a dump, etc., we know that any hexadecimal translation of EBCDIC that has a C is in the range A
- I.

Characters EBCDIC Zone Hexadecimal representation


A -I 1100 C
J-R 1101 D
S-Z 1110 E
numbers 1111 F

Decimal Equivalents of EBCDIC:


Another way of representing EBCDIC is using the decimal equivalent of the entire 8-bit code binary code:
A= 1 1 0 0 0 0 0 1 Face value
27 26 25 24 23 22 21 20 Powers of 2

9
128 64 32 16 8 4 2 1 Positional value from appropriate power of 2

Therefore, A = 128 + 64 + 1 = 193.

EBCDIC equivalents:
Character EBCDIC Equivalent Character EBCDIC Equivalent
A 193 N 213
B 194 O 214
C 195 P 215
D 196 Q 216
E 197 R 217
F 198 S 226
G 199 T 227
H 200 U 228
I 201 V 229
J 209 W 230
K 210 X 231
L 211 Y 232
M 212 Z 233

2. ASCII (AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE):


Most PCs can handle ASCII files and so if you store a file in ASCII it is usually transportable from system to system. There
is a standard 7-bit ASCII code that has characters whose binary code translates into the decimal numbers from 0 to 127.
In this set, codes 0 through 32 are control codes that handle things like form feed and carriage control while codes 33
through 127 are a set of printable characters. For example, codes 65 through 90 represent uppercase letters and codes
48 through 57 represent the digits 0 through 9. However, most computers handle 8-bit codes so it is possible to
generate 128 additional ASCII codes, which are called the extended ASCII character set. These codes are not
standardized and are sued differently by different computer manufacturers. When representing the standard 7-bit ASCII
codes as 8-bit codes, a leading 0 is added as the left-most character. When dealing with ASCII code, the left most bits will
tell us the type of character being represented and the right bits will indicate which one in the range. For example, 011
in the left most three bits of the standard 7-bit code indicates a number with 0 having 0000 standing for 1 and 1001
standing for 9. Notice the use of the positional value of the bits to indicate which number is being represented.
__ __ __ __
23 22 21 20
8 4 2 1

The number 0 uses 4 0s in this configuration to represent a decimal value of 0.


0 0 0 0
23 22 21 20
8 4 2 1

The number 0 in 7 bit ASCII is 0110000.

10
The number 9 uses a 1 in the bit with a positional value of 8 and a 1 in the bit with a positional value of 1 with a 0 in the
bits with positional values of 4 and 2. Therefore you have 8 + 1 turned on for a value of 9.
1 0 0 1
23 22 21 20
8 4 2 1

The number 9 in 7-bit ASCII is 0111001.

The bits 1 0 in the left most bits of the standard 7-bit code indicate an upper-case letter with the last 5 bits specifying the
exact letter. Since there are 26 upper case letters in the alphabet, 5 bits are needed to tell which one is being
represented.
__ __ __ __ __ face value
positional value in powers
24 23 22 21 20
of 2
16 8 4 2 1 positional value in decimal

Using these five positions, numbers from 1 to 26 can be represented standing for the letters A Ð Z.

The letter A only turns on the positional value of 1 since it is the first letter in the alphabet.
__ __ __ __ 1 face value
positional value in powers
24 23 22 21 20
of 2
16 8 4 2 1 positional value in decimal

Combining the 10 indicating an upper-case letter and the 00001 indicating the first letter, the letter A in 7 bit ASCII is
1000001.

The letter L turns on the positional value of 8 and the positional value of 4 to add up to 12 since it is the 12th letter in the
alphabet.
0 1 1 0 0 face value
positional value in powers of
24 23 22 21 20
2
16 8 4 2 1 positional value in decimal

Combining the 10 indicating an upper-case letter and the 01100 indicating the 12th letter, the letter L in 7 bit ASCII is
1001100.

The letter Z turns on the positional value of 16 and the positional value of 8 and the positional value of 2 to add up to 26
since it is the 26th letter of the alphabet.
1 1 0 1 0 face value
positional value in powers of
24 23 22 21 20
2
16 8 4 2 1 positional value in decimal

Combining the 10 indicating an upper case letter and the 11010 indicating the 26th letter, the letter Z in 7 bit ASCII is
1011010.
11
ASCII Equivalent represented in decimal translation of binary code:
When working with ASCII, again it is difficult to deal with the 7 or 8 bit string of binary digits. Therefore, frequently the
code is represented by the decimal equivalent of the binary code for ease of use.
__ __ __ __ __ __ __ face value
positional value in
26 25 24 23 22 21 20
powers of 2
positional value in
64 32 16 8 4 2 1
decimal

To do this the binary code is represented as shown above. If the position is turned on with a 1, the decimal equivalent is
added to the total.

Examples:
The letter L has an equivalent value of 76 as shown:
1 0 0 1 1 0 0 face value
positional value in
26 25 24 23 22 21 20
powers of 2
positional value in
64 32 16 8 4 2 1
decimal

The equivalent value is therefore 64 + 8 + 4 for a total of 76.

The letter Z has an equivalent value of 90 as shown:


1 0 1 1 0 1 0 face value
positional value in
26 25 24 23 22 21 20
powers of 2
positional value in
64 32 16 8 4 2 1
decimal

The equivalent value is therefore 64 + 16 + 8 + 2 for a total of 90.

The chart of ASCII equivalents for the upper-case letters is shown below:
Characte ASCII ASCII
Character
r Equivalent Equivalent
A 65 N 78
B 66 O 79
C 67 P 80
D 68 Q 81
E 69 R 82
F 70 S 83
G 71 T 84
H 72 U 85

12
I 73 V 86
J 74 W 87
K 75 X 88
L 76 Y 89
M 77 Z 90

3. GRAY CODES (or Reflected Binary Codes)


The reflected binary code or Gray code is an ordering of the binary numeral system such that two successive values
differ in only one bit (binary digit). Gray codes are very useful in the normal sequence of binary numbers generated by
the hardware that may cause an error or ambiguity during the transition from one number to the next. So, the Gray
code can eliminate this problem easily since only one bit changes its value during any transition between two numbers.

Gray code is not weighted that means it does not depend on positional value of digit. This cyclic variable code that
means every transition from one value to the next value involves only one-bit change.

Gray code also known as reflected binary code, because the first (n/2) values compare with those of the last (n/2)
values, but in reverse order.

Constructing an n-bit Gray code:

n-bit Gray code can be generated recursively using reflect and prefix method which is explained as following below.

 Generate code for n=1: 0 and 1 code.


 Take previous code in sequence: 0 and 1.
 Add reversed codes in the following list: 0, 1, 1 and 0.
 Now add prefix 0 for original previous code and prefix 1 for new generated code: 00, 01, 11, and 10.

Therefore, Gray code 0 and 1 are for Binary number 0 and 1 respectively. Gray codes: 00. 01, 11, and 10 are for Binary
numbers: 00, 01, 10, and 11 respectively. Similarly you can construct Gray code for 3 bit binary numbers:

Therefore, Gray codes are as following below:

13
For n = 1 bit For n = 2 bit For n = 3 bit
Binary Gray Binary Gray Binary Gray
0 0 00 00 000 000
1 1 01 01 001 001
10 11 010 011
11 10 011 010
100 110
101 111
110 101
111 100
Iterative method of generating G(n+1) from Gn are given below. This is simpler method to contract Gray code of n-bit
Binary numbers. Each bit is inverted if the next higher bit of the input value is set to one. The nth Gray code is obtained
by computing n⊕(floor(n/2)).

 Gn is unique numbers for the permutation from 0 to (2n-1).


 Gn is embedded as the first half of G(n+1) and second half as the reverse order of G(n+1).
 Prefix 0 in each digit of first half and 1 in each digit of second half.

The hamming distance of two neighbours Gray codes is always 1 and also first Gray code and last Gray code also has
Hamming distance is always 1, so it is also called Cyclic codes.

You can construct Gray codes using other methods but they may not be performed in parallel like given above method.
For example, 3 bit Gray codes can be contracted using K-map which is given as following below:

Decimal Binary Gray Code


0 000 000
1 001 001
2 010 011
3 011 010
4 100 110
5 101 111
6 110 101
7 111 100

14

You might also like