Introduction to Digital Circuits

Review of Digital Circuits

Digital Circuits Lab

HW

Quiz

 

Review of Digital Circuits:

A digital system is one in which the electronic information is encoded in a discrete number of states (typically two: high and low).  Compare this to an analog signal that is made of a continuously variable voltage signal level.  Conversion between analog and digital (A to D) and back (D to A) is often used to couple analog systems (the environment, sensors) with computational systems (MCU, IC’s).  Information on an analog system can be easily represented as a voltage level.  Information in a digital system needs to be represented with an appropriate number system. 

 

Number systems:

Information on a digital system is represented using a combination of on/off or high/low signals; binary signals.  Using this binary representation, numbers can be created using the base 2 number system.  Here, a number is represented as:

N = bn*2n + … + b2*22 + b1*21 + b0*20.

For example, the number 7 can be represented as:

7 = 0*24 + 1*22 + 1*21 + 1*20 = 0111binary

The left-most bit in a binary number is called the most significant digit, while the right-most is called the least significant.  The most significant bit (MSB) carries the largest numerical value; the least significant bit (LSB) carries the smallest. 

 

Each digit in a binary number is stored in a bit.  A set of bits grouped together to form a number is called a byte.  This can be thought of as a word and becomes the basic unit for passing information in a digital system.  Typical byte or word sizes are 8-bit, 16 bit, 32 bit, etc.  Sometimes they are grouped in sets of 4 and this set may be called a nibble.  (Who comes up with these names?).  There are two nibbles in an 8-bit number.  Note that exponentially larger numbers can be passed with larger byte size binary representations.  For example, an 8-bit number can at most represent 256 distinct values.  However, a 16-bit number can represent 65536 distinct values, and so on.  To get this number, simply create a number of all ones and determine its decimal value, or remember that 256 = 28, 65536=218, etc.  (Note that in an 8-bit number, the MSB multiplier is 27.  However, an 8-bit number’s maximum value is 28.  The remaining value comes from the sum of all values below the most significant digit plus one.  Add the one to include representation of zero)

 

Binary arithmetic is similar to base 10 arithmetic, with some additional rules included to handle subtraction and negative numbers.

 

Negative numbers in binary:

Negative numbers in binary are represented with a 1 in the MSB.  Note however that it is up to the program designer to specify whether negative numbers will be used.  In order to determine whether a specific command is intended for a binary system using negative numbers, look for clue words like “negative” or “two’s complement.”  Using negative numbers reduces the available positive value resolution by half with at times little additional gain.  Arithmetic to handle negative numbers is called two’s-complement.  Note: In the decimal system, every number below zero is considered negative.  In binary number systems, every number above the mid-byte value is considered negative.

 

Another common number system that we will see in using the MCU is the hexadecimal system, a base 16 number system.  Digits in base 16 go from 0 to F.  Machine language (for example, our .s19 files) is expressed in hexadecimal.  The table below lists conversions between decimal, binary and hexadecimal systems.

 

Comparing number systems

Decimal

Binary

Hexadecimal

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

10

1010

A

11

1011

B

12

1100

C

13

1101

D

14

1110

E

15

1111

F

16

10000

10

17

10001

11

 

 

Practice: Binary numbers

 

Digital Logic:

With digital systems, we can design circuits to do many things including the following:

 

Using the very basic binary (on/off) number system and relatively simple logic operations discussed below, we can derive a sophisticated computer system.

 

Combinatory logic

Combinatory logic provides a rule set in which binary inputs are combined and produce an output based on a set of standard logic operations: AND, OR, NAND, NOR and XOR.  Any of these logic operations can be handily incorporated into your design circuit using readily available IC’s (integrated circuits) called gates.  The table below presents theses logic operations, their symbol, truth table and typical gate.

 

Gate

Symbol

Operation

Truth table

Typical IC

Buffer

Clean-up signal, improve impedance matching

   A  C

   0   0

   1   1

7400

Inverter

Inverts signal, improves impedance

   A  C

   0   1

   1   0

7400

Schmitt trigger

Buffer to clean-up signal.  Contains hysteresis: on a rising edge, it flips at 3 V, falling about 1.5 V

   A  C

   0   1

   1   0

7400

AND

Output is the AND of the inputs

   A  B   C

   0   0    0

   1   0    0

   0   1    0

   1   1    1

7400

NAND

Inverts the output of the AND

   A  B   C

   0   0    1

   1   0    1

   0   1    0

   1   1    1

7400

OR

Output is the OR of the inputs

   A  B   C

   0   0    0

   1   0    1

   0   1    1

   1   1    1

7400

NOR

Inverts the signal of the OR

   A  B   C

   0   0    1

   1   0    0

   0   1    0

   1   1    0

7400

 

