+ All Categories
Home > Documents > combinationallogic_tcm4-117994

combinationallogic_tcm4-117994

Date post: 06-Sep-2015
Category:
Upload: nguyenphuonghuy1979
View: 216 times
Download: 1 times
Share this document with a friend
Description:
lecture for digital circuit design
73
COMBINATIONAL LOGIC: EXEMPLAR QUESTIONS AND SOLUTIONS COMBINATIONAL LOGIC Outcome 1 (a) Convert the following decimal numbers into 8- bit binary: (i) 10 (ii) 59 (iii) 120 (iv) 182 (b) Convert the following 8-bit binary numbers to decimal: (i) 10101010 (ii) 11100011 (iii) 00111110 (iv) 10010011 (c) Convert the following hexadecimal numbers to 8-bit binary: (i) F3 (ii) 2A (iii) 68 (iv) 0F (d) Convert the following 8-bit binary numbers to hexadecimal: (i) 00111011 (ii) 11011000 (iii) 01001110 (iv) 10010111 (e) Convert the following decimal numbers into two-digit hexadecimal numbers: (i) 62 (ii) 5 (iii) 251 (iv) 129 ELECTRONIC AND ELECTRICAL FUNDAMENTALS (INT 2) 133 © Learning and Teaching Scotland 2004 ?1
Transcript

Combinational Logic

COMBINATIONAL LOGIC: EXEMPLAR QUESTIONS AND SOLUTIONS

COMBINATIONAL LOGIC: EXEMPLAR QUESTIONS AND SOLUTIONS

COMBINATIONAL LOGIC

Outcome 1

(a)Convert the following decimal numbers into 8-bit binary:

(i) 10(ii) 59(iii) 120(iv) 182

(b)Convert the following 8-bit binary numbers to decimal:

(i) 10101010(ii) 11100011(iii) 00111110(iv) 10010011

(c)Convert the following hexadecimal numbers to 8-bit binary:

(i) F3(ii) 2A(iii) 68(iv) 0F

(d)Convert the following 8-bit binary numbers to hexadecimal:

(i) 00111011(ii) 11011000(iii) 01001110(iv) 10010111

(e)Convert the following decimal numbers into two-digit hexadecimal numbers:

(i) 62(ii) 5(iii) 251(iv) 129

(f)Convert the following hexadecimal numbers into decimal:

(i) BC(ii) F4(iii) 56(iv) AA

Solution

(a)There a number of different ways in which decimal to binary conversion can be done. The quickest and simplest is to use an engineering calculator that lets you convert between bases. Even the windows-based calculator supports base conversion. Given below is an illustration of how this is done using the windows calculator.

Alternatively we can calculate the binary value of a decimal number using the binary weightings for 8 bits as shown below.

Finally we can calculate the result using the divide by 2 technique. Again using 59 as an example:

(i)10 converts to 00001010

(ii)59 converts to 00111011 (see above)

(iii)120 converts to

(iv)182 converts to

(b) (i)

(ii)

(iii)

(iv)

(c)Hexadecimal is number system based on 16 digits compared with decimal, which has 10, and binary, which has 2. The popularity of hexadecimal within the study and use of digital systems is that it provides a shorthand (efficient) method of representing binary patterns. Converting from hexadecimal to binary and binary to hexadecimal is also extremely easy.

The table below shows the relationship between every hexadecimal digit and its 4-bit binary equivalent. Notice that the table is simply a binary count and all that really needs to be remembered are the binary patterns for A, B, C, D, E and F.

B3

B2

B1

B0

Hexadecimal

value

Decimal value

0

0

0

0

0

0

0

0

0

1

1

1

0

0

1

0

2

2

0

0

1

1

3

3

0

1

0

0

4

4

0

1

0

1

5

5

0

1

1

0

6

6

0

1

1

1

7

7

1

0

0

0

8

8

1

0

0

1

9

9

1

0

1

0

A

10

1

0

1

1

B

11

1

1

0

0

C

12

1

1

0

1

D

13

1

1

1

0

E

14

1

1

1

1

F

15

(i)To convert the hexadecimal number F3 simply look at the table and extract the appropriate 4-bit binary pattern.

F = 11113 = 0011

so the binary representation for F3 is 11110011.

