Top Banner
DIGITAL ELECTRONICS The term digital is derived from the Wily computers perform operations, by counting digits. For many years, applications of digital electronics were confined to computer systems. Today, digital technology is applied in a wide range of areas in addition to computers. Such applications as television, communications systems, radar, navigation and guidance systems, military systems, medical instrumentation, industrial process control and consumer electronics use digital techniques Over the years digital technology has progressed from vacuum-tube circuits to discrete transistors to complex integrated circuits, some of which contain millions of transistors. ANALOG : An analog quantity is one having continuous values. Most things that can be measured quantitatively occur in nature in analog form. For example, the air temperature changes over a continuous range of values. During a given day, the temperature does not go from, say, 70° to 71 ° instantaneously; it takes on all the infinite values in between. If you graphed the temperature on a typical summer day. Other examples of analog quantities are time, pressure, distance, and sound. DIGITAL: A digital quantity is one having a discrete set of values. The Digital Advantage Digital representation has certain advantages over analog representation in electronics applications. For one thing, digital data can be processed and transmitted more efficiently and reliably than, analog data. Also, digital data has a great advantage when storage is necessary. For example, music when converted to digital form can be stored more compactly and reproduced with greater accuracy and clarity than is possible when it is in analog form. Noise (unwanted voltage fluctuations) does not affect digital data nearly as much as it does analog signals. ANALOG REPRESENTATION In analog representation a quantity is represented by a voltage, current, or meter movement that is proportional to the value of that quantity. Analog quantities such as those cited above have an important characteristic: they can vary over a continuous range of values.
21
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Digital Electronics Notes

DIGITAL ELECTRONICS

The term digital is derived from the Wily computers perform operations, by counting

digits. For many years, applications of digital electronics were confined to computer

systems.

Today, digital technology is applied in a wide range of areas in addition to computers.

Such applications as television, communications systems, radar, navigation and

guidance systems, military systems, medical instrumentation, industrial process control

and consumer electronics use digital techniques Over the years digital technology has

progressed from vacuum-tube circuits to discrete transistors to complex integrated

circuits, some of which contain millions of transistors.

ANALOG :

An analog quantity is one having continuous values.

Most things that can be measured quantitatively occur in nature in analog form. For example, the air temperature changes over a continuous range of values. During a given day, the temperature does not go from, say, 70° to 71 ° instantaneously; it takes on all the infinite values in between. If you graphed the temperature on a typical summer day. Other examples of analog quantities are time, pressure, distance, and sound.

DIGITAL:

A digital quantity is one having a discrete set of values.

The Digital Advantage Digital representation has certain advantages over analog representation in electronics applications. For one thing, digital data can be processed and transmitted more efficiently and reliably than, analog data. Also, digital data has a great advantage when storage is necessary. For example, music when converted to digital form can be stored more compactly and reproduced with greater accuracy and clarity than is possible when it is in analog form. Noise (unwanted voltage fluctuations) does not affect digital data nearly as much as it does analog signals.

ANALOG REPRESENTATION In analog representation a quantity is represented by a voltage, current, or meter movement that is proportional to the value of that quantity. Analog quantities such as those cited above have an important characteristic: they can vary over a continuous range of values.

Page 2: Digital Electronics Notes

DIGITAL REPRESENTATION

In digital representation the quantities are represented not by proportional quantities but by symbols called digits. As an example, consider the digital watch, which provides the time of day in the form of decimal digits which represent hours and minutes (and sometimes seconds). As we know, the time of day changes continuously, but the digital watch reading does not change continuously; rather, it changes in steps of one per minute (or per second). In other words, this digital representation of the time of day changes in discrete steps, as compared with the representation of time provided by an analog watch, where the dial reading changes continuously.

The major difference between analog and digital quantities, then, can be simply stated as follows:

Analog = continuous Digital = discrete (step by step)

ADVANTAGES AND LIMITATIONS OF DIGITAL TECHNIQUES

