Saturday, March 2, 2013

DIGITAL LOGIC

DIGITAL LOGIC

The word logic is used to describe systems whose members are two state. A logic circuit is an electrical circuit with all voltages at one of two values.

Most computer circuitry consists of logic circuits with voltages all at one of two levels called logic 0 and logic 1.

One type of circuitry in widespread use in computers and similar equipment (so-called TTL circuitry) has:

logic 1 = 5 volts (or slightly less)

logic 0 = 0 volts (or slightly more)

A logic gate is a logic circuit with one or more inputs and one output (Fig 1).

Example of a logic gate

DIGITAL LOGIC

Fig1 Example of a logic gate

A logic diagram is a diagram showing logic elements and their interconnections (Fig2).

A number of logic gates and their interconnections may be called a logical network.

Example of a logic diagram

DIGITAL LOGIC  2

Fig 2 Example of a logic diagram

Truth Tables

A truth table is a table which shows the result of logical operations.

Truth tables can be used:

1 To show the outputs of a logic circuit for all possible combinations of the inputs.

2 To show the result of any operations which follow logical rules.

The positions in a truth table are usually filled with Is and Os. Sometimes Ts and Fs are used (for true and false).

Hints for drawing truth tables

Often in questions the framework of a truth table is drawn for you. If it is not make sure you draw the table up correctly.

1 (a) Write clear headings for the columns.

(b) Sometimes it is difficult to work out the output column directly from the input columns.

Don't be afraid to put in an extra column if it will make the truth table easier to work out.

(c) Draw a double line after the input columns so that it is clear which they are.

2 The number of rows down a truth table should be a power of 2 which depends on the number of inputs:

for one input there are two rows

for two inputs there are four rows

for three inputs there are eight rows

3 If the table is to be filled in with Is and Os write the inputs down the page in numerical order. as if you were counting in binary:

e.g. For two inputs 00, 01, 10, 11

and for three inputs 000, 001, 010, 011, 100, 101, 110, 111

(see input columns in the worked questions)

Worked questions on truth tables

1 Show all the inputs for a truth table with one output and

(a) two inputs (b) three inputs.

Answer: (a

Input

Input

Output

A

B

 

0

0

 

0

1

 

1

0

 

1

1

(b

Input

Input

Input

Output

A

B

C

 

0

0

0

 

0

0

1

 

0

1

0

 

0

1

1

 

1

0

0

 

1

0

1

 

1

1

0

 

1

1

1

 

2 Draw a truth table for a device which inputs three-figure binary numbers and outputs a 1 if the binary number is odd or if it is equal to 4 (decimal), outputting 0 for all other numbers.

Answer:

Input digits

Output

Comment

 

 

 

 

Decimal

0

0

0

0

0

0

0

1

1

1 is odd

0

1

0

0

2

0

1

1

1

3 is odd

1

0

0

1

4

1

0

1

1

5 is odd

1

1

0

0

6

1

1

1

1

7 is odd

3 A simple camera will not take pictures either:

(a) When the film is fast and the day is bright (because there is too much light); or

(b) When the film is slow and the day is dull (too little light).

Otherwise it will take pictures successfully. Draw a truth table to show when the camera will take pictures. Head the columns Fast film, Bright day and Picture taken. Insert a 1 if the condition is true and a 0 if it is false

Answer:

Fast

Bright

Picture

film

day

taken

0

0

0

0

1

1

1

0

1

1

1

0

4 An automatic fan in a greenhouse comes on when the air is moist or when the temperature is high. Otherwise the fan is off. In the table, 1 in the 'Moist' column means air is moist and in the 'Hot' column 1 means temperature is high. Complete the table using 1 for on and 0 for off.

answer

Moist

Hot

Fan on

0

0

0

1

1

0

1

1

Moist

Hot

Fan on

0

0

0

0

1

1

1

0

1

1

1

1