(ii)For 2A:

2 = 0010A = 1010

so the binary representation for 2A is 00101010.

(iii)For 68

6 = 01108 = 1000

so the binary representation for 68 is 01101000.

(iv)For 0F

0 = 0000F = 1111

so the binary representation for 0F is 00001111.

(d)The process of converting from binary to hexadecimal is simply a case of reversing the previous process. Divide the binary pattern into groups of four bits and read off the equivalent hexadecimal digit.

In example (i) 00111011is broken into 0011 = 3 and 1011 = B.

The hexadecimal representation of 00111011 is 3B.

(ii)11011000 = 11011000 = D8

(iii)01001110 = 01001110 = 4E

(iv)10010111 = 10010111 = 97

Note: if the binary pattern does not divide into groups of four bits add 0s to the left-hand side, i.e. the MSB side until the pattern does divide.

For example, 11001 only contains five binary digits (bits). If we add three 0s to the left-hand side we do not affect the value but we can now divide the pattern into groups of four bits:

00011001 = 19 in hexadecimal

(e)There are three methods that we can use to convert decimal to hexadecimal.

The simplest of all is to use an engineering calculator that has the facility to convert between bases. Again if we look at the calculator provide in Microsoft Windows we can see how this is done.

The second method is to convert the decimal number into binary and then convert the binary number into hexadecimal. All of this has been demonstrated in the previous examples (a) (d).

The third method involves conversion using a table containing the weighted values of the hexadecimal digits. This is similar to the conversion between binary and decimal.

(ii)Convert the decimal number 5 into hexadecimal.

(iii)Convert decimal number 251 into hexadecimal.

(iv)Convert the decimal number 129 to hexadecimal.

(f) (i)Convert the hexadecimal number BC to decimal.

(ii)Convert the hexadecimal number F4 to decimal.

(iii)Convert the hexadecimal number 56 to decimal.

(iv)Convert the hexadecimal number AA to decimal.

(a)Perform the following additions in 8-bit binary. Convert back to decimal to check your answer.

(b)Perform the following subtractions in binary. Convert back to decimal to check your answer.

Solution

(a)The decimal numbers in this question have already been converted to binary in SAQ 1.

The rules applied to binary addition are identical to those applied to decimal except that we must always remind ourselves that we are working in binary.

(i)

(ii)

(iii)

(iv)

(b)The decimal numbers in this question have already been converted to binary in SAQ 1.

The rules applied to binary subtraction are identical to those applied to decimal except that we must always remind ourselves that we are working in binary.

(i)

(ii)

(iii)

(iv)

(a)Represent the following numbers as 2s complement 8-bit binary numbers:

(i) 10(ii) 10(iii) 59(iv) 59

(v) 120(vi) 120

(b)Explain why the decimal numbers 182 and 182 cannot be represented using 8-bit 2s complement representation.

(c)Perform the following calculations using 8-bit 2s complement binary representation:

Solution

(a)2s complement is a binary method of representing negative numbers. In 2s complement representation the MSB is used as a sign bit with 1 indicating a negative number and 0 representing a positive number.

We will use (i) to illustrate the 2s complement system.

(i)To represent 10 simply write down the binary value for 10:

We then invert all the bits:

Then we add 1 to this value:

The answer is the 2s complement representation of 10:

It is difficult to tell the value of this 8-bit 2s complement number simply by looking at it. To check the value of a negative number simply repeat the previous operations, i.e. invert all bits and add 1:

(ii)

Notice that there is no difference in representation, i.e. this looks like a standard 8-bit binary representation of 10.

(iii)

(iv)

(v)

(vi)

(b)If we use 8-bit 2s complement representation then the sign bit effectively reduces the size of the number to 7 bits. In 2s complement form the range of numbers that can be represented is:

As can be seen, 182 and 182 fall outwith this range and so cannot be represented using 8-bit 2s complement.

(c) (i)

(ii)

(iii)

(iv)

Outcome 2

(a)Identify the ANSI standard logic symbols shown and complete the truth tables in Fig SAQ 1 (i).

Fig SAQ 1(i)

(b)Draw the British Standard symbols for the logic gates shown Fig SAQ 1(i).

(c)Write down the Boolean expression for each of the gates shown in Fig SAQ 1(i).