Advantages: Easier to design. Exact values of voltage or current are not important, only the

range (HIGH or LOW) in which they fall.

Information storage is easy.

Accuracy and precision are greater.

Operation can be programmed. Analog systems can also be programmed, but the

variety and complexity of the available operations is severely limited.

Digital circuits are less affected by noise. As long as the noise is not large enough

to prevent us from distinguishing a HIGH from a LOW.

More digital circuitry can be fabricated on IC chips.

Limitations:

There is really only one major drawback when using digital techniques:

The real world is mainly analog.

Most physical quantities are analog in nature, and it is these quantities that are

often the inputs and outputs that are being monitored, operated on, and

controlled by a system.

Page 3: Digital Electronics Notes

To take advantage of digital techniques when dealing with analog inputs and outputs,

three steps must be followed:

1. Convert the real-world analog inputs to digital form. (ADC)

2. Process (operate on) the digital information.

3. Convert the digital outputs back to real-world analog form. (DAC)

Figure: The process of converting analog sound to digital and then back to analog

Digital electronics involves circuits and systems in which there are only two possible states. These states are represented by two different voltage levels: A HIGH and a LOW. The two states can also be represented by Current levels, bits and bumps on a CD or DVD, etc. In digital systems such a computers, combinations of the two states, called codes, are used to represent numbers, symbols, alphabetic characters, and other types of information.

Page 4: Digital Electronics Notes

NUMBER SYSTEMS Introduction: Inside today’s computers, data is represented as 1’s and 0’s. These 1’s and 0’s might be stored magnetically on a disk, or as a state in a transistor, core, or vacuum tube. To perform useful operations on these 1’s and 0’s had to organize them together into patterns that make up codes. Modern digital systems do not represent numeric values using the decimal system. Instead, they typically use a binary or two’s complement numbering system. To understand the digital system arithmetic, one must understand how digital systems represent numbers. The English mathematician George Boole (1815-1864) sought to give symbolic form to Aristotle‘s system of logic. Boole wrote a treatise on the subject in 1854, titled an Investigation of the Laws of Thought, on which are Founded the Mathematical Theories of Logic and Probabilities, which codified several rules of relationship between mathematical quantities limited to one of two possible values: true or false, 1 or 0. His mathematical system became known as Boolean algebra. Many number systems are in use in digital technology. The most common are the

decimal, binary, octal, and hexadecimal systems. The decimal system is clearly the most

familiar to us because it is a tool that we use every day.

In conventional arithmetic, a number system based on ten units (0 to 9) is used. However, arithmetic and logic circuits used in computers and other digital systems operate with only 0’s and 1’s because it is very difficult to design circuits that require ten distinct states. The number system with the basic symbols 0 and 1 is called binary. Although digital systems use binary numbers for their internal operations, communication with the external world has to be done in decimal systems. In order to simplify the communication, every decimal number may be represented by a unique sequence of binary digits; this is known as binary encoding. In this chapter we discuss number systems in general and the binary system in particular. In addition, we consider the octal and hexadecimal number systems and fixed and floating-point representation of numbers. The chapter ends with a discussion on weighted and non weighted binary encoding of decimal digits.

Modern computers do not work with decimal numbers. Instead of, they process binary

numbers, groups of 0’s and 1’s.

Page 5: Digital Electronics Notes

Why binary numbers?

Because electronic devices are most reliable when designed for two – states (Binary)

operation either on or off. People do not like working with binary numbers because

they are very long. Entering binary numbers into computer becomes tedious. Therefore

octal and hexadecimal numbers are widely used to compress long strings of binary

numbers.

In general, in any number system there is an ordered set of symbols known as digits

with rules defined for performing arithmetic operations like addition, subtraction,

multiplication and division. A collection of these digits makes a number which in

general has two parts – integer and fractional, set a part by a radix point (. ), that is

Examining some of its characteristics will help us to better understand the other

systems. In the next few pages we shall introduce four numerical representation