These gates in IC form are created as combinations of transistors, with the internal design available in spec sheets and electronics texts.  The IC’s listed above come in quad, hex, etc. form, containing four, six, etc. gates on each chip. 

 

Example: Consider a security circuit system that should be designed to trigger based on the following logic:

If the system is armed, and if it is dark outside (nighttime), and if the door is opened, then sound an alarm.

A truth table and symbolic circuit to complete this simple task could look like this:

A=Alarm on (1) or off (0), B=light sensor light (1) or dark (0) and C= door sensor open (0) closed (1). 

 


      A      B      C      D

      0       0/1    0/1    0

      1       0       0       0

      1       1       1       0

      1       1       0       1

 

This unit provides the logic component of our simple circuit.  In mechatronics, we need to complete all parts of this circuit, including choosing appropriate sensors, interfacing these sensors with our logic system, and then interfacing the output to appropriate actuators.  In general, sensors are low power output devices, and require high impedance interface.  Similarly, output devices such as actuators require a significant level of power and thus amplifier units in the interface.  Logic signals are low power (typically 1-15 mA).

 

There are two basic technologies used to produce typical IC’s: TTL and CMOS:

 

TTL:  Transistor-transistor-logic devices are designed to run at voltages between 0 and 5 V.  A TTL gate generally defines a low as a voltage less than 0.7 V, and a high as a voltage greater than 2 V.  TTL devices are generally stable, rugged, not very static sensitive and use more power than CMOS devices.  They come in a number of varieties, for example L are reduced power consumption (low power) versions. 

 

CMOS: Complementary metal oxide semiconductor devices perform the same functions but over a much wider voltage range (ex. 0 to 15V) with the logic switch levels depending on the supply voltage.  Their advantage is that they consume very little power.  However, they are less rugged and susceptible to static electricity.  These are the chips you should not touch with your hands until you remove all static electricity. 

 

CMOS and TTL devices can be used together in the same circuit, but the voltage levels must be within the TTL range. 

 

The labeling system for TTL devices follows the convention:

AAxxyzz

With AA the manufacturer’s symbol, xx 54 for military, 74 for commercial quality, y the type of internal design (none = standard TTL, L = low power, LS = low power schottky) and finally zz is specifies the device type (example: 00 = QUAD NAND, 01 = ___)

 

Open Collector Outputs:

Certain IC’s are open collector output devices; devices that terminate with the collector of a transistor.  Such outputs require a small circuit to complete the transistor circuit.  This circuit consists of a properly chosen pull-up resistor.  Examples of open collector output devices include the Polaroid ultrasonic rangers and the 7401, 7403, 7405, 7406 TTL devices. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Sequential Logic:

Sequential logic devices perform their operations based on specific timing or sequence of events.  These occur in systems such as clocked systems and event counting.  Events or triggers can include rising or falling edges of a digital signal.  Often, a sequential logic system will perform the logic operation based on a clock or other triggered event, and in the meantime stay in a holding pattern.  A number of devices that use this kind of logic including various flip-flops, counters and timers. 

 

Flip-flop

A flip-flop forms the basic memory storage device in digital systems.  The most basic form of flip flop is the RS flip-flop (Set and reset).  The output of the flip-flop is set high when S = 1, and is reset to low when R = 1.  In the meantime, the output of the flip-flop is constant.  This flip-flop is shown in the following figure and truth table.

 

Truth Table for RS flip-flop

Inputs   Outputs

S    R    Q    Q

0    0     Q0   Q0

0    0     1      0

0    1     0      1

1    1     NA   NA

 

RS flip-flop rules:

  1. When S = 1 and R = 0, the flip-flop is set such that Q = 1 and Q = 0.
  2. When S = 0 and R = 1, the flip-flop is reset such that Q = 0 and Q = 1.
  3. When both S = 0 and R = 0, the flip-flop is unchanged.
  4. The state S = 1 and R = 1 is not allowed and the output is not determined.

 

An RS flip-flop is formed of two inverters and two NAND gates combined with feedback. 

 

Clocks can be added to flip-flops such that the flip-flop state is determined at specific clock (for example rising edge) cycles. 

 

D Flip-flops

A D flip-flop is a clocked flip-flop whose output, Q is the same value as D at each rising clock cycle. 

 

 

 

 

 

 

 

 


One use of a D flip-flop is to determine the direction of a rotating system that produces two output waves with some phase shift.  With one wave the clock and the other the input, the output will be positive or negative depending on whether the input signal leads the clock or lags the clock.

 

JK Flip-flops

A JK flip-flop is similar to a clocked RS flip-flop except that the state of both inputs high now causes the output to toggle. 

 

Applications:

 

Pulse Counting

The circuit below demonstrates a scheme for pulse counting using T flip flops.  This scheme outputs a four-bit binary number, ABCD.