Solution

(a)

(b)

For the ANSI logic gates given in Fig SAQ 2:

(a)write down the logic expression

(b)write down the logic output for the inputs shown.

Fig SAQ 2

For the BS logic gates given in Fig SAQ 3:

(a)write down the logic expression

(b)write down the logic output for the inputs shown.

Fig SAQ 3

Solution

(a), (b)

Solution

(a), (b)

Outcome 3

(a)For the circuit shown in Fig SAQ 1(i) write down the Boolean expression for X.

(b)Using the integrated circuit diagram sheet identify the Integrated Circuits used in this circuit and place appropriate pin numbers beside the gates.

(c)Complete the truth table in Fig SAQ 1(ii).

Fig SAQ 1(i)

Fig SAQ 1(ii)

Solution

(a), (b)

Fig SAQ 1(i)

(c)

Fig SAQ 1(ii)

(a)For the circuit shown in Fig SAQ 2(i) write down the Boolean expression for X.

(b)Using the integrated circuit diagram sheet identify the ICs used in this circuit and place appropriate pin numbers beside the gates.

(c)Complete the truth table in Fig SAQ 1(ii).

Fig SAQ 2(i)

Fig SAQ 2(ii)

Solution

(a), (b)

(c)

For the following Boolean expressions:

(i)

(ii)

(a)draw the logic circuit using ANSI symbols (your diagram should show the ICs selected and the appropriate pin connections)

(b)hence, or otherwise, complete the truth tables given in Fig SAQ 3.

Fig SAQ 3

Solution

(i)Working from the output backwards:

(ii)

(b)

The truth table for a two-input logic circuit is shown in Fig SAQ 4.

(a)From the truth table derive the Boolean expression that describes this table.

(b)Using ANSI symbols draw the logic circuit that meets the requirements of this table. Your schematic should clearly show ICs used and pin numbers.

Fig SAQ 4

Solution

In this problem you are trying to generate a circuit from a truth table. To do this consider each input combination that provides a logic 1 output and work out how this could be achieved using an AND gate. These combinations are indicated by arrows in the diagram below.

To illustrate consider the first combination, A = 0 and B = 0. In order to generate a logic 1 at the output an AND gate needs all its inputs to be logic 1 therefore we need to invert A and B:

If we follow this argument for the second combination, A = 0 and B = 1, we need to invert A only to obtain a 1 from the AND gate output:

The final step is to combine all the AND combinations into an OR gate. Recall that the OR gate will generate a logic 1 output when either of its inputs are logic, which is exactly what is needed for this circuit.

The truth table for a three-input logic circuit is shown in Fig SAQ 5.

(a)From the truth table derive the Boolean expression that describes this table.

(b)Using ANSI symbols draw the logic circuit that meets the requirements of this table. Your schematic should clearly show ICs used and pin numbers.

Fig SAQ 5

Solution

The only difference between this problem and SAQ 4 is the number of inputs. The way in which we solve the problem is identical.

Identify the input combinations that give a logic 1 output and work out how a logic 1 could be achieved using an AND gate:

The first combination is ABC = 001. As we have three inputs we will require a three-input AND gate. To obtain a logic 1 output for this combination we need to invert A and B:

The second combination is ABC = 100. To obtain a logic 1 output for this combination we need to invert B and C:

As before the final step is to combine all the AND combinations into an OR gate. Recall that the OR gate will generate a logic 1 output when either of its inputs are logic 1:

Outcome 4

A simple logic control system for a central heating system has the following inputs:

timer clock (C)0 = outwith time period for central heating to be on

1 = within time period for central heating to be on

room thermostat (T)0 = room temperature above the set value

1 = room temperature below set value

frost protection (F)0 = room temperature above 4C

1 = room temperature below 4C

When the output from the control system = 1 then the boiler will be ignited, allowing the system to produce heat. The frost protection will override the timer clock and the room thermostat should the temperature fall below 4C.

Design the logic control system to meet the above requirements. Your design should include the following:

truth table

Boolean logic expression

logic diagram using ANSI symbols (this diagram must include IC identification and pin numbering).

Solution

This outcome advances the combinational design processes one step further. In this outcome we are given a specification for a digital system and from that a practical circuit must be designed.