systems that are used in the digital system. There are other systems, which we will look

at briefly.

Decimal

Binary

Octal

Hexadecimal

Decimal System

The invention of decimal number systems has been the most important factor in the development of science and technology. The term decimal comes from the Latin word for “ten.” The decimal number system uses positional number representation, which means that the value of each digit is determined by its position in a number. The base (also called radix) of a number system is the number of symbols that the system contains. The decimal system has ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9; in other words it has a base of 10. Each position in the decimal system is 10 times more significant than the previous position. The decimal system is composed of 10 numerals or symbols. These 10 symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Using these symbols as digits of a number, we can express any quantity. The decimal system is also called the base - 10 system because it has 10 digits.

Page 6: Digital Electronics Notes

People have been using the decimal (base 10) numbering system for so long that they probably take it for granted. When one sees a number like “123”, he doesn’t think about the value 123; rather, he generates a mental image of how many items this value represents. In reality, however, the number 123 represents:

1*102 + 2*101 + 3*100 (Or)

100 + 20 + 3 Each digit appearing to the left of the decimal point represents a value between zero and nine times an increasing power of ten. Digits appearing to the right of the decimal point represent a value between zero and nine times an increasing negative power of ten. For example, the value 215.123 means:

2*102 + 1*101 + 5*100 + 1*10–1 + 2*10–2 + 3*10–3 (Or)

200 + 10 + 5 + 0.1 + 0.02 + 0.003 BINARY NUMBER SYSTEM Digital computers use the binary number system, which has only two symbols: 0 and 1. The numbers in binary system are represented as combinations of these two symbols. The decimal system uses power of 10 and binary system uses powers of 2. In the binary system, there are only two symbols or possible digit values, 0 and 1. This base-2 system can be used to represent any quantity that can be represented in decimal or other base system.

23 22 21 20 2-1 2-2 2-3

= 8 = 4 = 2 = 1 . = 0.5 = 0.25 = 0.125

Most Significant Digit (Bit)

Binary Point

Least Significant Digit (Bit)

The binary numbers has a radix of 2. As r ¼ 2, only two digits are needed, and these are 0 and 1. A binary digit, 0 or 1, is called a bit. Like the decimal system, binary is a positional system, except that each bit position corresponds to a power of 2 instead of a power of 10. In digital systems, the binary number system and other number systems closely related to it are used almost exclusively. However, people are accustomed to using the decimal number system; hence digital systems must often provide conversion between decimal

Page 7: Digital Electronics Notes

and binary numbers. The decimal value of a binary number can be formed by multiplying each power of 2 by either 1 or 0, and adding the values together. Binary Counting The Binary counting sequence is shown in the table:

The binary digit is also referred to as Bit (the acronym for Binary Digit). A string of 4 bits is called a nibble and a string of 8 bits is called a byte. A byte is the basic unit of data in computers. The number 125 actually means 1* 102 + 2* 101 +5*100 . In binary system, the same number (125) is represented as 1111101 meaning 1*26 +1* 25 +1* 24 +1*23 +1* 22 +0* 21 +1*2 0 The table (1) lists the first 20 binary numbers.

Page 8: Digital Electronics Notes

Table (1): First 20 Binary Numbers

To express the value of a binary number, therefore, a n-1 2n-1 + a n-2 2n-2 + ……. + a 0 is expressed as a n-1, a n-2 ….. a 0 where ai is either 1 or 0 and n is the number of digits to the left of the binary (radix) point. OCTAL NUMBER SYSTEM Digital systems operate only on binary numbers. Since binary numbers are often very long, two shorthand notations, octal and hexadecimal, are used for representing large binary numbers. The octal number system uses a base or radix of 8; thus it has digits from 0 to r - 1, or 8 - 1, or 7. As in the decimal and binary systems, the positional value of each digit in a sequence of numbers is definitely fixed. Each position in an octal number is a power of 8, and each position is 8 times more significant than the previous position. The octal number system has a base of eight, meaning that it has eight possible digits: 0,1,2,3,4,5,6,7.

The octal number system has a base, or radix as 8: eight different symbols are used to represent numbers. These are commonly 0,1,2,3,4,5,6,7. We show the first 20 octal numbers and their decimal equivalents in the table (2).

Page 9: Digital Electronics Notes

Table (2) : First 20 Octal Numbers

To convert an octal number to a decimal number, we use the same sort of polynomial as was used in the binary case, except that we now have a radix of 8 instead of 2. Therefore 1213 in octal is =1*83+2*82+1*81+3*80 =512 + 128 + 8 + 3 =651 in decimal. Also, 1.123 in octal is 1*80+1*8-1+2*8-2+3*8-3 =1.83/512 in decimal. HEXADECIMAL NUMBER SYSTEM The hexadecimal system uses base 16. Thus, it has 16 possible digit symbols. It uses the digits 0 through 9 plus the letters A, B, C, D, E, and F as the 16 digit symbols.

When the machine is handling numbers in binary but in groups of four digits, it is convenient to have a code for representing each of these sets of four digits. Since 16 possible different numbers can be represented, the digits 0 through 9 will not suffice. So the letters A, B, C, D, E and F are also used. Hexadecimal numbers are strings of these digits. The numbers in decimal, binary and hexadecimal is shown in the table (3).

Page 10: Digital Electronics Notes

Table (3) : First 16 Hexadecimal Numbers The base or radix of a number system is defined as the number of different digits, which can occur in each position in the number system. The decimal number system has a base, or radix of 10. Thus the system has 10 different digits (0,1,2, …,9), any one of which may be used in each position in a number. HEXADECIMAL NUMBERING SYSTEM The hexadecimal numbering system is the most common system seen today in representing raw computer data. This is because it is very convenient to represent groups of 4 bits. Consequently, one byte (8 bits) can be represented by two groups of four bits easily in hexadecimal.

Page 11: Digital Electronics Notes

Hexadecimal uses a base 16 numbering system. This means that we have 16 symbols to use for digits. Consequently, we must invent new digits beyond 9. The digits used in hex are the letters A, B, C, D, E, and F. If we start counting, we get the table below:

Data Organization In pure mathematics a value may take an arbitrary number of bits. Digital systems, on the other hand, generally work with some specific number of bits. Common collections are single bits, groups of four bits (called nibbles), groups of eight bits (called bytes), groups of 16 bits (called words), and more. The sizes are not arbitrary. There is a good reason for these particular values. To begin with, a single place or position in a binary number is called a bit, short for binary digit. For example, the binary number 01102 is made up of four bits. The rightmost bit, the one that represents the ones place, is called the Least Significant Bit or LSB. The leftmost bit, the one that represents the highest power of two for that number, is called the Most Significant Bit or MSB. Note that the MSB represents a bit position. It doesn't mean that a '1' must exist in that position.

Page 12: Digital Electronics Notes

The next four terms describe how bits might be grouped together. • Nibble – A four bit binary number • Byte – A unit of storage for a single character, typically an eight bit (2 nibble) binary number (short for binary term) • Word – Typically a sixteen bit (2 byte) binary number • Double Word – A thirty-two bit (2 word) binary number The following are some examples of each type of binary number. Bit 12 Nibble 10102 Byte 101001012 Word 10100101111100002 Double Word 101001011111000011001110111011012 Bits The smallest “unit” of data on a binary computer or digital system is a single bit. Bit, an abbreviation for Binary Digit, can hold either a 0 or a 1. A bit is the smallest unit of information a computer can understand. Since a single bit is capable of representing only two different values (typically zero or one) one may get the impression that there are a very small number of items one can represent with a single bit. That’s not true! There are an infinite number of items one can represent with a single bit. With a single bit, one can represent any two distinct items. Examples include zero or one, true or false, on or off, male or female, and right or wrong. However, one are not limited to representing binary data types (that is, those objects which have only two distinct values). One could use a single bit to represent the numbers 321 and 1234. Or perhaps 6251 and 2. One could also use a single bit to represent the colours green and blue. One could even represent two unrelated objects with a single bit. For example, one could represent the colour red and the number 3256 with a single bit. One can represent any two different values with a single bit. However, one can represent only two different values with a single bit. To confuse things even more, different bits can represent different things. For example, one bit might be used to represent the values zero and one, while an adjacent bit might be used to represent the values true and false. How can one tell by looking at the bits? The answer, of course, is that one can’t. But this illustrates the whole idea behind computer data structures: data is what one define it to be. If one uses a bit to represent a boolean (true/false) value then that bit (by definition) represents true or false. For the bit to have any true meaning, one must be consistent. That is, if one is using a bit to represent true or false at one point in his program, he shouldn’t use the true/false value stored in that bit to represent green or blue later.