The first step in this process is to generate a truth table. This problem has three inputs, C, T and F, therefore we need a three-input truth table. Each input condition must be carefully considered before placing a 1 or 0 in the output column.

C

T

F

OUT

0

0

0

0

Output will be 0 as frost setting is above 4 and timer outwith ON period.

0

0

1

1

Output will be 1 as the frost setting is indicating that the temperature is below 4. This overrides everything else.

0

1

0

0

Output will be 0 as the frost setting is above 4 and timer outwith ON period. Note it doesnt matter that the temperature in the house is below the required value.

0

1

1

1

Output will be 1 as the frost setting is indicating that the temperature is below 4. This overrides everything else.

1

0

0

0

Although we are within the ON period the temperature is above the frost setting and the set value so the central heating should be OFF and the output at 0.

1

0

1

1

Output will be 1 as the frost setting is indicating that the temperature is below 4. This overrides everything else.

1

1

0

1

Output will be at 1 as we are in the ON period and the temperature is below the set value.

1

1

1

1

Output will be 1 as the frost setting is indicating that the temperature is below 4. This overrides everything else.

The remaining steps are identical to those carried out in Outcome 3, i.e. generate an AND expression for each OUT = 1 condition and then OR all of these AND expression together:

The control logic for a simple alarm system in a house has three inputs and a single output, which activates an alarm. The three inputs are:

windows sensor

doors sensor

master key.

The sensors operate as follows:

window sensor (W)0 = all windows closed

1 = a window is open

door sensor (D)0 = all doors closed

1 = a door is opened

master key (K)0 = alarm system is disarmed

1 = alarm system is armed

If the alarm system is disarmed then the logic signals from the sensors are ignored and the alarm will not sound. The alarm is activated by a logic 1 from the output of the control logic.

Design the circuit to meet the requirements of this control logic. Your design should include the following:

truth table

Boolean logic expression

logic diagram using ANSI symbols (this diagram must include IC identification and pin numbering).

Solution

As with the previous example a truth table must be generated and all input permutations carefully considered. The required output and associated reasons are shown below.

W

D

K

OUT

0

0

0

0

Alarm is disarmed so it doesnt matter what the other sensors are outputting, the output will be 0.

0

0

1

0

System is armed but no doors or windows are open therefore the output is 0.

0

1

0

0

Alarm is disarmed so it doesnt matter what the other sensors are outputting, the output will be 0.

0

1

1

1

System is armed and a door is open therefore the output is 1 in order to activate the alarm-driving circuitry.

1

0

0

0

Alarm is disarmed so it doesnt matter what the other sensors are outputting, the output will be 0.

1

0

1

1

System is armed and a window is open therefore the output is 1 in order to activate the alarm-driving circuitry.

1

1

0

0

Alarm is disarmed so it doesnt matter what the other sensors are outputting, the output will be 0.

1

1

1

1

System is armed and a door and a window are open therefore the output is 1 in order to activate the alarm-driving circuitry.

Generate an AND expression for each OUT = 1 condition and then OR all of these AND expressions together to create the Boolean expression that fully describes the requirements of the truth table.

?1

?1

Only 6 binary digits appear as this is all that is required to represent 59 in binary, however to convert to an 8-bit representation just add two zeros, i.e. 00111011

Binary weighting expressed as power of 2

MSB

MSB

LSB

LSB

LSB

MSB

Binary weighting expressed as power of 2

Binary weighting expressed as power of 2

Binary weighting expressed as power of 2

Binary weighting expressed as power of 2

Hexadecimal digit position

Hexadecimal digit weighting

?2

?2

2 cannot be subtracted from 0 therefore a 1 is borrowed from the next column. This upper digit is now 2

1 1 = 0

3 2 = 1

2 1 = 1

?3

?3

If a carry is generated into the ninth bit simply ignore; the 8-bit answer will be correct

?1

?1

?2

?3

?2

?3

?1

?1

?2

?2

?3

?3

?4

?4

?5

?5

?1

?1

?2

?2

ELECTRONIC AND ELECTRICAL FUNDAMENTALS (INT 2)133

Learning and Teaching Scotland 2004

ELECTRONIC AND ELECTRICAL FUNDAMENTALS (INT 2)148

Learning and Teaching Scotland 2004