Page 13: Digital Electronics Notes

Since most items one will be trying to model require more than two different values, single bit values aren’t the most popular data type used. However, since everything else consists of groups of bits, bits will play an important role in programs. Of course, there are several data types that require two distinct values, so it would seem that bits are important by themselves. However, individual bits are difficult to manipulate, so other data types are often used to represent boolean values. Nibbles A nibble is a collection of four bits. It wouldn’t be a particularly interesting data structure except for two items: BCD (binary coded decimal) numbers and hexadecimal numbers. It takes four bits to represent a single BCD or hexadecimal digit. With a nibble, one can represent up to 16 distinct values. In the case of hexadecimal numbers, the values 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F are represented with four bits (see “The Hexadecimal Numbering System”). BCD uses ten different digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) and requires four bits. In fact, any sixteen distinct values can be represented with a nibble, but hexadecimal and BCD digits are the primary items we can represent with a single nibble. Bytes Computer memory must be able to store letters, numbers, and symbols. A single bit by itself cannot be of much use. Bits are combined to represent some meaningful data. A group of eight bits is called a byte. It can represent a character and is the smallest addressable datum (data item) on the most of the digital systems (e.g. 80 × 86 microprocessor). The most important data type is the byte. Main memory and input/output addresses on the 80 × 86 are all byte addresses. This means that the smallest item that can be individually accessed by an 80 × 86 program is an eight-bit value. To access anything smaller requires that you read the byte containing the data and mask out the unwanted bits. The bits in a byte are normally numbered from zero to seven using the convention in Fig. 1.1. Bit 0 is the low order bit or least significant bit, bit 7 is the high order bit or most significant bit of the byte. All other bits are referred by their number.

Fig. 1.1 Bit numbering in a byte

Note: That a byte also contains exactly two nibbles (see Fig. 1.2).

Fig. 1.2 The two nibbles in a byte

Page 14: Digital Electronics Notes

Bits 0–3 comprise the low order nibble, bits 4–7 form the high order nibble. Since a byte contains exactly two nibbles, byte values require two hexadecimal digits. Since a byte contains eight bits, it can represent 28, or 256, different values. Generally, a byte is used to represent numeric values in the range 0.255, signed numbers in the range –128.. + 127 (refer “Signed binary representation”). Many data types have fewer than 256 items so eight bits is usually sufficient. For a byte addressable machine, it turns out to be more efficient to manipulate a whole byte than an individual bit or nibble. For this reason, most programmers use a whole byte to represent data types that require no more than 256 items, even if fewer than eight bits would suffice. For example, we’ll often represent the boolean values true and false by 000000012 and 000000002 (respectively). Probably the most important use for a byte is holding a character code. Characters typed at the keyboard, displayed on the screen, and printed on the printer all have numeric values. Words A word is a group of 16 bits. Bits in a word are numbered starting from zero on up to fifteen. The bit numbering appears in Fig. 1.3.

Fig. 1.3 Bit numbers in a word

Like the byte, bit 0 is the low order bit and bit 15 is the high order bit. When referencing the other bits in a word use their bit position number. Notice that a word contains exactly two bytes. Bits 0 through 7 form the low order byte, bits 8 through 15 form the high order byte (see Fig. 1.4).

Fig. 1.4 The two bytes in a word

Page 15: Digital Electronics Notes

Naturally, a word may be further broken down into four nibbles as shown in Fig. 1.5.

Fig. 1.5 Nibbles in a word

Nibble zero is the low order nibble in the word and nibble three is the high order nibble of the word. The other two nibbles are “nibble one” and “nibble two”. With 16 bits, 216 (65,536) different values can be represented. These could be the values in the range 0 to 65,535 (or –32,768 to +32,767) or any other data type with no more than 65,536 values. Words can represent integer values in the range 0 to 65,535 or –32,768 to 32,767. Unsigned numeric values are represented by the binary value corresponding to the bits in the word. Signed numeric values use the two’s complement form for numeric values (refer “Signed binary representation”). Double Words A double word is exactly what its name implies, a pair of words. Therefore, a double word quantity is 32 bits long.

Page 16: Digital Electronics Notes

CONVERSIONS Code Conversion

Converting from one code form to another code form is called code conversion, like converting from binary to decimal or converting from hexadecimal to decimal. Binary-To-Decimal Conversion

Any binary number can be converted to its decimal equivalent simply by summing together the weights of the various positions in the binary number which contain a 1.

and

You should have noticed that the method is to find the weights (i.e., powers of 2) for each bit position that contains a 1, and then to add them up. There are 2 methods:

Reverse of Binary-To-Decimal Method

Repeat Division

Reverse of Binary-To-Decimal Method

Repeat Division-Convert decimal to binary This method uses repeated division by 2. Convert 2510 to binary

Page 17: Digital Electronics Notes

DECIMAL NUMBER TO BINARY NUMBER To convert a decimal number into binary number it requires successive division by 2 writing down each quotient and its remainder. The remainders are taken in the reverse order, which is the binary equivalent of the decimal number. For example, let it is required to convert the decimal number 25 to its binary equivalent.

The binary equivalent for 2510 =110012 To convert decimal fractions into equivalent binary fractions repeatedly double the decimal fraction. The number (0 or 1) that appears on the left is written separately. The bits that are written in this manner are read from top to bottom with a decimal point on the left. For example if the given number is 0.0625, conversion is done in the following manner.

The Multiplication cannot be continued further, as the fractional part in the previous step has already become zero. Therefore, 0.062510 = .00012

DECIMAL NUMBER TO OCTAL NUMBER Conversion from decimal to octal can be performed by repeatedly dividing the decimal number by 8 and using each remainder as a digit in the octal number being formed. For instance, to convert decimal number 200 to an octal representation, we divide as follows.

Therefore (200)10 = (310)8

Page 18: Digital Electronics Notes

DECIMAL NUMBER TO HEXADECIMAL NUMBER One way to convert decimal to Hexadecimal is the hex dabbles. The idea is as divide successively by 16, writing down the remainders. Here is a sample of how it is done. To convert decimal 2429 to hexadecimal,

Therefore (2429)10 = (9AF)16

BINARY NUMBER TO DECIMAL NUMBER For converting the value of Binary numbers to decimal equivalent we have to find its quantity, which is found by multiplying a digit by its place value. The following example illustrates the conversion of binary numbers to decimal system. 101 =1*23-1 +0*23-2+1*23-3 = 1*22 +0*21+1*20 = 4 + 0 +1 = 5 1001 =1*24-1 +0*24-2+0*24-3 + 1*24-4 = 1*23 + 0*22 + 0*21 + 1*20 = 8+1 = 9 11.011 =1*22-1 +1*22-2+0*22-3 +1*22-4+1*22-5 =1*21 +1*20+0*2-1 +1*2-2+1*2-3 = 2+1+1/4+1/8 =3 3/8

BINARY NUMBER TO OCTAL NUMBER There is a simple trick for converting a binary number to an octal number. Simply group the binary digits into groups of 3, starting at the octal point, and read each set of three binary digits.

Octal to Decimal, Decimal to Octal Conversion Converting octal to decimal is just like converting binary to decimal, except instead of powers of 2, we use powers of 8. That is, the LSB is 80, the next is 81, then 82, etc. To convert 172 in octal to decimal: 1 7 2 82 81 80 Weight = 1*82 + 7*81 + 2*80 = 1*64 + 7*8 + 2*1 = 12210

Page 19: Digital Electronics Notes

Converting decimal to octal is just like converting decimal to binary, except instead of dividing by 2, we divide by 8. To convert 122 to octal: 122/8 = 15 remainder 2 15/8 = 1 remainder 7 1/8 = 0 remainder 1 = 1728 If using a calculator to perform the divisions, the result will include a decimal fraction instead of a remainder. The remainder can be obtained by multiplying the decimal fraction by 8. For example, 122/8 = 15.25. Then multiply 0.25 * 8 to get a remainder of 2.

Octal to Binary, Binary to Octal Conversion Octal becomes very useful in converting to binary, because it is quite simple. The conversion can be done by looking at 3 bit combinations, and then concatenating them together. Here is the equivalent for each individual octal digit and binary representation:

each octal digit with the corresponding three binary digits. For example, 372 in octal becomes 010 111 010 or 010111010 in binary. 777 in octal becomes 111 111 111 or 111111111 in binary. The same applies in the other direction: 100111010 in binary becomes 100 111 010 or 472 in octal. Since it is so easy to convert back and forth between octal and binary, octal is sometimes used to represent binary codes. Octal is most useful if the binary code happens to be a multiple of 3 bits long. Sometimes it is quicker to convert decimal to binary by first converting decimal to octal, and then octal to binary.

Page 20: Digital Electronics Notes

Hex to Decimal and Decimal to Hex Conversion Converting hex to decimal is just like converting binary to decimal, except instead of powers of 2, we use powers of 16. That is, the LSB is 160, the next is 161, then 162, etc. To convert 15E in hex to decimal: 1 5 E 162 161 160 Weight = 1*162 + 5*161 + 14*160 = 1*256 + 5*16 + 14*1 = 35010 Converting decimal to hex is just like converting decimal to binary, except instead of dividing by 2, we divide by 16. To convert 350 to hex: 350/16 = 21 remainder 14 = E 21/16 = 1 remainder 5 1/16 = 0 remainder 1 So we get 15E for 350. Again, note that if a calculator is being used, you may multiple the fraction remainder by 16 to produce the remainder. 350/16 = 21.875. Then to get the remainder, 0.875 * 16 = 14.

Hex to Binary and Binary to Hex Conversion Going from hex to binary is similar to the process of converting from octal to binary. One must simply look up or compute the binary pattern of 4 bits for each hex code, and concatenate the codes together. To convert AE to binary: A = 1010 E = 1110 So AE in binary is 1010 1110 The same process applies in reverse by grouping together 4 bits at a time and then look up the hex digit for each group. Binary 11000100101 broken up into groups of 4: 0110 0010 0101 (note the 0 added as padding on the MSB to get up to 4 bits) 6 2 5 = 62516

Page 21: Digital Electronics Notes

Hex to Octal and Octal to Hex Conversion Convert Octal (Hexadecimal) to Binary first. • Regroup the binary number by three bits per group starting from LSB if Octal is required. • Regroup the binary number by four bits per group starting from LSB if Hexadecimal is required. These conversions are done through the binary conversion. Recall that, a group of 4-bits represent a hexadecimal digit and a group of 3-bits represent an octal digit. Hex to Octal Conversion

1. Convert the given hexadecimal number into binary. 2. Starting from right make groups of 3-bits and designate each group an octal digit. Octal to Hex Conversion

1. Convert the given octal number into binary. 2. Starting from right make groups of 4-bits and designate each group as a Hexadecimal digit.