← Home Digital Electronics
18 Digital Electronics

Chapter 18 The 8051 Microcontroller

Number systems, Boolean algebra, logic gates, combinational circuits, flip-flops, counters, shift registers, memory and microprocessors

OUTLINE

18–1 The 8051 Family of Microcontrollers

18–2 8051 Architecture

18–3 Interfacing to External Memory

18–4 The 8051 Instruction Set

18–5 8051 Applications

18–6 Data Acquisition and Control System Application

18–7 Conclusion

OBJECTIVES

Upon completion of this chapter you should be able to do the following:

  • Describe the advantages that a microcontroller has over a microprocessor for control applications.
  • Describe the functional blocks within the 8051 microcontroller.
  • Make comparisons between the different microcontrollers available within the 8051 family.
  • Write the software instructions to read and write data to and from the I/O ports.
  • Describe the use of the alternate functions on the I/O ports.
  • Make the distinction between the internal and external data and code memory spaces.
  • Use various addressing modes to access internal data memory and the Special Function Registers (SFRs).
  • Interface an external EPROM and a RAM to the 8051.
  • Use some of the more commonly used instructions of the 8051 instruction set.
  • Write simple 8051 I/Os programs.
  • Use the bit operations of the 8051.
  • Understand program solutions to applications such as a keyboard decoder and analog-to-digital converter. *Chapter 18 is reprinted from Digital and Microprocessor Fundamentals: Theory and Applications, Fourth Edition; by William Kleitz, © 2003. Reprinted by permission of Pearson Education Inc., Upper Saddle River, NJ. †Visit the following sites for microcontroller trainers and downloadable software tools: www.acebus.com, www.bipom.com, www.elexp.com, www.emacinc.com, and www.8052.com

In the previous chapter you should have recognized several common components that are incorporated into most microprocessor-based system applications. These are the microprocessor, RAM, ROM (or EPROM), and parallel I/O ports. Microprocessor manufacturers have recognized this and over the years since the introduction of the 8085A have been developing a new line of microprocessors specifically designed for control applications. They are called microcontrollers. The microcontroller has the CPU, RAM, ROM, timer/counter, and parallel and serial I/O ports fabricated into a single IC. It is often called “a computer on a chip.” The CPU’s instruction set is improved for control applications and offers bit-oriented data manipulation, branching, and I/O, as well as multiply and divide instructions. The microcontroller is most efficiently used in systems that have a fixed program for a dedicated application. A microcontroller is used in a keyboard for a personal computer to scan and decode the keys. It is used in an automobile for sensing and controlling engine operation. Other dedicated applications such as microwave ovens, videocassette recorders, gas pumps, and automated teller machines use the microcontroller IC also. The previous chapters have provided a good background for understanding the microcontroller. The theory behind microprocessor buses, external memory, and I/O ports is necessary to utilize the features available on a microcontroller. In this chapter we’ll be introduced to one of the most widely used microcontrollers available: the

  1. 8051. You’ll see several similarities between it and the 8085A-based systems previ-

ously discussed. You should appreciate the way that you were eased into microprocessor operational theory using the 8085A, but now you will see why the 8051 can be a much better solution to dedicated control applications. Most control applications require extensive I/O and need to work with individual bits. The 8051 addresses both of these needs by having 32 I/O lines and a CPU instruction set that handles single-bit I/O, bit manipulation, and bit checking.

18–1 The 8051 Family of Microcontrollers

The basic architectural structure of the 8051 is given in Figure 18–1. The block diagram gives us a good picture of the hardware included in the 8051 IC. For internal

memory it has a 4K * 8 ROM and a 128 * 8 RAM. It has two 16-bit counter/timers RXD (transmit and receive), and it also has four 8-bit parallel I/O ports (P0, P1, P2, P3). There is also an 8052 series of microcontrollers available that has an 8K ROM, 256 RAM, and three counter/timers. Other versions of the 8051 are the 8751, which has an internal EPROM for program storage in place of the ROM, and the 8031, which has no internal ROM, but instead accesses an external ROM or EPROM for program instructions. Table 18–1 summarizes the 8051 family of microcontrollers. Note that the 8052/8752/8032 series has an extra 4K of program space (except the 8032), double the RAM area, an extra timer/counter, and one additional interrupt source. All parts use the same CPU instruction set. The ROMless versions (8031 and 8032) are the least expensive parts but require an external ROM or EPROM such as a 2732 or 2764 for program storage.

18–2 8051 Architecture

To squeeze so many functions on a single chip, the designers had to develop an architecture that uses the same internal address spaces and external pins for more than one function. This technique is similar to that used by the 8085A for the multiplexed

AD0-AD7 lines.

Figure 18–1 Block diagram of the 8051 microcontroller.

TABLE 18–1 The 8051 Family of Microcontrollers

DeviceTimers/eventInterrupt
numberProgramDatacounterssources
80514K*8 ROM128*8 RAM2*16-bit5
8751H4K*8 EPROM128*8 RAM2*16-bit5
8031None128*8 RAM2*16-bit5
8052AH8K*8 ROM256*8 RAM3*16-bit6
8752BH8K*8 EPROM256*8 RAM3*16-bit6
8032AHNone256*8 RAM3*16-bit6

The 8051 is a 40-pin IC. Thirty-two pins are needed for the four I/O ports. To provide for the other microcontroller control signals, most of those pins have alternate functions, which are described in this section. Also in this section, we see how the 8051 handles the overlapping address spaces used by internal memory, external memory, and the special function registers. The pin configuration for the 8051 is given in Figure 18–2.

Port 0

Port 0 is dual-purpose, serving as either an 8-bit bidirectional I/O port (P0.0–P0.7) or

the low-order multiplexed address/data bus (AD0-AD7). As an I/O port, it can sink up

(IOL = 3.2mA). The alternate port designations, AD0-AD7, are used to access exter-

memory. The AD lines are demultiplexed into A0-A7 and D0-D7 by using the ALE

Port 1

Port 1 is an 8-bit bidirectional I/O port that can sink or source up to 4 LS TTL loads.

(IOL = 1.6mA and IOH = -80mA.)

Figure 18–2 The 8051 pin configuration.

Port 2

Port 2 is dual-purpose, serving as either an 8-bit bidirectional I/O port (P2.0–P2.7) or

as the high-order address bus (A8-A15) for access to external memory. As an I/O port address bus whenever reference to external memory is made.

Port 3

Port 3 is dual-purpose, serving as an 8-bit bidirectional I/O port that can sink or source up to 4 LS TTL loads or as special-purpose I/O to provide the functions listed in Table 18–2.

TABLE 18–2Alternative Functions of Port 3
Port pinAlternative function
P3.0RXD (serial input port)
P3.1TXD (serial output port)
P3.2INT0(external interrupt 0)
P3.3INT1(external interrupt 1)
P3.4T0 (Timer 0 external input)
P3.5T1 (Timer 1 external input)
P3.6WR(external data memory write strobe)
P3.7RD(external data memory read strobe)

RST

Reset input. A HIGH on this pin resets the microcontroller.

ALE/ PROG

Address Latch Enable output pulse for latching the low-order byte of the address dur-

ing accesses to external memory. This pin is also the program pulse input (PROG) dur-

Program Store Enable is a read strobe for external program memory. It will be con-

nected to the Output Enable(OE)of an external ROM or EPROM.
EA/VPP
External Access(EA)is tied LOW to enable the microcontroller to fetch its program

code from an external memory IC. This pin also receives the 21-V programming supply voltage (VPP) for programming the EPROM parts.

XTAL1,XTAL2

Connections for a crystal or an external oscillator.

Address Spaces

The address spaces of the 8051 are divided into four distinct areas: internal data memory, external data memory, internal code memory, and external code memory (see

Figure 18–3).

The 8051 allows for up to 64K of external data memory (RAM) and 64K of external code memory (ROM/EPROM). The only disadvantage of external memory, in addition to the additional circuitry, is that ports 0 and 2 get tied up for the address and data bus. The actual hardware interfacing for external memory are given later in this chapter. When the 8051 is first reset, the program counter starts at 0000H. This points to

the first program instruction in the internal code memory unlessEA(External Access)
is tied LOW. IfEA Figure 18–3is tied LOW, the CPU issues a LOW on 8051 address spaces.PSEN(Program Store

LOW if using the ROMless (8031) version.

With EA tied HIGH, the first 4K of program instruction fetches are made from FFFFH) will automatically be made from the external code memory. If the application has a need for large amounts of data memory, then external data memory (RAM) can be used. I/O to external RAM can only be made by using one of the MOVX instructions. When executing a MOVX instruction, the 8051 knows that

you are referring to external RAM and issues the appropriate WR or RD signal. memory is better to use because it has a much faster response time and a broad spectrum of instructions to access it. Figure 18–3 shows two blocks of internal data memory. The first is the 128-byte RAM at address 00H to 7FH. The second is made up of the Special Function Registers (SFRs) at addresses 80H to FFH. Note that all addresses are only 1 byte wide, which allows for more efficient use of code space and faster access time. The use of the address space in the 128-byte RAM is detailed in

Figure 18–4.

The first 32 locations are set aside for four banks of data registers (called register banks), giving the programmer the use of 32 separate registers. The registers within each bank are labeled R0 through R7. The bank that is presently in use is defined by the setting of the two “bank select bits” in the PSW (Program Status Word).

Figure 18–4 Address space in the 128-byte internal data memory RAM.

locations. This meets the needs of control applications for a large number of ON/OFF bit flags, by providing 128 uniquely addressable bit locations. The last 80 locations are set aside for general-purpose data storage and stack operations. The Special Function Registers are maintained in the next 128 addresses in the internal data memory of the 8051 (address 80H to FFH). It contains registers that are required for software instruction execution as well as those used to service the special hardware features built into the 8051. Table 18–3 lists the SFRs and their addresses. The address of an SFR is also only 1 byte wide. However, instead of specifying the 1-byte hex address, you also have the option of addressing any SFR location by simply specifying its register name, like P0 or SP. Several of the SFRs are bit addressable. For example, to address bit 3 of the accumulator, you would use the address E0H.3 (or you could use ACC.3). The PSW is also bit addressable, having the bit addresses listed in Table 18–4. For example, to address the parity bit in the PSW, you would use the address D0H.0 (or you could use PSW.0).

TABLE 18–3 The Special Function Registers (SFRs) [Internal Data

RegisterAddressFunction
P080HaPort 0
SP81HStack pointer
DPL82HData pointer (Low)
DPH83HData pointer (High)
TCON88HaTimer register
TMOD89HTimer mode register
TL08AHTimer 0 low byte
TL18BHTimer 1 low byte
TH08CHTimer 0 high byte
TH18DHTimer 1 high byte
P190HaPort 1
SCON98HaSerial port control register
SBUF99HSerial port data buffer
P2A0HaPort 2
IEA8HaInterrupt enable register
P3B0HaPort 3
IPB8HaInterrupt priority register
PSWD0HaProgram status word
ACCE0HaAccumulator (direct address)
BF0HaB register

aBit-addressable register.

TABLE 18–4The PSW Bit Addresses
SymbolAddressFunction
CYD0H.7Carry flag
ACD0H.6Auxiliary carry flag
F0D0H.5General-purpose flag
RS1D0H.4Register bank select (MSB)
RS0D0H.3Register bank select (LSB)
OVD0H.2Overflow flag
D0H.1User-definable flag
PD0H.0Parity flag

Up to 64K of code memory (ROM/EPROM) and 64K of data memory (RAM) can be added to any of the 8051 family members. If you are using the 8031 (ROMless) part, then you have to use external code memory for storing your program instructions. As mentioned earlier, the alternate function of port 2 is to provide the high-order address

byte(A8-A15),and the alternate function of port 0 is to provide the multiplexed low-
order address/data byte(AD0-AD7).

If you are interfacing to a general-purpose EPROM like the 2732, then the ALE

signal provided by the 8031 is used to demultiplex the AD0-AD7 lines via an address As you can see, two of the I/O ports are used up to provide the address and data

buses. The AD0-AD7 lines that are output on port 0 are demultiplexed by the ALE sig-

lier. The PSEN signal is asserted at the end of each instruction fetch cycle to enable the

The EA line is tied LOW so that the 8031 knows to fetch all program code from exter-

Figure 18–5 Interfacing a 2732 EPROM to the ROMless 8031 microcontroller.

can be used. The 8155 RAM accepts the lines directly and uses the ALE to use 11 of the 8051 pins to interface to the 8155, but the 8155 provides an additional 22 I/O lines, giving us a net gain of 11. The addresses of the external RAM locations are 0000H to 00FFH, overlapping the addresses of the internal data memory. There is not a conflict, however, because all I/O to the external data memory is made using the MOVX instruction. The MOVX instruction ignores internal memory and, instead, activates the appropriate control sig-

nal, RD or WR via port 3. The LOW RD or WR signal allows the 8155 to send or

The I/O ports on the 8155 are accessed by making the IO/M line HIGH. This is (8000H or higher).

Figure 18–6 Interfacing an 8155 RAM/IO/Timer to the 8051 microcontroller.

All the members of the 8051 family use the same instruction set. (The complete instruction set is given in the 8051 Instruction Set Summary in Appendix H.) Several new instructions in the 8051 make it especially well suited for control applications. The discussion that follows assumes that you are using a commercial assembler software package. Hand assembly of the 8051 instructions into executable machine code is very difficult and misses out on several of the very useful features available to the ASM51 programmer.

Addressing Modes

The instruction set provides several different means to address data memory locations. We’ll use the MOV instruction to illustrate several common addressing modes. For example, to move data into the accumulator, any of the following instructions could be used:

MOV A,Rn: Register addressing, the contents of register Rn (where n = 0-7) MOV A,@Ri: Indirect addressing, the contents of memory whose address is in

Ri (where i = 0 or 1) is moved to the accumulator. (Note: Only registers R0 and MOV A,20H: Direct addressing, move the contents of RAM location 20H to the accumulator. I/O ports can also be accessed as a direct address as shown in the following instruction. MOV A,P3: Direct addressing, move the contents of port 3 to the accumulator. Direct addressing allows you to specify the address by giving its actual hex address (e.g., B0H) or by giving its abbreviated name (e.g., P3), which is listed in the SFR table (Table 18–3). MOV A,#64H: Immediate constant, move the number 64H into the accumulator. In each of the previous instructions, the destination of the move was the accumulator. The destination in any of those instructions could also have been a register, a direct address location, or an indirect address location.

EXAMPLE 18–1

Write the 8051 instruction to perform each of the following operations. (a) Move the contents of the accumulator to register 5. (b) Move the contents of RAM memory location 42H to port 1. (c) Move the value at port 2 to register 3. (d) Send FFH to port 0. (e) Send the contents of RAM memory, whose address is in register 1, to port 3.

Solution:

(a) MOV R5,A (b) MOV P1,42H (c) MOV R3,P2

is because the ASM51 assembler requires that the first position of any hexadecimal number must be a numeric digit from 0 to 9.) (e) MOV P3,@R1

Program Branching Instructions

8051 assembly language provides several different ways to branch (jump) to various program segments within the 64K of code memory area. Below are some of the most useful jump instructions. JMP label (Unconditional jump): Program control passes to location label. The JMP instruction is converted by the ASM51 assembler into an absolute jump, (AJMP), a short jump (SJMP), or a long jump (LJMP), depending on the destination pointed to by label. JZ label (Jump if accumulator zero): Program control passes to location label if the accumulator equals zero. JNZ label (Jump if accumulator not zero): Program control passes to location label if the accumulator is not equal to zero. JB bit,label (Jump if bit set): Program control passes to location label if the specified bit, bit, is set. JNB bit,label (Jump if bit not set): Program control passes to location label if the specified bit, bit, is not set. DJNZ Rn,label (Decrement register and jump if not zero): Program control passes to location label if, after decrementing register Rn, the register is not

equal to zero (n = 0-7). equal): Program control passes to location label if register Rn is not equal to the immediate data #data. The compare can also be made to the accumulator by specifying A instead of Rn. CALL label (Call subroutine): Program control passes to location label. The return address is stored on the stack. The CALL instruction is converted by the ASM51 assembler into an absolute call, ACALL, or a long call, LCALL, depending on the destination pointed to by label. RET (Return): Program control is returned back to the instruction following the CALL instruction.

EXAMPLE 18–2

Write a program that continuously reads a byte from port 1 and writes it to port 0 until the byte read equals zero.

Solution:

READ:MOV A,P1; AdP1
MOV P0,A; P0 JNZ READd ; Repeat until AA = NOP0 ; Remainder of program

etc.

Repeat Example 18–2, except stop the looping when the number 77H is read.

Solution:

READ:MOV A,P1; AdP1
MOV P0,A; P0d CJNE A,#77H,READA ; Repeat until NOPA = 77H ; Remainder of program

etc.

EXAMPLE 18–4

Repeat Example 18–2, except stop the looping when bit 3 of port 2 is set.

Solution:

READ:MOV A,P1; AdP1
MOV P0,A; P0dA JNB P2.3,READ NOP etc.; Repeat until bit 3 of port 2 is set ; Remainder of program ;

EXAMPLE 18–5

Write a program that will produce an output at port 0 that counts down from 80H to 00H.

Solution:

MOV R0,#80H; R0d80H
COUNT:MOV P0,R0; P0 DJNZ R0,COUNT NOP etc.d ; Decrement R0, jump to COUNT if not 0 ; Remainder of program ;R0

Logical and Bit Operations

The 8051 instruction set provides the basic logical operations (OR, AND, Ex-OR, and NOT), rotates (left or right, with or without carry), and bit operations (Clear, Set, and complement). The following list shows some of the most commonly used of those operations. ANL A,Rn (AND register to accumulator): Logically AND register Rn, bit by bit, with the accumulator and store the result in the accumulator. ANL A,#data (AND data byte to accumulator): Logically AND data byte #data, bit by bit, with the accumulator and store the result in the accumulator.

use the following instructions: ORL A,Rn (OR register to accumulator) ORL A,#data (OR data byte to accumulator) XRL A,Rn (Ex-OR register to accumulator) XRL A,#data (Ex-OR data byte to accumulator) The most commonly used instructions to operate on individual bits are as follows: CLR bit (Clear bit): Clear (reset to 0) the value of the bit located at address bit. SETB bit (Set bit): Set (set to 1) the value of the bit located at address bit. CPL bit (Complement bit): Complement the value of the bit located at address bit. The rotate commands available to the 8051 programmer are as follows: RL A (Rotate accumulator left): Rotate the 8 bits of the accumulator one position to the left. RLC A (Rotate accumulator left through carry): Rotate the 9 bits of the accumulator including carry one position to the left. RR A (Rotate accumulator right): Rotate the 8 bits of the accumulator one position to the right. RRC A (Rotate accumulator right through carry): Rotate the 9 bits of the accumulator including carry one position to the right. The following examples illustrate the use of the logical and bit operations.

EXAMPLE 18–6

Determine the contents of the accumulator after the execution of the following program segments.

(a) MOV A,#3CH; Ad0011 1100
MOV R4,#66H; R4d0110 0110
ANL A,R4; AdA AND R4

Solution:

A = 00111100 R4 = 01100110

AANDR4 = 00100100 = 24H Answer

(b) MOV A,#3FH; Ad0011 1111
XRL A,#7CH; AdEX-OR 7CH

Solution:

A = 0011 1111 7CH = 0111 1100

A EX@OR 7CH = 0100 0011 = 43H Answer

RR A ; Rotate right A = 1010 0011 Rotate right

A = 1101 0001 Answer

(d) MOV A,#0C3H; Ad1100 0011
RLC A; Rotate left through carry

Solution:

Assume carry = 0 initially A = 1100 0011 Rotate left through carry

A = 1000 0110, carry = 1 Answer

EXAMPLE 18–7

Use the SETB, CLR, and CPL instructions to do the following operations: (a) Clear bit 7 of the accumulator. (b) Output a 1 on bit 0 of port 3. (c) Complement the parity flag (bit 0 of the PSW).

Solution:

(a) CLR ACC.7 (Note: According to Table 18–3, the symbol for the direct address of the accumulator is ACC.) (b) SETB P3.0 (c) CPL PSW.0

EXAMPLE 18–8

Describe the activity at the output of port 0 during the execution of the following program segment: MOV R7,#0AH MOV P0,#00H

LOOP: CPL P0.7 Solution: Register 7 is used as a loop counter with the initial value of 10 (0AH). Each time that the complement instruction (CPL) is executed, bit 7 will toggle to its opposite state. Toggling bit 7 ten times will create a waveform with five positive pulses.

The 8051 is capable of all the basic arithmetic functions: addition, subtraction, incrementing, decrementing, multiplication, and division. The following list outlines the most commonly used forms of the arithmetic instructions. ADD A,Rn (Add register to accumulator): Add the contents of register Rn

(where n = 0-7) to the accumulator and place the result in the accumulator. the accumulator and place the result in the accumulator. SUBB A,Rn (Subtract register from accumulator with borrow): Subtract the contents of register Rn and borrow (carry flag) from the accumulator and place the result in the accumulator. SUBB A,#data (Subtract immediate data from accumulator with borrow): Subtract the value of #data and borrow (carry flag) from the accumulator and place the result in the accumulator. INC A (Increment accumulator) INC Rn (Increment register) DEC A (Decrement accumulator) DEC Rn (Decrement register) MUL AB (Multiply A times B): Multiply the value in the accumulator times the value in the B register. The low-order byte of the 16-bit product is left in the accumulator and the high-order byte is placed in register B. DIV AB (Divide A by B): Divide the value in the accumulator by the value in the B register. The accumulator receives the quotient and register B receives the remainder. DA A (Decimal adjust accumulator): Adjust the value in the accumulator, resulting from an addition, into two BCD digits.

The following examples illustrate the use of arithmetic instructions.

EXAMPLE 18–9

Add the value being input at port 1 to the value at port 2 and send the result to port 3.

Solution:

MOV R0,P1; R0dP1
MOV A,P2; AdP2
ADD A,R0; AdA+R0
MOV P3,A; P3dA

EXAMPLE 18–10

Multiply the value being input at port 0 times the value at port 1 and send the result to ports 3 and 2 (high order/low order).

MOV A,P0; AdP0
MOV B,P1; BdP1
MUL AB; A*B
MOV P2,A; P2dA (low order)
MOV P3,B; P3d 18–5B (high order) 8051 Applications

Having bit-handling instructions and built-in I/O makes the 8051 a good choice for data acquisition and control applications. In this section we look at a few applications that illustrate how we can utilize these new features to simplify our program solutions.

Instruction Timing

The 8051 circuitry that we looked at earlier was driven with a 12-MHz crystal. The 12 MHz is a convenient choice because each instruction machine cycle takes 12 clock periods

to complete. This means that one machine cycle takes 1ms. All 8051 instructions are DIV, which take four. The oscillator periods for each instruction are given in the 8051 Instruction Set Summary (Appendix H). For example, the MOV A,Rn instruction

requires 12 oscillator periods to complete, which will take 1ms [12 * (1/12MHz)]. Knowing the time duration of each instruction, we can write accurate time delays for our applications programs. Writing counter/loop programs is much easier now, with the introduction of the DJNZ and the CJNE instructions. Table 18–5 and Figure 18–7 show a time-delay program that we could call as a subroutine from an applications program.

TABLE 18–5Time-Delay Subroutine
DELAY:MOV R1,#0F3H; Outer-loop counter (F3H=243)
MOV R0,#00H; Inner-loop counter
LOOP:DJNZ R0,LOOP; Loop 256 times
DJNZ R1,LOOP; Loop 243 times
RET; Return
The DJNZ instruction takes 24 oscillator periods, or 2 s. By initializing regis-m

ter 0 at 00H, the first time DJNZ R0,LOOP is executed, R0 will become FFH. The program will loop within that same instruction 255 more times until R0 equals 0. At that point, control drops down to the next DJNZ, which functions as an outer loop as shown in the flowchart.

The R0 (inner) loop will take 512 s to complete. The R1 (outer) loop exe- m second. A third loop, using R2, could be added to increase the time by another factor of 256.

Figure 18–7 Flowchart for the time-delay subroutine of Table 18–5.

Technical diagram
Technical diagram

EXAMPLE 18–12

Write a program that will decode the hexadecimal keyboard shown in

Figure 18–8.

Solution:

LabelInstructionComments
KEYSCAN:CALL ROWRD CALL COLRD CALL CONVRT; Determine row of key pressed ; Determine column of key pressed ; Convert row/column to key value
STOP:JMP STOP; Suspend operation

;

ROWRD:MOV P0,#0FH; Output 0s to all columns
MOV R0,#00H; Row JNB P0.0,RET1= ; Return if row 0 is LOW0
MOV R0,#01H; Row JNB P0.1,RET1= ; Return if row 1 is LOW1
MOV R0,#02H; Row JNB P0.2,RET1= ; Return if row 2 is LOW2
MOV R0,#03H; Row JNB P0.3,RET1 JMP ROWRD= ; Return if row 3 is LOW ; Else keep reading3
RET1:RET; Return

;

COLRD:MOV P0,#0F0H; Output 0s to all rows
MOV R1,#00H; Column JNB P0.4,RET2= ; Return if column 0 is LOW0
MOV R1,#01H; Column JNB P0.5,RET2= ; Return if column 1 is LOW1
MOV R1,#02H; Column JNB P0.6,RET2= ; Return if column 2 is LOW2
MOV R1,#03H; Column JNB P0.7,RET2 JMP COLRD= ; Return if column 3 is LOW ; Else keep reading3
RET2:RET; Return

;

CONVRT:MOV B,#04H; B=Multiplication factor
MOV A,R0; Move row number to A
MUL AB; A=row*4
ADD A,R1; A=row RET* ; A now contains value of key pressed4+column

Figure 18–8 Keyboard interface to an 8051.

Explanation: The keyboard is wired as a 4 * 4 row–column matrix. order is connected to the columns. The rows and columns are held HIGH

with the 10@k� pull-up resistors. Because the I/O ports of the 8051 can nique to scan a keyboard than we would use with the 8085A. To determine the row of a depressed key, we drive all of the columns LOW and all of the rows HIGH by executing the instruction MOV P0,#0FH. The HIGH on the rows is actually a float state, allowing the rows to be read. The next series of instructions in the ROWRD subroutine read each row to determine the row number that is LOW, if any. If, for example, key 5 is depressed, then row 1 will be LOW and the other three rows will be HIGH. Now that we know the row, we must next determine the column. The instruction MOV P0,#0F0H will drive the rows LOW and float the columns. If the number 5 key is still depressed, column 1 will be LOW. The last subroutine converts the row–column combination to the numeric value of the key pressed. Rows 0, 1, 2, and 3 have weighting factors of 0, 4, 8, and 12, respectively, and columns 0, 1, 2, and 3 have weighting factors of 0, 1, 2, and 3, respectively. Knowing that, the CONVRT subroutine uses the following formula to determine the numeric value of the key pressed: Keypressed = row * 4 + column

EXAMPLE 18–13

Figure 18–9 shows how an ADC0801 (or ADC0804) is interfaced to an

  1. 8051. Write a program that takes care of the handshaking requirements for

SC and EOC to complete an analog-to-digital conversion.

Figure 18–9 Interfacing an analog-to-digital converter to an 8051.

Solution:

LabelInstructionComments
FLOAT:MOV P1,#0FFH MOV P0,#0FFH; Write 1s to port 1 ; Write 1s to port 0
SC:CLR P0.6 SETB P0.6; Output LOW-then-HIGH on ;SC
WAIT:JB P0.7, WAIT; Wait here untilEOCgoes LOW
DONE:MOV R0,P1; Transfer ADC result to register 0

Explanation: The I/O ports are in the float condition after the initial reset of the 8051. They must be floating to be used as inputs. The first two instructions in this program write 1s to ports 1 and 0, which make them float just in case they had 0s in them from a previous step in the program.

To start the conversion process, bit 6 of port 0 (SC) is pulsed LOW then

if-bit-set instruction (JB) then monitors bit 7 of port 0 (EOC) and remains 1 is read into register 0, which is used to hold the ADC result.

18–6 Data Acquisition and Control System Application

The object of this section is to implement the 8051-based data acquisition and control system shown in Figure 18–10. Three modules are discussed using several external transducers and instruments as follows:

Figure 18–10 Modular 8051-based data acquisition and control application.

  1. 1. ADC module with hex display of the output.
  2. 2. DAC module with hex display of the input.
  3. 3. 8051 microcontroller module with connection points for (1) and (2).

Assembly-language software will be written and stored on an EPROM connected to the 8051. This software will exercise the ADC/DAC modules and perform other I/O functions. One of the outcomes of these designs is for their use in colleges for teaching the concepts of data acquisition and control, so careful attention will be paid to the cost, durability, and ease of reproduction of each module.

Hardware

The 8051 Microcontroller Module The 8051 microcontroller module is shown in ule are input and output buffers, an address latch, and an EPROM interface. In Figure 18–11, the microcontroller used is the 8031, which is a subset of the

  1. 8051. The 8031 differs in that it is the ROM-less part. Instead of using the 8051, which

has an internal mask-programmable ROM, we use the 8031 and interface an EPROM to it to supply our program statements. The 8031 will be run with a 12-MHz crystal. This was chosen because most of the instructions take 12 clock periods to execute. This way, accurate timing can be

developed based on 1@ms instruction execution time. required to access the EPROM comes from the 8 bits provided from port 0 and the 4 bits provided from port 2. The data output from the EPROM are sent back into the microcontroller via port 0. Because port 0 has a dual purpose (i.e., address and data), a control signal from the ALE line is used to tell the address latch when port 0 has valid

addresses and when it has data. Also, the EA signal is grounded, which signifies that the microcontroller is ready to read data from the EPROM. This LOW control signal is

attached to the OE line of the 2732 EPROM, which changes the outputs at D0 through reads the data.

Hardware reset is provided at pin 9 via the R-C circuit of R1 – C3. At power-up the HIGH-to-LOW level for PIN 9 to be reset. Resetting can also be accomplished with the push-button, which shorts the 5-V supply directly to pin 9 any time you want to have a user reset. Two eight-bit I/Os are provided via port 1 and port 3. In this circuit, port 1 is used as an output port capable of sinking or sourcing up to four LSTTL loads. This is equivalent to a sink current of approximately 1.6 mA, which is normally not enough to drive loads such as LED indicators. Because of this, the 74LS244 (U1) is used as an output buffer. The 74LS244 can sink 24 mA and source 15 mA. The outputs of this buffer are always enabled by grounding pins 1 and 19. This way, whatever appears at port 1 will immediately be available to the LEDs. The LEDs are connected as active-LOW by pro-

viding a series 270 ohm resistor to the 5-V supply. When any of the outputs of U1 go +

8051 Microcontroller with input/output.

on this module so that other devices can be driven from this port at the same time that the LEDs are being activated. In this circuit, port 3 is used for input. The 8-bit DIP switch is connected to port 3 in conjunction with the 10K DIP pack. Therefore, each of the bits of port 3 is normally HIGH via a 10K pull-up. They are made LOW any time one of the DIP switches is closed. An input socket is also provided at this port so that external digital inputs can be input to port 3. To use the input socket, all eight of the DIP switches must be in their open position so that the devices driving the input socket can drive the appropriate line LOW or HIGH without a conflict with the LOW from the DIP switch. The 74LS373 is an octal transparent latch used as an address demultiplexer. Data entered at the D inputs are transferred into the Q outputs whenever the LE input is HIGH. The data at the D inputs are latched when the LE goes LOW. This address latch is used to demultiplex port 0s address/data information. When port 0 has valid address information, the ALE line is pulsed HIGH. This causes the address latch to grab hold of the information on port 0 and pass it through to the Qs and latch onto it. After the addresses from port 0 are latched, the port is then placed in the float condition so that it can be used to receive the data from the EPROM as the PSEN line is pulsed LOW.

The LOW pulse on the PSEN line activates the active-LOW OE on the EPROM, which microcontroller, where they are used as program instructions.

The ADC Interface Module The heart of the ADC interface module (Figure 18–12) and can be directly interfaced to a microcontroller. The object of this interface module

is to convert analog quantities brought into Vin(+) into 8-bit digital outputs. The digital microcontroller module. They are also connected to the 2-digit hex display so that you can constantly monitor the 8-bit values that were converted.

The clock oscillator for the ADC is provided viaR19C1.The frequency of oscil-
lation can be calculated by taking the reciprocal of(1.1 * 10k�* 150pF),which

equals approximately 606 kHz. Because this is a successive approximation ADC we can assume that the conversion will take place in 10 to 12 clock periods, which provides a conversion time of about 20 ms. The chip select (CS) pin on U1 is connected to ground so that the chip is always activated. The RD pin is an active-LOW output enable. This is connected to ground

also, so that the outputs are always active. To start a conversion, theWRline, which is
also known as the start-conversion(SC),is pulsed LOW-then-HIGH. After the SAR

has completed its conversion, it issues a LOW pulse on the INTR line [also known as

end-of-conversion (EOC) ], which will be read by the microcontroller to determine if

TheVref/2pin is connected to a reference voltage that overrides the normal refer-
ence of 5 V provided by Vcc. By setting theVref/2at 1.28 volts, the actual Vref will be

2.56 V. This way, with a Vref of 2.56 V, and an ADC that has a maximum number of steps of 256, the change in the output will be 1 bit change or 1 binary step for every 10 mV of input change. This provides a convenient conversion for the linear temperature sensor (T1) because T1 provides a 10 mV change for every degree Celsius. It also makes the calculations for the linear phototransistor sensor much simpler.

The DAC Interface Module The heart of the DAC interface module (Figure 18–13)

verted are brought into the A8-A1 digital input side with A1 receiving the MSB. The

The amount of full-scale output current is dictated by theR1-R2reference resistors.
With a 15 V supply and a10@k�resistor, the maximum output current will be 1.5 mA.

The ADC 0804 interface module.

The MC1408 DAC interface module.

this current-to-voltage conversion, a 741 op amp is used. The current at Io is drawn

through the10@k�feedback resistor of U2. This way, the analog Vout is equal to Io
times10k�.The analog output voltage can be predicted by using a ratio method. The

ratio of the analog Vout to the binary input is proportional to the ratio of the maximum analog Vout to the maximum binary input (15 V maximum divided by 256 maximum).

(Because the supply on the op amp is ; 15V, we will never be able to achieve 15 V A two-digit hexadecimal display is connected directly to the input to the DAC chip. This provides a way to monitor the binary input at any time.

Applications

Three separate applications are used to exercise the three modules. Each of these applications are controlled by the microcontroller and will read analog input values with the ADC and output analog values with the DAC.

Celsius Thermometer The Celsius thermometer application is shown in Figure to the ADC and display a binary coded decimal (BCD) output of the temperature. The LM35 linear temperature sensor is used to measure the temperature. It outputs 10 mV for every degree Celsius. This millivolt value is converted by the ADC into an 8-bit binary string, which is displayed on the hex display and also input to the microcontroller. Because the Vref on the ADC is set at 2.56 V, the output of the ADC is an actual hexadecimal display of the degrees Celsius. The microcontroller is used to start the ADC conversion and then monitor the

end of conversion (EOC) line to wait for the conversion to be complete. Once the conthe hexadecimal value into a BCD value so that it can be read by the user on the display of the DAC module. The analog output value of the DAC is not used. The ASM51 software used by this application is given in Table 18–6. This listing basically has five columns. The first lists the memory locations 0000–0062 that are programmed in the EPROM. The next shows the actual hex contents of the memory locations, starting with 802E and continuing down through 22. The third and fourth show the assembly language programming with labels starting with the ORG 0008H and ending with the RET statement. In the extreme right-hand column is the comments section for the program. As you read through the comments section you will see that three subroutines are used to call the three different operations that are going to take place. The first subroutine, ADC, is used to float the buses on port 3 and port 1 and then issue the start con-

version (SC) signal. The “wait” part of that subroutine is necessary to wait until EOC After the ADC routine is complete and the digital value is stored in register 0, that value in register 0 must be converted from hex to BCD. To do this, a counter

Figure 18–14 Celsius thermometer.

AddrHexLabelASM51Comments
0000ORG0000H; START OF EPROM
0000802ESJMPSTART; SKIP OVER 8051 RESTART

; LINK AREA

0030ORG0030H; START OF PGM
00301138START:ACALLADC; PERFORM AN A-TO-D

; CONVERSION

0032 1159 ACALL DAC ; DISPLAY RESULT AND ; CONVERSION

0034114CACALLDELAY; DELAY 4 SECOND
003680F8SJMPSTART; REPEAT

;

003875B0FFADC:MOVP3,#0FFH; FLOAT THE BUS
003B7590FFMOVP1,#0FFH; FLOAT THE BUS
003EC2B7 0040SC: D2B7CLR SETBP3.7 P3.7; DROP ; THEN RAISE HIGHSCLINE LOW
004220B6FD 0045 0047 0049WAIT: C2B6 C2B7 A8B0JB CLR CLR MOVP3.6, WAIT P3.6 ; USED FOR P3.7 ; USED FOR R0,P3; WAIT TILL ; CLEAR P3.6 WHICH WAS EOC ; CLEAR P3.7 WHICH WAS SC ; STORE FINAL ADC RESULTEOCGOES LOW

; INTO R0

004B 22 RET

004C7F20DELAY:MOVR7,#20H; OUTERMOST LOOP (32 times)
004E7D00MOVR5,#00H; INNERMOST LOOP (256 times)
00507EF3LOOP2:MOVR6,#0F3H; MIDDLE LOOP (243 times)
0052DDFE 0054 0056LOOP1: DEFC DFF8DJNZ DJNZ DJNZ 0058R5,LOOP1 R6,LOOP1 R7,LOOP2 22; ; ; RET

; CONVERT HEX TO BCD ; AND DISPLAY ON DAC ; MODULE

00597400DAC:MOVA,#00H; ZERO OUT ACCUMULATOR
005B2401LOOP3:ADDA,#01H; Acc WILL HAVE VALID BCD,

; R0=ADC HEX ; RESULT

005D D4 DA A ; DECIMAL ADJUST Acc IF

005E D8FB DJNZ R0,LOOP3 ; DECR R0 WHILE INCR AND ; R0=0

0060 F590 MOV P1,A ; MOV CORRECTED BCD TO

0062 22 RET ;

0000 END

accumulator will have in it the correct BCD value that was achieved by using the decimal adjust instruction (DA A). After the DAC displays the BCD result, a delay is used for approximately 4 seconds so that there will be a 4-second delay before the temperature is refreshed.

Temperature-Dependent PWM Speed Control This application is shown in Figure this application is to monitor the temperature and produce a pulse-width-modulated (PWM) square wave whose duty cycle is proportional to the temperature. This PWM square wave can be used to drive a DC motor. The effective DC value will increase as the duty cycle increases. Because the duty cycle increases with increasing temperature, the speed of the motor will also increase with increasing temperature. The ASM51 software used to drive this application is given in Table 18–7. Basically, this software has two subroutines that are called. The first one is the ADC subroutine. This subroutine starts the conversion, waits until the conversion is complete, and moves the ADC result into register 0. The next subroutine, the PWM, is used to produce the PWM square wave. To produce a PWM square wave, the output of the DAC will first be held LOW (0 V) for a delay multiple equivalent to 10 hexadecimal. Then the DAC will be sent HIGH, which in this case is one-half the full-scale output (80 hex). This HIGH is held for a delay multiple equivalent to the temperature value received from the ADC conversion. This way, as the ADC result increases with increasing temperature, the duty cycle of the PWM will increase, thus increasing the effective DC value sent to the motor.

Integrating Solar Radiometer The block diagram for the integrating solar radiometensity and produce a real-time display of the irradiation from the sunlight and then accumulate the irradiation, the same as taking the integral, and display the integrated output as an analog voltage and also on a hex display. To measure the irradiation, an ECG 3034 phototransistor is used. It produces 300 nA per microwatt per centimeter

squared. The current is changed to a voltage by the 330- � resistor. This analog voltgram. The integrated output of the ADC will be proportional to the amount of sunlight that struck the measured surface over a certain length of time. This length of time could be one hour, one day, one week, or whatever time is desired. The software used to execute this application is given in Table 18–8. The first subroutine is the ADC subroutine, which is used to convert the irradiation into a digital value. After the microcontroller has this digital value, the DAC routine performs the integration simply by accumulating the ADC result over each period of time. The DAC provides both the hexadecimal equivalent of the integrated irradiation as well as an analog output voltage that is proportional to the integrated irradiation.

Figure 18–15 Temperature-dependent PWM speed control.

AddrHexLabelASM51Comments
0000ORG0000H; START OF EPROM
00008030SJMPSTART; SKIP OVER 8051 RESTART

; LINK AREA

0030ORG0030H; START OF PGM
00307F01START:MOVR7,#01H; TO ENABLE ADC READ ON

; 1st LOOP

0032 1138 LOOP: ACALL ADC ; PERFORM AN A-TO-D

0034 114C ACALL PWM ; DRIVE DC MOTOR WITH

003680FASJMPLOOP; REPEAT
0038DF11ADC:DJNZR7,ERET; TAKE AN ADC READ EVERY

; 256th TIME FOR ; STABILITY

003A75B0FFMOVP3,#0FFH; FLOAT THE BUS
003DC2B7SC:CLRP3.7; DROPSCLINE LOW
003FD2B7SETBP3.7; THEN RAISE HIGH

; (PROVIDES POSITIVE EDGE)

004120B6FDWAIT:JBP3.6,WAIT; WAIT TILLEOCGOES LOW
0044E5B0MOVA,P3; STORE ADC RESULT INTO

; Acc

0046547FANLA,#01111111B; CLEAR BIT 7 WHICH WAS
; USED FORSC
0048F8MOVR0,A; MOVE ADC RESULT TO

; REG 0

0049 AF40 MOV R7,40H ; RESET REG 7 to 64 DECIMAL

004B 22 ERET: RET

004C759000PWM:MOVP1,#00H; OUTPUT A LOW
004F743FMOVA,#3FH; 3FH IS HIGHEST ASSUMED

; ADC OUTPUT VALUE

0051 98 SUBB A,R0 ; SUBTRACT THE ADC

0052 F9 MOV R1,A ; R1 (DELAY VALUE) FOR

0053115DACALLDELAY; CALL DELAY TO HOLD LOW
00557590FFMOVP1,#0FFH; OUTPUT FULL SCALE

; OUTPUT FOR A HIGH

0058 A900 MOV R1,R0 ; USE TEMPERATURE AS ; FOR HIGH

005A 115D ACALL DELAY ; CALL DELAY TO HOLD

005C 22 RET ; RETURN

005D7D80DELAY:MOVR5,#80H; START COUNT OF R5
005FDDFELOOP1:DJNZR5,LOOP1; R5=INNERLOOP COUNT

; DOWN TO ZERO

0061 D9FA DJNZ R1,DELAY ; R1=MULTIPLIER FROM

006322RET
0000END

Figure 18–16 Integrating solar radiometer.

TABLE 18–8Integrating Solar Radiometer Software
AddrHexLabelASM51Comments
0000ORG0000H; START OF EPROM
00008030SJMPSTART; SKIP OVER 8051 RESTART

; LINK AREA

0030ORG0030H; START OF PGM
00307400START:MOVA,#00H; RESET ACCUMULATOR
0032113ALOOP:ACALLADC; PERFORM AN A-TO-D

; CONVERSION

0034 1158 ACALL DAC ; DISPLAY RESULT AND ; CONVERSION

0036114BACALLDELAY; DELAY 4 SECOND
003880F8SJMPLOOP; REPEAT
003A75B0FFADC:MOVP3,#0FFH; FLOAT THE BUS
003DC2B7SC:CLRP3.7; DROPSCLINE LOW
003FD2B7SETBP3.7; THEN RAISE HIGH
004120B6FDWAIT:JBP3.6,WAIT; WAIT TILLEOCGOES LOW
0044C2B6CLRP3.6 ; USED FOR; CLEAR P3.6 WHICH WAS EOC
0046C2B7CLRP3.7 ; USED FOR; CLEAR P3.7 WHICH WAS SC
0048A8B0MOVR0,P3; STORE FINAL ADC RESULT

; INTO R0

004A 22 RET

004B7F20DELAY:MOVR7,#20H; OUTERMOST LOOP (32X)
004D7D00MOVR5,#00H; INNERMOST LOOP (256X)
004F7EF3LOOP2:MOVR6,#0F3H; MIDDLE LOOP (243X)
0051DDFE 0053 0055LOOP1: DEFC DFF8DJNZ DJNZ DJNZ 0057R5,LOOP1 R6,LOOP1 R7,LOOP2 22; ; ; RET

; INTEGRATE BY ACCUMU; LATING ADC RESULT

0058 8840 DAC: MOV 40H,R0 ; MOVE ADC RESULT TO

005A 53403F ANL 40H,#00111111B ; MASK OFF UNWANTED

005D 2540 ADD A,40H ; ACCUMULATE NEW ADC ; TOTAL

005FF590MOVP1,A; MOVE TO DAC DISPLAY
006122RET;

;

0000 END

This three-module method for data acquisition and control proves to be a very inexpensive and simple way to be able to input both analog and digital quantities and to output both digital and analog quantities. Having the hex displays connected to the input and output modules is an effective way of monitoring the real-time activity of the DAC and the ADC. The entire three-module data-acquisition setup is very portable in that it requires only a bipolar power supply to operate it. The software used to exercise these modules is very straightforward and is effectively written using the ASM51 assembler on a personal computer and downloaded to an EPROM using a standard EPROM programming software package. Once you have the programmed EPROM, all that is required for a stand-alone data acquisition system is a power supply.

Summary

In this chapter we have learned the following:

  1. 1. The 8051 microcontroller is different from a microprocessor because it

has the CPU, ROM, RAM, timer/counter, and parallel and serial ports fabricated into a single IC.

  1. 2. Thirty-two of the 40 pins of the 8051 are used for the four 8-bit parallel

I/O ports. Three of the ports share their function with the address, data, and control buses.

  1. 3. The address spaces of the 8051 are divided into four distinct areas: in-

ternal data memory, external data memory, internal code memory, and external code memory. The internal data memory is further divided into user RAM and Special Function Registers (SFRs).

  1. 4. To interface to an external EPROM like the 2732, an octal D-latch is

required to demultiplex the address/data bus, which is shared with port 0.

The External Access (EA) pin is tied LOW and the (PSEN) output is used

  1. 5. Extra data memory and I/O ports can be interfaced by using the 8155

IC. The 8155 demultiplexes the address/data bus internally so an octal D-latch is not required.

  1. 6. The MOV instruction is very powerful, providing the ability to move

data almost anywhere internal or external to the microcontroller and to the I/O ports.

7. Program branching is accomplished by use of many different condi-

tional and unconditional jumps and calls.

  1. 8. The 8051 instruction set provides the ability to work with individual

bits, which makes it very efficient for on/off control operations. Instructions are available for all the logic functions, rotates, and bit manipulations.

  1. 9. Instructions are provided for all the basic arithmetic instructions: addi-

tion, subtraction, multiplication, division, incrementing, and decrementing.

  1. 10. Each instruction machine cycle takes 12 clock periods to complete.

This means that if a 12-MHz crystal is used, each machine cycle takes 1 s m

single I/O port.

  1. 12. Interfacing an 8-bit analog-to-digital converter to an 8051 is accom-

plished with one port and two bits on a second port. The start-conversion LOW pulse is issued with bit-setting instructions and the end-of-conversion signal is monitored with bit-checking instructions.

Glossary

Assembler: A software package used to convert assembly language programs into executable machine code. Bidirectional: An I/O port that can be used for both input and output. Bit Addressable: Memory spaces in the internal RAM and SFR areas that allow for the addressing of individual bits.

External Access (EA): An active-LOW input that when forced LOW, tells the procesMicrocontroller: A computer on a chip. It contains a CPU, ROM, RAM, counter/ timers, and I/O ports. It is especially well suited for control applications.

Program Store Enable (PSEN): An active-Low output control signal issued by the Register Bank: A group of eight registers. The 8051 has four sets of banks that are selected by writing to the two bank-select bits in the PSW. Special Function Register (SFR): A data register that has a dedicated space within the microcontroller. It is used to maintain the data required for microcontroller operations.

Problems

18–1. Why is a microcontroller sometimes referred to as a “computer on a chip”? 18–2. Describe the difference between the 8031, 8051, and the 8751. 18–3. What additional features does the 8052 have over the 8051? 18–4. Port 2 has a dual purpose. One is as a bidirectional I/O port. What is its other purpose? 18–5. If you are using the internal ROM in the 8051 for your program code

memory, should the EA be tied HIGH or LOW? to the 8051? 18–7. What is the address range of the Special Function Registers (SFRs)? 18–8. What are the SFR addresses of the four I/O ports? 18–9. The 8051 has four register banks with eight registers in each bank. How does the CPU know which bank is currently in use?

ing the 2732 EPROM in Figure 18–5 but not when interfacing the 8155 RAM in Figure 18–6? 18–11. Determine the value of the accumulator after the execution of instruction A:, B:, C:, and D: MOV 40H,#88H MOV R0,#40H

A
MOV A,R0 ; A = _____
B:MOV A,@R0; A = _____
C:MOV A,40H; A = _____
D:MOV A,#40H; A = _____

18–12. Repeat Problem 18–11 for the following instructions:

MOV 50H,#33H MOV 40H,#22H MOV R0,#30H MOV 30H,50H MOV R1,#40H

A
MOV A,40H ; A = _____
B:MOV A,@R0; A = _____
C:MOV A,R1; A = _____
D:MOV A,30H; A = _____

18–13. Write the instructions to perform each of the following operations: (a) Output a C7H to port 3. (b) Load port 1 into register 7. (c) Load the accumulator with the number 55H. (d) Send the contents of RAM memory, whose address is in register 0, to the accumulator. (e) Output the contents of register 1 to port 0. 18–14. Write a program that continuously reads port 0 until the byte read equals A7H. At that time, turn on the output LEDs connected at port 1. 18–15. Write a program that will produce an output at port 1 that counts up from 20H to 90H repeatedly. 18–16. Determine the value of the accumulator after the execution of instruction A:, B:, and C: MOV A,#00H MOV R0,#36H

A
XRL A,R0 ; A = _____
B:ORL A,#71H; A = _____
C:ANL A,#0F6H; A = _____

18–17. Repeat Problem 18–16 for the following program:

MOV A,#77H

A
CLR ACC.1 ; A = _____
B:SETB ACC.7; A = _____
C:RL A; A = _____

18–18. Modify one instruction in Example 18–8 so that it will output eight pulses at port 0 instead of five.

outputs the result to port 1. 18–20. What is the length of time of the following time-delay subroutine? (Assume a 12-MHz crystal is being used.)

DELAY: MOV R1,#00H

LOOP: DJNZ R0,LOOP RET

Schematic Interpretation Problems

See Appendix G for the schematic diagrams. 18–21. Find Port 2 (P2.7–P2.0) of U8 in the 4096/4196 schematic. This

port outputs the high-order address bits for the system (A8-A15). On a sep-

A8-A11 to the four bits A12-A15. The HIGH output for an equal compari18–22. Locate the microcontroller in the 4096/4196 schematic. (a) What is its grid location and part number? (b) Its low-order address is multiplexed. What IC and control signal is

used to demultiplex the address/data bus(AD0-AD7)into the low-
order address bus(A0-A7)?

Appendix A Web Sites

Useful Web sites for this book include the following: www.acebus.com (AceBus) Downloadable 8051 microcontroller editor, assembler, and simulator www.ahinc.com/scsi.htm (Advanced Horizons, Inc.) SCSI, CD, and DVD definitions and standards www.allegromicro.com (Allegro MicroSystems, Inc.) Hall Effect Sensors and Power ICs www.altera.com (Altera Corporation) CPLDs and FPGAs www.ocf.berkeley.edu/~amanb/8085.html 8085 simulator www.amd.com (Advanced Micro Devices, Inc.) Microprocessors, EPROMs, and Flash memory www.analog.com (Analog Devices, Inc.) Analog ICs, ADCs, and DACs www.bipom.com (BiPom Electronics, Inc.) Downloadable 8051 microcontroller editor, assembler, and simulator www-03.ibm.com/chips/ (IBM Microelectronics Corporation) Microprocessors, SRAMs, DRAMs, and custom logic www.datasheetcatalog.com pdf datasheet downloads www.digikey.com Sales catalog of electronic products and components www.educypedia.be/electronics Free circuit schematics, information and tutorials www.elexp.com (Electronics Express, Inc.) Sales of electronic products, CPLD

programmer boards, and microprocessor trainers and components www.emacinc.com (EMAC, Inc.) Microprocessor and microcontroller trainers and single-board computers www.fairchildsemi.com (Fairchild Semiconductor, Inc.) Digital Logic ICs, analog ICs, discrete semiconductors, EEPROMs, and microcontrollers www.fujitsumicro.com (Fujitsu, Inc.) Microcontrollers, DRAMs, and Flash memory

memories, EEPROMs, digital logic ICs, analog ICs, and discrete semiconductors www.howstuffworks.com (HowStuffWorks) Beginners guide to the operation of electronic and computer hardware and software www.idt.com (Integrated Device Technology, Inc.) SRAMs and digital logic ICs www.intel.com (Intel Corporation) Microprocessors, microcontrollers, and Flash memory www.interactiv.com (Interactive Image Technology, Inc.) Multisim®software www.intersil.com (Intersil Corporation) Analog ICs, ADCs, DACs, SRAMs, microprocessors, microcontrollers, and discrete semiconductors www.jameco.com Sales catalog of electronic products and components www.jdr.com Sales catalog of electronic products and components www.latticesemi.com (Lattice Semiconductor Corporation) CPLDs www.linear-tech.com (Linear Technology Corporation) ADCs and DACs www.microchip.com (Microchip Technology, Inc.) EEPROMs and microcontrollers www.micronsemi.com (Micron Semiconductor Products, Inc.) DRAMs, SRAMs, and Flash memory www.mot-sps.com (Motorola Semiconductors, Inc.) Analog ICs, digital logic ICs, microcontrollers, microprocessors, SRAMs, and discrete semiconductors www.mp3-tech.org (MP3 Tech) MP3 definitions and standards www.national.com (National Semiconductor Corp.) Analog ICs, digital logic ICs, and microcontrollers

www.ni.com (National Instruments, Inc.) Provider of Multisim simulation software and LabView measurement and control software www.nxp.com (NXP Semiconductors N.V.) Digital and Mixed Signal logic ICs www.onsemi.com (ON Semiconductor, Inc.) Analog ICs, digital logic ICs, and discrete semiconductors www.pctechguide.com (PCTechGuide) Technicians guide to PC hardware and software www.semiconductors.philips.com (Philips Semiconductors, Inc.) Analog ICs, digital logic ICs, microcontrollers, and discrete semiconductors www.sharpmeg.com (Sharp Microelectronics Corporation) Microprocessors, microcontrollers, SRAMs, and Flash memory www.terasic.com Provider of Altera FPGA Development and Education boards like the DE-x series www.ti.com (Texas Instruments, Inc.) Analog ICs, digital logic ICs, and microcontrollers www.toshiba.com (Toshiba America, Inc.) Analog ICs, digital logic ICs, microcontrollers, DRAMs, SRAMs, and Flash memory www.usb.org (Universal Serial Bus) USB definitions and standards www.webopedia.com Glossary of PC and internet terms with links to other sites www.xess.com (XESS Corporation) CPLD programmer boards www.xilinx.com (Xilinx, Inc.) CPLDs and FPGAs www.zilog.com (Zilog Inc.) Microprocessors and microcontrollers

Appendix B Manufacturers’ Data Sheets*

Data Sheet IC NumbersFunction
74HC00High-speed CMOS NAND
74LV00Low-voltage NAND
74ABT244BiCMOS Octal Buffer
KA741Operational Amplifier
LM555Timer
EP2C FPGAAltera Cyclone II family

Reference Material

NXP Semiconductors [Formerly Philips (Signetics) Semiconductor]

74F00 NAND http://www.nxp.com/documents/data_sheet/

74F112 Flip-Flop http://www.nxp.com/documents/data_sheet/

74HC/HCT00 NAND http://ics.nxp.com/products/hc/datasheet/

74LV00 Low-V NAND http://www.nxp.com/documents/data_sheet/

74ABT244 Buffer http://www.nxp.com/documents/data_sheet/ *Courtesy of NXP Semiconductors, Fairchild Semiconductors, Xilinx, Inc., and Altera Corporation.

LM555Timerhttp://www.fairchildsemi.com/ds/LM/LM555.pdf
KA741Op-Amphttp://www.fairchildsemi.com/ds/KA/KA741.pdf

National Semiconductor

ADC0801ADChttp://cache.national.com/ds/AD/ADC0801.pdf
DAC0800DAChttp://cache.national.com/ds/DA/DAC0800.pdf
LM741Op-Amphttp://cache.national.com/ds/LM/LM741.pdf
LM555Timerhttp://cache.national.com/ds/LM/LM555.pdf

STmicroelectronics

27C64 EPROM http://www.st.com/stonline/books/pdf/docs/2388.pdf

TIBPAL16L8PALhttp://focus.ti.com/lit/ds/symlink/tibpal1618-30m.pdf
IEEE 91-1984 Logic Symbolshttp://focus.ti.com/lit/ml/sdyz001a/sdyz001a.pdf

Altera Corp.

EP2C Cyclone II FPGA http://www.altera.com/literature/hb/cyc2/

Atmel Corp.

8051 instruction set http://www.atmel.com/dyn/resources/

Mini-Circuits Inc

ESD Prevention http://www.minicircuits.com/appnote/an40005.pdf

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

(Used with permission from NXP Semiconductors.)

Device Family Data Sheet

This section provides information for board layout designers to successfully layout their boards for Cyclone®II devices. It contains the required PCB layout guidelines, device pin tables, and package specifications. This section includes the following chapters:

IChapter 1. Introduction
IChapter 2. Cyclone II Architecture
IChapter 3. Configuration & Testing
IChapter 4. Hot Socketing & Power-On Reset
IChapter 5. DC Characteristics and Timing Specifications
IChapter 6. Reference & Ordering Information
Revision HistoryRefer to each chapter for its own specific revision history. For information

on when each chapter was updated, refer to the Chapter Revision Dates section, which appears in the complete handbook.

Altera Corporation Section I–1 (Altera is a trademark and service mark of Altera Corporation in the United States and other countries. Altera products are the intellectual property of Altera Corporation and are protected by copyright laws and one or more U.S. and foreign patents and patent applications.)

CII51001-3.2

Introduction Following the immensely successful first-generation Cyclone® device

family, Altera® Cyclone II FPGAs extend the low-cost FPGA density range to 68,416 logic elements (LEs) and provide up to 622 usable I/O pins and up to 1.1 Mbits of embedded memory. Cyclone II FPGAs are manufactured on 300-mm wafers using TSMC's 90-nm low-k dielectric process to ensure rapid availability and low cost. By minimizing silicon area, Cyclone II devices can support complex digital systems on a single chip at a cost that rivals that of ASICs. Unlike other FPGA vendors who compromise power consumption and performance for low-cost, Altera’s latest generation of low-cost FPGAs—Cyclone II FPGAs, offer 60% higher performance and half the power consumption of competing 90-nm FPGAs. The low cost and optimized feature set of Cyclone II FPGAs make them ideal solutions for a wide array of automotive, consumer, communications, video processing, test and measurement, and other end-market solutions. Reference designs, system diagrams, and IP, found at www.altera.com, are available to help you rapidly develop complete end-market solutions using Cyclone II FPGAs.

Low-Cost Embedded Processing Solutions

Cyclone II devices support the Nios II embedded processor which allows you to implement custom-fit embedded processing solutions. Cyclone II devices can also expand the peripheral set, memory, I/O, or performance of embedded processors. Single or multiple Nios II embedded processors can be designed into a Cyclone II device to provide additional co-processing power or even replace existing embedded processors in your system. Using Cyclone II and Nios II together allow for low-cost, high-performance embedded processing solutions, which allow you to extend your product's life cycle and improve time to market over standard product solutions.

Low-Cost DSP Solutions

Use Cyclone II FPGAs alone or as DSP co-processors to improve price-to-performance ratios for digital signal processing (DSP) applications. You can implement high-performance yet low-cost DSP systems with the following Cyclone II features and design support:

IUp to 150 18 × 18 multipliers
IUp to 1.1 Mbit of on-chip embedded memory
IHigh-speed interfaces to external memory
Altera Corporation1–1

February 2008 (Altera is a trademark and service mark of Altera Corporation in the United States and other countries. Altera products are the intellectual property of Altera Corporation and are protected by copyright laws and one or more U.S. and foreign patents and patent applications.)

IDSP intellectual property (IP) cores
IDSP Builder interface to The Mathworks Simulink and Matlab

design environment

I DSP Development Kit, Cyclone II Edition low-cost applications including a wide range of density, memory, embedded multiplier, and packaging options. Cyclone II devices support a wide range of common external memory interfaces and I/O protocols required in low-cost applications. Parameterizable IP cores from Altera and partners make using Cyclone II interfaces and protocols fast and easy.

Features The Cyclone II device family offers the following features:

IHigh-density architecture with 4,608 to 68,416 LEs
GM4K embedded memory blocks
GUp to 1.1 Mbits of RAM available without reducing available

logic

G 4,096 memory bits per block (4,608 bits per block including 512

G Variable port configurations of ×1, ×2, ×4, ×8, ×9, ×16, ×18, ×32,

G True dual-port (one read and one write, two reads, or two

GByte enables for data input masking during writes
GUp to 260-MHz operation
IEmbedded multipliers
GUp to 150 18- × 18-bit multipliers are each configurable as two

independent 9- × 9-bit multipliers with up to 250-MHz performance

GOptional input and output registers
IAdvanced I/O support
GHigh-speed differential I/O standard support, including LVDS,

RSDS, mini-LVDS, LVPECL, differential HSTL, and differential SSTL

G Single-ended I/O standard support, including 2.5-V and 1.8-V, and PCI-X 1.0, 3.3-, 2.5-, 1.8-, and 1.5-V LVCMOS, and 3.3-, 2.5-, and 1.8-V LVTTL

G Peripheral Component Interconnect Special Interest Group (PCI operation at 33 or 66 MHz for 32- or 64-bit interfaces

G PCI Express with an external TI PHY and an Altera PCI Express

1–2Altera Corporation
Cyclone II Device Handbook, Volume 1February 2008

(Altera is a trademark and service mark of Altera Corporation in the United States and other countries. Altera products are the intellectual property of Altera Corporation and are protected by copyright laws and one or more U.S. and foreign patents and patent applications.)

G133-MHz PCI-X 1.0 specification compatibility
GHigh-speed external memory support, including DDR, DDR2,

and SDR SDRAM, and QDRII SRAM supported by drop in Altera IP MegaCore functions for ease of use

G Three dedicated registers per I/O element (IOE): one input

GProgrammable bus-hold feature
GProgrammable output drive strength feature
GProgrammable delays from the pin to the IOE or logic array
GI/O bank grouping for unique VCCIO and/or VREF bank

settings

G MultiVolt™ I/O standard support for 1.5-, 1.8-, 2.5-, and

GHot-socketing operation support
GTri-state with weak pull-up on I/O pins before and during

configuration

GProgrammable open-drain outputs
GSeries on-chip termination support
IFlexible clock management circuitry
GHierarchical clock network for up to 402.5-MHz performance
GUp to four PLLs per device provide clock multiplication and

division, phase shifting, programmable duty cycle, and external clock outputs, allowing system-level clock management and skew control

G Up to 16 global clock lines in the global clock network that drive

IDevice configuration
GFast serial configuration allows configuration times less than

100 ms

G Decompression feature allows for smaller programming file

G Supports multiple configuration modes: active serial, passive

G Supports configuration through low-cost serial configuration

G Device configuration supports multiple voltages (either 3.3, 2.5,

IIntellectual property
GAltera megafunction and Altera MegaCore function support,

and Altera Megafunctions Partners Program (AMPPSM) megafunction support, for a wide range of embedded processors, on-chip and off-chip interfaces, peripheral functions, DSP functions, and communications functions and

Altera Corporation1–3
February 2008Cyclone II Device Handbook, Volume 1

(Altera is a trademark and service mark of Altera Corporation in the United States and other countries. Altera products are the intellectual property of Altera Corporation and are protected by copyright laws and one or more U.S. and foreign patents and patent applications.)

protocols. Visit the Altera IPMegaStore at www.altera.com to download IP MegaCore functions.

G Nios II Embedded Processor support offers a faster power-on-reset (POR) time. Devices that support the Fast-On feature are designated with an “A” in the device ordering code. For example, EP2C5A, EP2C8A, EP2C15A, and EP2C20A. The EP2C5A is only available in the automotive speed grade. The EP2C8A and EP2C20A are only available in the industrial speed grade. The EP2C15A is only available with the Fast-On feature and is available in both commercial and industrial grades. The Cyclone II “A” devices are identical in feature set and functionality to the non-A devices except for support of the faster POR time.

f Cyclone II A devices are offered in automotive speed grade. For more Handbook.

f For more information on POR time specifications for Cyclone II A and Cyclone II Device Handbook.

Table 1–1 lists the Cyclone II device family features. Table 1–2 lists the

Cyclone II device package offerings and maximum user I/O pins.

Technical diagram
1–4Altera Corporation
Cyclone II Device Handbook, Volume 1February 2008

(Altera is a trademark and service mark of Altera Corporation in the United States and other countries. Altera products are the intellectual property of Altera Corporation and are protected by copyright laws and one or more U.S. and foreign patents and patent applications.)

Table 1–1. Cyclone II FPGA Family Features (Part 2 of 2)

FeatureEP2C5 (2)EP2C8 (2)EP2C15 (1)EP2C20 (2)EP2C35EP2C50EP2C70
Maximum user158182315315475450622

I/O pins Notes to Table 1–1:

(1) The EP2C15A is only available with the Fast On feature, which offers a faster POR time. This device is available in

(2) The EP2C5, EP2C8, and EP2C20 optionally support the Fast On feature, which is designated with an “A” in the devices are only available in industrial grade.

(3) This is the total number of 18 × 18 multipliers. For the total number of 9 × 9 multipliers per device, multiply the

Altera Corporation1–5
February 2008Cyclone II Device Handbook, Volume 1

(Altera is a trademark and service mark of Altera Corporation in the United States and other countries. Altera products are the intellectual property of Altera Corporation and are protected by copyright laws and one or more U.S. and foreign patents and patent applications.)

Technical diagram

(1) Cyclone II devices support vertical migration within the same package (for example, you can migrate between the

(2) The Quartus® II software I/O pin counts include four additional pins, TDI, TDO, TMS, and TCK, which are not

(3)TQFP: thin quad flat pack.
(4)PQFP: plastic quad flat pack.
(5)Vertical migration is supported between the EP2C5F256 and the EP2C8F256 devices. However, not all of the DQ

and DQS groups are supported. Vertical migration between the EP2C5 and the EP2C15 in the F256 package is not supported.

(6) The I/O pin counts for the EP2C5, EP2C8, and EP2C15A devices include 8 dedicated clock pins that can be used pins that can be used for data inputs.

(7) EP2C8A, EP2C15A, and EP2C20A have a Fast On feature that has a faster POR time. The EP2C15A is only available

(8) The EP2C5 optionally support the Fast On feature, which is designated with an “A” in the device ordering code. Device Handbook. Cyclone II devices support vertical migration within the same package (for example, you can migrate between the EP2C35, EPC50, and EP2C70 devices in the 672-pin FineLine BGA package). The exception to vertical migration support within the Cyclone II family is noted in Table 1–3.

1–6Altera Corporation
Cyclone II Device Handbook, Volume 1February 2008

(Altera is a trademark and service mark of Altera Corporation in the United States and other countries. Altera products are the intellectual property of Altera Corporation and are protected by copyright laws and one or more U.S. and foreign patents and patent applications.)

Appendix C Explanation of the IEEE/IEC Standard for Logic Symbols (Dependency Notation)*

The IEEE/IEC standard for logic symbols introduces a method of determining the complete logical operation of a given device just by interpreting the notations on the symbol for the device. At the heart of the standard is dependency notation, which provides a means of denoting the relationship between inputs and outputs without actually showing all of the internal elements and interconnections involved. The information that follows briefly explains the standards publication IEEE Std. 91–1984 and is intended to help in the understanding of these new symbols. A complete explanation of the logic symbols is available from Texas Instruments, Inc., in Publication SDYZ001, “Overview of IEEE Std 91–1984.” They also have a publication (SZZZ003) entitled “Using Functional Logic Symbols,” which explains several applications of the symbols.

Explanation of Logic Symbols

F. A. Mann Texas Instruments Incorporated

Contents

1.0 INTRODUCTION 2.0 SYMBOL COMPOSITION 3.0 QUALIFYING SYMBOLS *Courtesy of Texas Instruments, Inc.

Institute of Electrical and Electronics Engineers, Inc. IEEE Standards Office 345 East 47th Street New York, N.Y. 10017 International Electrotechnical Commission (IEC) publications may be purchased from: American National Standards Institute, Inc. 1430 Broadway New York, N.Y. 10018

Appendix D Answers to Odd-Numbered Problems

Chapter 1 (d) Tanks B and C, temperature high

(e) Tank C, temperature and pressure high

1–1. (a) 610 (b) 1110 (c) 910 (d) 710

1–19. (a) sku43 (b) 534B55343316

(e) 1210 (f) 7510 (g) 5510 (h) 18110

(i) 16710(j) 11810
E1–1. (a) 0000 0101(b) Eleven(c) 0E(d) 27
1–3. (a) 318(b) 358(c) 1348(d) 1318

(e) 1558

Chapter 2

1–5. (a) 2310 (b) 3110 (c) 1210 (d) 5810

(e) 41102–1. (a) 0.5 ms(b) 2 ms(c) 0.234 ms
1–7. (a) B916(b) DC16 (e) C616(c) 7416 (g) 1.33 kHz(d) FB16 (h) 0.667 MHz(d) 58.8 ns(e) 500 kHz(f) 10 kHz
1–9. (a) 13410(b) 24410 (d) 17110(c) 14610 (e) 965102–3. (a) 2.16 ms 2–5.(b) LOW
1–11. (a) 9810(b) 6910(c) 7410(d) 3610Cp

(e) 8110

Vout14 V
1–13.0 V
DecimalBinaryOctalBCDHexadecimal4 V

Vout2

(a)350010 00110430011 0101230 V
(b)410010 10010510100 0001298 V
(c)43 (d) (e)0010 1011 78 58053 0100 1110 0011 10100100 0011 116 072 2–7. 1–15. (a) 010 0101 (b) 0100100 0110001 0110100 1–17. (a) Tank A, temperature high; tank C, pressure high2B 0111 1000 0101 1000 V1 = 0V V2 = 4.3V V3 = 4.3V (c) 1001110 0101101 0110110 (d) 1000011 1010000 1010101 (e) 1010000 1100111 2–11. Cp (b) Tank D, temperature and pressure highVout3 4E 3A V5 = 4.3V V6 = 5.0V V7 = 0V V4 = 0.7V 2–9. That diode will conduct raising V7 to 4.3 V (“OR”). 5 V 0 V 3.85 V4 V

Vout

(c) Tanks B and D, pressure high 0 V

2–15. Because, when the transistor is turned onHIGH; otherwise, the output is LOW.
(saturated), the collector current will be(b) The output is HIGH whenever any input

(IC = 5V>RC)

excessiveis HIGH; otherwise, the output is LOW.
3–5. (a)X = ABC(b)X = ABCD

2–17. The totem-pole output replaces RC with a

(c) X = A + B + C

The transistor prevents excessive collector 3–7. A high-level output when turned on.

2–19. (a) 8.0 MHz (b) 125 ns B

2–21. P3 parallel, P2 serial

X 2–23. A HIGH on pin 2 will turn Q1 on, making RESET_B approximately zero.

E2–1. (a) Let (b) 24 A

Cp = 5V>0V,Vout3 = 0V>5V,

E2–3. (a)

B

inverse of each otherCp = 5V>0V,Vout3 = 0V>8V
(b)X

(c) Cp and Vout3 are in phase.

E2–5. (a) V1 = 4.3V,V2 = 0V,V3 = 4.3V,

3–9.

Technical diagram
1010X
11 10 10 11

3–11.

(b) A B C D X

00000B
00010
00 0 01 0 10 1 00 1 0X 0 0
01010A
01 01 10 10 1B 0
10 1 10 0 00 0 10 1 0X 0 0
10 11 11 00 03–13. 0
11 10 11 10 0Clock 012345678
11111Enable
Technical diagram

3–17. Two

3–39. U = Cp,A,B W = B,C

3–19. To provide pulses to a digital circuit for

troubleshooting purposesV = C,DX = Cp,C,D
3–21. HIGH, to enable the output to change with3–41.
Technical diagram

X = 1 3–43. HIGH; to see inverted output pulses

Y = 1 (otherwise, output would always be HIGH). 3–45. There is no problem.

3–31. W = 1

3–47. With all inputs HIGH, pin 8 should be

X = 0 LOW. Next try making each of the 8 inputs Y = 0 LOW, one at a time, while checking for a Z = 0 HIGH at pin 8.

3–33. It enables or disables the other inputs.3–49. AND-74HC08; U3:A=location C2,
3–35.U3:B=location D2 OR-74HC32;

location B7

A = LOW (GND), pin 40 HIGH (+5)

B 3–53. Place probe-A on the input of the inverter

C (WATCHDOG_CLK). Using the same of U4:A. Probe-B should display the

X complement of probe-A.

E3–1. (a) X = 1,Y = 1

D (b) X = 0,Y = 0

(c) A B X A B Y

000000
F010011
100101

Y

1 1 1 1 1 1

E3–5. (a) Vcc (b) Logic pulser (c) Logic probe

(d) Ground (e) Vcc C

E3–7. (a) X = 0,Y = 0

(b)X = 1,Y = 1A
E3–9. (a) Yes(b)X = AB(c) 6mS

Chapter 5

E3–11. (a) NAND (b) NOR

E3–13. (a) X = C¿,D¿,Cp (b) Y = BD¿ 5–1. W = (A + B)(C + D)

X = AB + BC E3–15. (a) U1b, U1c, U1d are bad. Y = (AB + B)C (b) U2a, U2c are bad. Z = (AB + B + (B + C))D E3–17. (a) U1b, U1c are bad.

5–3. (a) A

(b) U2a, U2d are bad. B M

Chapter 4 C

D

4–1. The 7400-series uses hard-wired logic. The (b) A

designer must use a different IC for eachB
logic function. Programmable logicC

N D contains thousands of logic gates that can (c)

be custom configured by the designer toA
perform any logic desired.P
4–3. Hardware Description LanguageB

C

4–5. (a) 3 (b) 5

(d) A B

from a PC and program the on-boardQ
FPGA, which can then be tested withC
actual I/O signals.D
(e)A

4–9. The PLA provides programmable OR gates

for combining the product terms. B

4–11. So it will not lose its programmed logic C

design when power is removedD
(f)A

4–13. The look-up table method

4–15. They must be reprogrammed. B

4–17. It translates the information from the C

S design entry stage into a binary file that is D later used to program the CPLD. 4–19. Text

0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 1 1 0 0 1 1 0 0 1 0

0 0 1 0 1 0 0 0 0 0 1 0 0

0011110110111
X:OUT bit);0100000001000
END and3;0101110111011
4–23.(a)0110100111100

A

X0111111111111
10000 B0 10 00 00 111011

C

1 0 1 0 1 0 0 0 1

A101111011
110010001
BY 11 11 10 01 11 01 00 11 11
C111111111

(c) Distributive law B

5–7. Z

W = (A + B)BCDD
ANC
W = BCB WE ENC

C Z = ABC + CD

X = (A + B)(B + C)A
5–11.X = (A + B)(D + C)
X = B + ACC

X

B 5–13. Break the long bar and change the AND to

an OR, or the OR to an AND.

Y = A + (A + B)BCA5–15. Y and Z are both ORs.
BY

Y = A + BC 5–17. C B A

Z = AB + B + BC A NC A W W = A+B

Z = BBZCCNC
CNC

A B

5–9. B

X X = B+C Y

D B D V C A

V = C(A+D)A
BC

C C 5–19. W

Technical diagram

B (b)

D X = A C

Y 5–33. (a)

Technical diagram

5–35. u. SOP x. SOP

5–23. A v. POS y. POS

Bw. POSz. POS, SOP
C5–37. DX = A + BC Y = B + AC

Z = AC + AB + ABC

5–25. (23) A

(22)ABCD>11X = CD + AC + BY = 1
B5–39. (a)(b)
Technical diagram

1 0 0 1 1 1

10100 1
10110 0pin 9 should be connected to pin 10 (not 9
11000 0to GND).
11011 05–45.WATCHDOG_EN �Qa
11100 1pin6 = P1.0 + A15

5–47. (a)

1 1 1 1 1 0

5–29. (c) quad 2 input AND

(a)

(d)RDis LOW orWRis LOW
(b)B = KD + HD

E5–1. (a)

(c) (b) B = D(K + H) (d) (b) X = BC + A

(b) Y = AB + AB �AB = 1

(c) B 6–9. A7 = 101001110

C4C = 010011000
E5–7.X = AB¿C¿ + A¿BC¿ + AB¿C79 = 011110010
E5–9. (a) 2F3 = 111100111
(b)X = B¿C¿00 = 000000001

FF = 111111111 E5–11. (a) 6

(b)X = B¿ + C¿6–11.
(c)B
X24232221202322212024
Technical diagram

(b) Gate 2

(c) 6–13.

A TRANSMISSION

Technical diagram

B 6–15. Yes; LOW

XEx-OR6–17.
YEx-NORX0

A8 A12 6–5. X1

“AND”A9
A13X4
AX2P3.4

A10 A14 Ex-OR X3 A11

B A15

(b)(f) 162(g) AB45(h) A000
(c)ABXABY7–13. 2CF0H

7–15. b, c, e

000001
0110107–17. For the LSB addition of two binary num-
101100bers
110111©o = OK

7–19. Co = NO

E6–3. (a) Yes, because it is an Ex-OR. 7–21.

A3 B3A2 B2A1 B1A0 B0
E6–5.X = (A¿B + AB¿)BC = A¿BC
E6–7. Because they both have an odd number of 1s.ABCiABCiABCiABCi
FAFAFAFA
CoΣCoΣCoΣCoΣ

Chapter 7

Σ4Σ3Σ2Σ1Σ0
7–1. (a) 1001(b) 1111 0010(c) 1 1100 (d) 100 0010 (g) 10100 1111 7–3. (a) 1 0101(e) 1100 1000 (h) 10110 0000 (b) 10 1010 (d) 1 0001 0001(f) 10010 7–23. (c) 11 1100 (e) 1 1110 1100 0011
NCNCA5B5 (f) 111 0111 0001A4 (g) 1 1001 0011B4A3B3A2B2A1B1A0B0

(h) 111 1110 1000 0001

A4B4A3B3A2B2A1B1A4B4A3B3A2B2A1B1
7–5.+150000 1111-11111 1111 +14 +12NC 0000 1110 0000 1100Cout -2 -4Cin 1111 1110 1111 1100Cout Σ4 NCCin Σ3 Σ67483 Σ2 Σ57483 Σ1 Σ4 +9Σ4 +13 Σ3 +11 +10 0000 1001 +8Σ3 0000 1101 Σ2 0000 1011 0000 1010 -7 0000 1000Σ2 -3 Σ1 -5 -6 1111 1001 -8Σ1 1111 1101 Σ0 1111 1011 1111 1010 7–25. 1111 1000
+7-9A7B7A6B6A5B5A4B4A3B3A2B2A1B1A0B0
Technical diagram
(f)10000001 = -127
(g)01111111 = +127
(h)11111111 = -17–27. The Ex-OR gate third from right is bad.

Also, the full-adder fourth from right is

7–9. (a) 0000 1100 (b) 0000 0110

bad.

(c) 0011 0010(d) 0000 1110
7–29.S3 - S0 = 0100
(e) 0000 1010(f) 0011 1011
(g) 1111 0100(h) 1010 1100(a) 1110(b) 0001

+5 A7•• A0 A4 77 2D FF 1D

Technical diagram

order A = B

(b) Full adder TT A > B The number of HIGH inputs is two or

more.23222120
8–5.0123456789
E7–3. (a) 0011 1011(b) 0111 0000
10011(1 = ON)10111(1 = ON)000001111 11111
E7–5. (a)(b)
000110111 11111
001011011 11111
Chapter 8001111101 11111
010011110 11111
8–1. (a) See top numbers.010111111 01111
011011111 10111

(b) See lower numbers.

011111111 11011
100011 A7B71 A6B61 A5B51 1 A4B41 A3B31 A2B20 A1B11 A0B0
100111 1 11 1 11 0 01 1 1 11 1 11 0 01 0 00 1 1
101001111000011 1

8–7. Active LOW outputs are 0 when selected.

0 100000000Active HIGH outputs are 1 when selected.
1101018–9. 1Time OUT = 1 if A=BLow Output Interval t0-t1 t1-t2 t2-t3 t3-t4 t4-t5Pulse At: None (E3 disabled) None (E3 disabled) 5 4 3

8–3. (a)

t5-t6 2

Technical diagram

(b) 0, 1, 0, 1, 1 EI 8–29. (a) The 74150 is not working. The data select is set for input D7, which is 0. I3

Therefore,Yshould be 1 but it is not.
I4(b) The 74151 is OK. The data select is set

for input I0, which is 1. Y should equal

1 and Y should equal 0, which they do. (c) The 74139 has two bad decoders.

A1 Decoder A is enabled and should outA2 disabled and should output 1111 but EO does not. (d) The 74154 is OK. The chip is disabled,

GS so all outputs should be HIGH, which 8–17. 8–31. (a) Write to memory bank 5, location 3H.

0123456789101112131415(b) Read from memory bank 6, location
1111111111110111

C7H.

1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1

Technical diagram
AD1300
1100AD1400
1001AD1500
20212223AS00
8–19. (a) 1000002(b) 1011102(c) 1101112

(d) 10001002

8–41. 74151

8–21. See #20 (lower numbers). 4 I0 Z 5

PDPD5
10102 = 111111112 = 1000TD3I1
8–23. (a)(b)26
PCI2ZN/C
(c)00112 = 0010(d)00012 = 00011I3

TC

PB15I4
8–25.ATo S0’sTB14I5
BTo S1’sPA13I6
DataTA C12 To S2’sI7
SelectD PD211 A
To E0(Low-order E10 PD3B
multiplexer)PD4 79 EC

To E1 To E2

E8–1. (a) A0 to A3 = B0 to B3

To E3 (b) NOR

Y0 Y1

Y2 Data out

Technical diagram

9–11. 7400:PD = 75mW(max)

E8–9. (a) 00 (b) 11 74LS00:PD = 15mW(max)

E8–11. (a) Switch S1 has no effect on flashing9–13. (a) 7400: HIGH state(minlevels) = 0.4V
speed.LOW state(maxlevels) = 0.4V
(b) Vcc at S1 is open.74LS00: HIGH state LOW state(minlevels) = 0.7V (maxlevels) = 0.3V

E8–13. (a) LED2

(b) SWC(b) The 74LS00 has a wider margin for
(c) SWGthe HIGH state. The 7400 has a wider
(d) 74LS138margin for the LOW state.
E8–15. (a) SWA9–15. The open-collector FLOAT level is made a
(b) SWGHIGH level by using a pull-up resistor.
(c) V09–17. The 7400 series is faster than the 4000B
(d) 74151series but dissipates more power.

9–19. Because MOS ICs are prone to electro-

static burnout.

Chapter 9

9–21. Where speed is most important, ECL is

9–1. D1 and D2 provide some protection againstfaster but uses more power.
negative input voltages.9–23. The 74HC family
9–3. From Figure 9–2(a), there is �0.2 V9–25. Interfacing (c) and (e) will require a pull-
dropped across the 1.6 k, 0.7 V acrossup resistor to “pull up” the TTL HIGH-
VBE3,and 0.7 V across D3, leaving �3.4 Vlevel output to meet the minimum
at the output terminal.HIGH-level input specifications of the
9–5. Negative sign signifies current leaving theCMOS gates.
input or output of the gate.9–27. (a) 10(b) 400

100 nS G D

CLKQ
22 nS15 nS

10–11.

E9–1. (a) HIGH (b) ON, OFF (c) OFF, ON

E

E9–3. (a) 12 ns, 12 ns (b) 6.3 ns, 11 ns

C9–1. (a) 4 mA to 24 mA (b) 2 mA to 8 mA

D C9–3. (a) 1.7 V, 0.7 V, 2.0 V, 0.4 V

(b) 1.17 V, 0.630 V, 1.35 V, 0.45 V Q

Chapter 10

10–15.

Technical diagram
Technical diagram

10–17. The 7474 is edge-triggered; the 7475 is

pulse-triggered. The 7474 has asynchro-

10–3.nous inputs atSDandRD.
G10–19. The triangle indicates that it is an edge-

triggered device as opposed to being pulsetriggered. S 10–21. R

1 VCC 14 +5 V CP

10–5. D

Q G Q

10–7. G D

7GND8CP′
+5 V+5 V
1VCC141VCC14

10–23. The toggle mode

Q 10–25. The 7476 accepts J and K data during the entire positive level of CP, whereas the 74LS76 only looks at J and K at the negaQ tive edge of CP.

7 GND 8 7 GND 8

TriggerCP
SDD

RD Sd′

J Rd′ Q Q1

E10–7. (a) J = 0,K = 1, pulse Cp¿ LOW then

Q2 HIGH

(b)J = 1,K = 0,pulseCp¿LOW then
10–29.HIGH(c) Q toggles each timeCp¿ CPgoes LOW (d) Q stuck HIGH

(e) Set: Pulse S LOW then HIGH; Reset:

SD Pulse R LOW then HIGH Data

Q Cp′

10–31. K

CP Sd′ Q SD Q

Chapter 11

10–33. The ¿373 is a transparent latch. If the tim- 11–1. RD will pass through to Q while E is HIGH Cp and latch on to the data when E goes LOW.

As long as the positive timing pulses areK
very narrow (610 ms), the display will not

Q

flicker. The ¿273 is the preferred device,

11–3. ta = 20ns td = 30ns

10–35. (a) HIGH (b) no (c) Qa must go tb = 30ns te = 20ns

HIGH while WATCHDOG_EN is HIGH. tc = 20ns tf = 30ns 11–5. Proper circuit operation depends on tp of HIGH.)

the 7432 being �10ns. The worst-case tp is specified as 15 ns, but the actual tp may

E10–1. (a) 1, 0 be less. If it’s actually less than 10 ns, the

(b) 0, 1 circuit won’t operate properly. E10–3. (a) Top inverter (b) Vcc (c) None (d) R switch

Rlim RD

35 ns330
CLOCKQ1

J, K Q2 25 ns

CpDQ3
QQ4

Q5

11–9. Q6

Q7

3.6 V Q8 0.2 V

0.7 V 1.9 V 11–25. The switches of U12 and the pull-up resis-

Vin tors are used to place either a HIGH or place a HIGH on one of these lines, the

11–11. corresponding switch must be open. A

closed switch pulls the line to ground. 2.4 V

E11–1. Vt += 1.6V, Vt -= 1.3V

1.7 V

Vin 0.9 V 0.4 V 3.4 V 0V

Vout 1.3V 1.6V

E11–3. (a) Vt += 1.3V, Vt -= 0.83V

tHI = 1.8 volts change Voh = 5V,Vol = 0V tLOW = 2.2 volts change DC = 45% +5V 11–13. It is caused by switch bounce. If the switch

bounces an even number of times, the LED 0V will be off. A debounce circuit would

correct the problem.(b) Yes
11–15. Check the output of the 7805 for+5Vdc.

Check the fuse. If the fuse is OK, you should check for approximately 12.6 V ac

at the transformer secondary and 20 V dc Chapter 12

+ >-

at the output of the diode bridge and the input to the 7805. sequence of digital states triggered by a

11–17. Light: VA = 0.0495V

timing pulse or clock. Combination logic

Dark: VA = 4.55V

11–19. The 7474 can sink 16 mA. Connect thebased on the levels placed at its inputs.
positive lead of the buzzer to+5Vand the
negative lead toQ.When Q is HIGH, the
buzzer is energized via the LOWQoutput.

11–21. Icoil = 240mA

Cp0123456120121122
1JSDQ1JSDQ1JSDQ

RD Cp0

1 K RD 1 K RD 1 K RD D Q 12–19. Q

1 20 1 21 1 22 1 23

Technical diagram

12–21. Q

Technical diagram

12–13. (a) 2 (b) 4 (c) 4 (d) 5 12–23. +5 V to RD

Cp10 kΩ
2022

12–25. Yes, it will work. The inputs to the AND

22 are normally 1–1 until the push button is If either AND input goes LOW, its output goes LOW, resetting the counter. This is

because thedraws less current than
the100@�resistor when the push buttonCPU
01234
is depressed.CPD
01234

12–27. PL

Output TCU

Cp1Q0Q1Q2Q3Cp1Q0Q1Q2Q3TCD
74907492NC
InputCp0 ÷2Cp0 ÷12Q0

Q1

12–29. Q2

60pps749210 pps74901 pps749210 ppm74901 ppmQ3
÷6÷10(60÷6÷105678905432109

Input

ppm) (60 pph)

749210 pph74901 pph74922 ppd74901ppd
÷6÷10(24÷12 ppd)÷2 1Output 101

PL an 1110 when

PL D0 D1 D2 D3

12–31. CpU CpU TCU

74193

NC 202122NCCpDTCDNC
MR Q0 Q1 Q2 Q3Take ÷4 outputCp1Q0Q1Q2Q3from Q2 or TCU

100 Hz

7493+5 V
NCCp0 MR1Output
MR2330 Ω
Technical diagram

12–37. 12–43. (a) HIGH-order U10, LOW-order U9

(b) No(c) By a LOW at the output of
0123456789U3:B

CP 12–45.

74LS19374151(CLK OUT) TO
15P0Q034I0Z5PINS 6 & 10
211P1QB23I16OF M1
10P2QC62I2ZN/C
9P3QD71I3
51215I4
E (CLK IN)4CUTCUN/C14I5
22CDTCD13N/C13I6
+511PL12I7
14MR11
FREQUENCY10A
SELECT9 7B C

E

E12–3. Doesn’t count past 7. Bad MS flip-flop

Q0Q0Q2
E12–5. (a) Mod-10(b) Connect NAND inputsXXZ
Q1Q2 to 2^3 and 2^2. E12–7. (a) Build a circuit similar to Figure 12–35. (b) Use a third 7490 as div-by-10 with 10Q3 (c) 2^2 13–17. Put a switch in series with the phototransis- tor’s collector. With the switch open, the
pps driving itsCP0¿. 7490 is 1 pps.) Make the input to your 00 to 99 counter switch between those two clock speeds. Cp¿ gate before the first(The output of that ing nighttime conditions, causing the yellow light to flash, day or night. (c) Place an AND 13–19. input. Disableinput to inverter 1 will be HIGH, simulat-

it with a NAND gate that outputs a

Cp 0 1 2 3 4 5 6 7 8 9 MR E12–9. S0 S1 MR PL Q0 Cpu

Cpd Q1 Qa

QbQ3
ModeLLLLRRROLRR

Qc L

Qd D 13–21. Tcu'

Technical diagram

L D 13–13.

Cp 0 1 2 3 4 5 6

Technical diagram

MSB LSB allows data to flow in only one direction; a 13–25. The 74164 is a serial-in, parallel-out, transceiver is bidirectional. whereas the 74165 is a serial- or parallel-

in, serial-out, shift register. The 74165 pro-13–33. (a) U4, U12(b) U5, U30, U31, U32,
vides a clock-enable input,CE. input to the 74164 is the logical AND ofThe serial U33U36, U37, U38(c) U3, U6(d) U11,
two data inputs (DsaDsb).13–35. To loadIA0-IA7of U30, valid data must
be placed onBD0-BD7 13–27.by U33, then a LOW to HIGH pulse must be applied to

the CLK input of U30. When pin 3 of

Serial in U13:A is LOW, a HIGH will appear at LE of U33. This allows the valid data at D0–D7

DSRD0D1 D2 D3DSLDSRD0D1 D2 D3DSLto pass through toBD0-BD7.Next, pin 3
S0S0S0S0of U13:A goes HIGH, making LE LOW,74194NCNC S174194 S1S1S1

which causes the data outputs of U33 to re-

CPCPCPCP
MRQ0Q1Q2 Q3MRQ0Q1Q2 Q3main latched. The HIGH at pin 3 of U13:A

also enables the decoder U23. Just before

1 1

Serial out OE 1–0–1 to provide an active output at /IOADDR. This is the clock input for U30,

CPwhich passes the valid data atBD0-BD7of
0123456789101112131415
S0U30 out toIA0-IA7. SHIFT RIGHTTo load SHIFT LEFTID0-ID7of

U32, the same process is followed, except

S1A0–A1–A2 are made 0–1–1 before pin 3 of
SERIAL00101101DONT CARE
INU13:A is made HIGH.

OE

E13–1. (a) 3 (b) R, S, C, S, C, S, C, S

SERIAL FLOAT 1 0 1 1 0 1 0 0 (b) Q^0 Q^1 Q^2 Q^3

Set S1, press C; Set S0, press C;than150ms,let’s say,170ms.That way, if
Set S=1, press C; Set S Set S= = Set S1, press C; 0, press C; Set S =a pulse is missing after = 1, press C; Set S170ms 0, press C; =(the O.S. is not retriggered), the output will go LOW. 0, press C.

VCC

Chapter 14 Rx 12.9 kΩ

Cx = 0.047 μF

14–1. (a) Monostable (b) Bistable

(c) Astable Output

14–3. 75.6ms NPRO

T

14–5. 32.6ms 1

14–7. Because a Schmitt device has two distinct 1

switching thresholds, VT+ and VT-; a regu-74123
lar inverter does not. The capacitor voltagePick Cx = 0.047 μF; Rx = 12.9 kΩ

charges and discharges between those two

levels.14–15.
00.51.01.52.0 time
14–9.(μs)
3.3 VA1

VC

2.0 V B

6 V Q1 Q2

0 V tw1 = 0.20 μs tHI = 126 μs tLO = 160 μs

DC = 44.1% f = 3.5 kHz 14–17. @0�,f = 89.0kHz

DC = 71.0%

14–11. @10k�,f = 39.8kHz

DC = 59.4%

Vin3 μs7 μs
Vout5 μs5 μs14–19.

VCC VCC

RA2618 Ω
Rx7.21 kΩ
784
Cx = 0.001 μFRB5236 Ω2
63Vout
.0022 μF15

C Vout T .01 μF Vin 74121 Pick Cx = 0.001 μF; Rx = 7.21 kΩ

Technical diagram
Technical diagram

14–23. Chapter 15

VCC 15–1. Converts physical quantities into electrical quantities

8.5K 15–3. Very high input impedance, very high volt-

74LS123

15 RCext age gain, and very low output impedance

.05�f15–5. The(-)input is at 0-V potential.
14Cext15–7. (a)20k�,40k�,80k�
1AQ13N/C
2(b)D3 DAV IND2 BD1D0Vout
+53CLRQ4P1.7 OF U8
00000.00
00 E14–1. (a)0 Tcalc = 693mS,1 Tmeas = 700mS-1.25
001 (b)0 DCVtrig = 20%,DCVout = 70%-2.50
001 (c)1 Rext = 722�-3.75
0100-5.00

Ttrigger:Ttot = 1>10kHz = 100

E14–3. mS, 0 1 0 1 -6.25

Thi = 70mS0110-7.50
Tout:50% * 100mS = 50mS,0111-8.75
50mS = .693Rext * Cext,1000-10.00
PickCext = .01mf,Rext = 7220�.1 10 00 11 0-11.25 -12.50
Use those components in a circuit similar1011-13.75
to that in Section 14–5b.1 1 1 11 1 1 10 0 1 10 1 0 1-15.00 -16.25 -17.50 -18.75

15–9. All values of Vout would become positive.

-2.00It then issuesCS1,RD1to transfer the con-
00000.001000
-0.25-2.25verted data to the data bus, thenCS2,WR2,
00011001
0010-0.501010-2.50to transfer the data to RAM.
0011-0.751011-2.7515–33. 2.439 to 2.564 V
0100-1.001100-3.00

15–35. 9.60 kg

0101-1.251101-3.25
0110-1.501110-3.50

15–37.

0 1 1 1 -1.75 1 1 1 1 -3.75

20ADC0801–1
15–13. To convert the analog output current (Iout)7Vin (–)1sbDB018P1.0
VccREFDB117P1.1
of the MC1408 to a voltageANALOG IN6Vin (+)DB216P1.2
DB315P1.3
8DB414P1.4
A–GNDDB513P1.5
15–15. (a) 2.5 V(b) 2.11 V(c) 1.25 VDB612P1.6
msbDB711P1.7
(d) 1.17 V9Vref/25
N/CINTR
10K191
VREF = 7.5V.CLK–RCS2
15–17. By makingThe range of Iout4RD3
CLK–INWR
would then be 0 to 1.5 mA. The range of+150 pf

Vout would be 0 to 7.47 V.

15–19. P2.0

VCC

20ADC0801–2
0007Vin (–)1sbDB018
VccREFDB117VCC
001ANALOG IN6Vin (+)DB216
DB315
3-Bit8DB414R3
010A–GNDDB51310x
DB61211
digital9msbDB7
011N/CVref/2521
output10KINTR
10019CLK–RCS17417C1
(ACTIVE-RD2.001
4CLK–INWR3OC BUFFER
LOW)101+

150 pf

012345678
E15–1. (a)D0 = -1V,D1 = -2V,

Analog input

voltage (in volts) D2 = -4V,D3 = -8V (c) D3, D2, (D2 and D1), (D3 and D1 and

15–21. (a) 0 V (b) They are equal. D0)

(d) 16

15–23. ttot = 8 * 50kHz= 0.16ms (e) 6.25k�

E15–3. (a) Output

15–25. %error = -0.197%

VinHexDec
15–27.CS(chip select) andRD(READ); active-
0.0000

LOW

0.51925
15–29. (a) The three-state output latches (D0 to1.03351
D7) would be in the float condition.1.54C76
(b) The outputs would float andWR(start2.066102
conversion) would be disabled.2.57F127
(c) It issues a LOW at power-up to start3.099153
the first conversion.3.5B2178
4.0CC204

(d) 1.0 V

4.5E5229
15–31. The temperature transducer is selected by5.0 setting up the appropriate code on the ABCFF (b) Yes256

multiplexer select inputs. The voltage level passes to the LF 198, which takes a sample at some precise time and holds the level on the hold capacitor. The LH0084 adjusts the voltage to an appropriate level to pass into the ADC. The microprocessor issues

(c) 60 ns max 16–1. Bipolar, faster; MOS, more dense. 16–19. Address line multiplexing and memory

16–3. Data are being written into memory from refresh cycling

the data bus. Bus contention occurs only 16–21. 2864 when two or more devices are writing to 16–23. the data bus at the same time. 16–5.

RDEN108000 - 8FFF
0EN29000 - 9FFF
WRITEE1 A15 E20 EN3 1ADDR 000 A000 - AFFF ADDR 001

B000 - BFFF

1 E3 2 ADDR 010

3ADDR 011
of eachA12A0
A4ADDR 10074LS374
DA13A1
DA0A05ADDR 101
A14A27
RA1A16ADDR 110

E

SA2A27ADDR 111
S16–25. Address line A15 is stuck LOW.

16–27. The circuit design will be similar except

16–7. CS = LOW,WE = LOW

the 2716 address inputs are A0 to A10. The

16–9. 10, 12, 13 new 74LS138 connections will be as

16–11. (a) 8192 (b) 16,384 (c) 65,536 follows:

(d) 16,384

16–13.CSis not held LOW long enough. TheRDEN10To EPROM1(0000 - 07FF)
access time(tacs)for the 2147H is given inA15 Figure 16–6(a) as 35 ns minimum. To cor- rect, increase the LOWEN2 A14 CSTo EPROM2(0800 - 0FFF) EN3 pulse to 35 nsTo EPROM3(1000 - 17FF) To EPROM4(1800 - 1FFF)

or more.

A11 A0

A12A1
multiplexed to minimize the IC pin count.A13A2

16–17. (a)

16–29. Read cycle:

Technical diagram

Din Valid data in

16–33. (a) Hard disk (b) DVD (LDA); (2) and (3) Pulse: read address

32k * 8 bytes at 2001, 2002 (4000H); (4) Pulse: read data at address 4000H

16–37. (a) 8k * 8 (b) SMN_SEL, MON_SEL

17–17. A high-level language (FORTRAN, BASIC,

(c) A000H–BFFFH (d) E000H–FFFFH

E16–1. (a) The D flip-flop only captures data atwrite and understand. Its disadvantage is
the instant C is pressed.that the programs are not memory efficient.

(b) Outputs are all stuck LOW. 17–19. (a) LOW (b) LOW

Chapter 17 (c) HIGH

(d) HIGH 17–1. A microprocessor-based system would be 17–21. U6a and U6b are drawn as inverted-input used whenever calculations are to be made, NAND gates to make the logical flow of decisions based on inputs are to be made, a the schematic easier to understand. memory of events is needed, or a modifi-

17–23. (a) IN instruction, RD is pulsed LOW.

(b) OUT instruction, WR is pulsed LOW.

17–25. (1) A8toA15 = FEH

lar location or device within the system.

(2) IO/M = HIGH

(3) WR is pulsed LOW/HIGH 74LS244

17–29. 2010 3E

I0O0201104
I1O120123D
I2O22013CA
FromI3O3To201410
InputData2015 I4 Switches20 O4 Bus
I5O5 CE from address decoder2016 2017 I6 2018 I7C3 12 O6 20 O7
RD from17–31. OEa AD3 AD4 AD5 AD11 AD12LCD_SL OEb 0 0 0 1 1KEL_SL μp control bus 1 0 0 1 1

17–7. The input port has three-stated outputs so

AD1300
that it can be disabled when it is not beingAD1400
read.AD1500

17–9. 216(65,536)

E17–1. (a) LOW

17–11. It stores the contents of the accumulator (b) Press C

(c) Put 7C on the switches, make OE¿ = 0 (data appear on the data bus), press C 17–13. Instruction decoder and register: register

[data appear at output port if OE¿ (G) is LOW]. receives the machine language code and produces the internal control signals re-

quired to execute the instruction. Chapter 18

18–1. Because it has RAM, ROM, I/O Ports, and

a Timer/Counter on it 18–3. Extra 4 K ROM, 128 bytes RAM, 16 bit Timer/Counter, 1 interrupt

18–7. 80H-FFH ADD A,#05H

MOV P1,A 18–9. By reading the two bank-select bits

(D0H.3, D0H.4) in the PSW18–21.
18–11. (a)A = 40H(b)A = 88H
(c)A = 88H(d)A = 40HX8

A8

18–13. (a) MOV P3,#0C7H (b) MOV R7,P1 A12

(c) MOV A,#55H (d) MOV A,@R0

(e) MOV P0,R1A9
A13X4

18–15. START: MOV A,#20H

LOOP: MOV P1,A X2 P3.4

INC A A14 X3

JMP STARTA11
A = 75HA = F5HA15
18–17. (a)(b)

X4 (c) A = EBH

Appendix E VHDL Language Reference

Library-Entity-Architecture Model

Figure E–1 is a sample VHDL program showing the syntax rules and language format of a basic program.

Technical diagram

Figure E–1 VHDL program model showing the syntax for Library, Entity, and Architecture

Program, Entity, and Architecture Naming Conventions

Valid VHDL names can consist of letters, numbers, and the underscore (_) character [hyphens (-) are not allowed]. The name must start with a letter and cannot contain spaces.

Valid Names Invalid Names

fig4_13fig4-13(cannot use hyphen)
boolean3boolean 3(cannot use space)
counter_5_acounter_5.a(cannot use period)

Comments can be placed within a VHDL program to document a particular statement or group of statements. Any words preceded by a double hyphen (--) are considered to be a comment for documentation purposes and will be ignored by the VHDL compiler.

Sample Comments

-- Boolean solution to example 5-3 -- Problem C5-3 --

General VHDL Rules

VHDL logical operators have no order of precedence so the order must be explicitly

defined using parentheses. For example, the Boolean equation x = a + bc must be sult of the operation on the right-hand side to the left-hand side.) Also note that VHDL is not case-sensitive so the letters a, b, and c could have been capitalized, but the convention used by most VHDL programmers is to only capitalize the reserved keywords like AND, OR, PORT, ENTITY, and so on. (See Figure E–1.)

Logical Operators

The logic operators are used to perform Boolean bit-wise operations on individual bits or arrays of bits. (Example: x 6= a AND b;)

Operator Description

ANDAnd
OROr
NANDNot-And
NORNot-Or
XORExclusive-Or
XNORExclusive-Nor
NOTComplement

Relational Operators

The relational operators are used to test the relative values of two scalar types. The result is a Boolean true or false value. [Example: IF a * b THEN result *�"001". This is interpreted as “if the logic (a less than b) is true, then the bit string "001" is moved to the variable result.”]

Operator Description

=Equality
/=Inequality
6Less than
6=Less than or equal
7Greater than
7=Greater than or equal

The arithmetic operators are used to perform mathematical operations. (Example: sum_ string6=astring+bstring+cin;) The following is a partial list of the arithmetic operators.

Operator Description

+Addition
-Subtraction
&Concatenation
*Multiplication

> Division

**Exponentiation
modModulus
remRemainder
absAbsolute value
sllShift left
srlShift right

Data Types

The data type defines the type of value that can be used with the specified input, output, or internal signal. The most common data types used are as follows:

Type Values

bit'0', '1'
std_logic'0', '1', 'U', 'X', 'Z', 'W', 'L', 'H', '-'
integerInteger values
bit_vectorMultiple instances of '0', '1"
std_vectorMultiple instances of '0', '1', 'U', 'X', 'Z', 'W', 'L', 'H', '-'

std_logic Data Type Values

The values that the std_logic data type can have are defined as follows:

Value Description

'0'Logic 0
'1'Logic 1
'U'Uninitialized
'X'Unknown
'Z'High impedance
'W'Weak unknown
'L'Weak 0
'H'Weak 1
'-'Don’t care

fig5_62.vhd A vector with 3 elements Selected signal assignment for i = 3, 2, 1 then 0 ex6_10.vhd Loop 4 times

input (0) input (1) input (2) (c,d)

Figure 6–24

output level sent to XFigure 5–62
DeclareSIGNAL"input"beforeBEGINMakeassignmentsafter BEGINNote: Singlequotes for bits anddouble quotesfor vectors

Declare which VHDL Entity name

library to useNote: VHDL has no order
of precedence soproper grouping.

parentheses are required for Define the logic

Architecture name ex5_17.vhd

3-bit internal SIGNAL result

Assign vector elements compare_8b.vhd a2

albaeb
agbto outputs

y0 y7 Sensitivity list

Figure 8–19

Figure 8–5

Technical diagram
Technical diagram
Technical diagram
Technical diagram

4-bit output Asynchronous Reset has priority Negative clock edge

Input and output mod16up.vhd Defines a new the allowable

Assign binary to q state_gray.vhd

to next state. based on value

Input to equation of state.

Appendix F Review of Basic Electricity Principles

Definitions for Figure F–1

through a pipe R

+ I –

Figure F–1 Series circuit used to illustrate Ohm’s law.

voltage = volts(V), for example, 12 V, 6 mV
current = amperes(A), for example, 2 A, 2.5 mA
resistance = ohms(�),for example,100�,4.7k�

Common Engineering Prefixes

Prefix Abbreviation Value

Mega-M1,000,000 or 106
kilo-k1,000 or 103
milli-m0.001 or 10-3
micro-m0.000001 or 10-6

The current (I) in a complete circuit is proportional to the applied voltage (V) and inversely proportional to the resistance (R) of the circuit (see Figure F–2). Formulas I =V R V = I * R R =V I V

IR
Figure F–2Ohm’s law circle.

EXAMPLE F–1

(a) Determine the current (I) in the circuit of Figure F–1 if V = 10V and

(b) Recalculate the current if R = 4�.

doubled to 4� in (b). R = 10�. (e) What voltage would be required in (d) if you only need one-half that current?

(f) If V = 12V in Figure F–1, what resistance is required to limit the cur(g) To limit the current to 1 A in (f), what resistance would you need?

Solution:

I =VR= 10V
(a)2�= 5A
I =VR= 10V
(b)4�= 2.5A

(c) As the resistance to current flow doubled, the current dropped to one-half.

(d)V = I * R = 2A * 10�= 20V
(e)V = I * R = 1A * 10�= 10V
Note

Note we only need one-half the voltage to get one-half the current.

R =VI= 12V
(f)2A= 6�
R =VI= 12V
(g)1A= 12�
Note

Note that, to reduce the current to 1 A, we needed to increase the circuit’s

resistance.

Apply the values listed below to the circuit of Figure F–1 to determine the unknown quantity.

(a) I=2 mA,R=4 k�,V=__________?
(b) I=6 mA,R=200 k�,V=__________?
(c) I=24 mA,V=12 V,R=__________?
(d) I=100 mA,V=5 V,R=__________?
(e) V=5 V,R=50 k�,I=__________?
(f) V=12 V,R=600 �,I=__________?

Solution:

(a)V = I * R = 2mA * 4k�= (2 * 10-3A) * (4 * 103�) = 8V
(b)V = I * R = 6mA = 200k�= (6 * 10-6A) * (200 * 103�) = 1.2V
R =V12V12V
(c)I=24mA== 500k�(or0.5M�)

24 * 10-6A

R =V5V
(d)I=100mA= 50�
I =V5V
(e)R=50k�= 100mA
(f) I =V12V
R=600�= 20mA

EXAMPLE F–3

A series circuit has two or more resistors end to end. The total resistance is

equal to the sum of the individual resistances (RT = R1 + R2). Also, the

age(VS = VR1 + VR2).
Find the current in the circuit (I), the voltage across R1(VR1),and the
voltage across R2(VR2)in Figure F–3.
R18 kΩVR1

I

VS10 V
R22 kΩVR2
Figure F–3A series circuit used to derive the voltage divider equation.

Solution:

RT = 8k�+ 2k�= 10k� 10V

I = 10k�= 1mA VR2 = 1mA * 2k�= 2V

Notice that the voltage across any resistor in the series circuit is proportional to the size of the resistor. That fact is used in developing the voltage- divider equation: R2 VR2 = VS * R1 + R2 2k� = 10V * 2k�+ 8k� = 2V

EXAMPLE F–4

Use the voltage-divider equation to find Vout in Figure F–4. (Vout is the voltage from the point labeled Vout to the ground symbol.)

R14 kΩ
VS12 V

Vout

R22 kΩVout
Figure F–4Circuit used to calculate the output voltage (Vout) with respect

to ground. Solution: 2k� Vout = 12V * 2k�+ 4k� = 4V

EXAMPLE F–5

A short circuit occurs when an electrical conductor is purposely or inadvertently placed across a circuit component. The short causes the current to bypass the shorted component. Calculate Vout in Figure F–5. 4 kΩ Vout

12 V 2 kΩ Short Ground (V = 0)

Figure F–5A short circuit across the2k�resistor forces the output to zero V.
Solution: Vout is connected directly to ground; therefore,Vout = 0V. of the 12-V supply is dropped across theAll 4@k�resistor.
Technical diagram

EXAMPLE F–7

An open circuit is a break in a circuit. This can be done purposely by an electronic switching component, or it could be a circuit fault caused by a bad connector or burnt-out component. This break will cause the current to stop flowing to all components fed from that point. Calculate Vout in Figure F–7. Open 4 kΩ I =0A 12 V Vout 2 kΩ

Figure F–7An open circuit causes current to stop flowing.
Solution: BecauseI = 0A,

V2k�= 0A * 2k�= 0V Vout = V2k�= 0V

Calculate Vout in Figure F–8.

I =0A 4 kΩ 12 V 2 kΩ Open

Figure F–8 An open circuit below the measurement point allows the entire

Solution: Because I = 0A,

Vdrop(4k�) = 0A * 4k�= 0V Vout = 12V - Vdrop = 12V

Note:

This is probably the hardest concept to understand. Another way to explain why the entire supply reaches Vout is to assume that an open circuit can be

modeled by an extremely large resistance, let’s say,10M�.If you then ap-
ply the voltage-divider equation to the circuit with10M�in place of the

open, the calculation will be 10,002,000

Vout = 12V * 10,002,000 + 4,000= 11.995V The symbol for a battery is seldom drawn in schematic diagrams. Figure F–9 is an alternative schematic for a series circuit. Solve for Vout. +12 V 4 kΩ Vout 2 kΩ

Figure F–9 Series circuit drawn without the battery symbol. 2k� Vout = 12V * 2k�+ 4k� = 4V

A relay’s contacts or a transistor’s collector–emitter can be used to create opens and shorts. Figure F–10(a) uses a relay to short one resistor in a series circuit (relay operation is described in Section 2–6). Sketch the waveform at Vout in Figure F–10(a). +12 V 4 kΩ Vout

R12 kΩ
Cp5 VR1

0 V (a) 5 V Cp 0 V

R1R1
energizedde-energized

4 V Vout 0 V (b)

Figure F–10 Using a relay to intermittently short the 2@k� resistor.

2@k� resistor and making Vout = 0V. When the coil is deenergized, the 2k� Vout = 12V * 2k�+ 4k� = 4V The clock oscillator (Cp) and Vout waveforms are given in Figure F–10(b).

Review Questions

F–1. What value of voltage will cause 6 mA to flow in Figure F–1 if

R = 2k� (3 V, 0.333 V, or 12 V)? _________ (increased/decreased). F–3. In a series voltage-divider circuit like Figure F–3, the larger resistor will have the larger voltage across it. True or false?

VR2 will be close to __________ (0 V/10 V). _________ (6 V/12 V). F–6. A short circuit causes current to stop flowing in the part of the circuit not being shorted. True or false? F–7. The current leaving the battery in Figure F–5 _________ (increases, decreases) if the short circuit is removed. F–8. The short circuit in Figure F–6 causes Vout to become 12 V because

the current through the2@k�resistor becomes 0 A. True or false?
F–9. In Figure F–7, the voltage across the2@k�resistor is the same as that
across the4@k�resistor. True or false?
F–10. If the4@k�resistor in Figure F–8 is doubled, Vout will _________

(increase/decrease/remain the same)?

Answers to Review Questions

F–1. 12 V F–6. False

F–2. Decreased F–7. Decreases

F–3. True F–8. False

F–4. 0 V F–9. True

F–5. 6 V F–10. Remain the same

Problems

F–1. Refer to Figure F–1 to solve for the unknown quantities in the fol-

lowing table. [Example: For part (A), calculate the resistance if V = 12V

VoltageCurrentResistance
A12 V4 A
B8 V2 A
C100 V20�
D6 V2�
E6 A2�
F0.5 A5�

F–2. Repeat problem 1 for the following table.

VoltageCurrentResistance
A12 mV3mA
B6 V2 mA
C100 mV20k�
D8 V2M�
E6 mA3k�
F0.5mA5k�

lowing table.

VSR1R2Vout
A18 V6k�3k�
B18 V3k�6k�
C12 V20k�20k�
D6 V1k�100k�

F–4. Refer to the original Figure F–4 to solve for Vout given the following open- and short-circuit conditions. Vout

AShort R1
BShort R2
COpen R1
DOpen R2

Answers to Problems

F–1(a). 3� F–3(a). 6 V

F–1(b). 4� F–3(b). 12 V

F–1(c). 5 A F–3(c). 6 V

F–1(d). 3 A F–3(d). 5.94 V

F–1(e). 12 V

F–1(f). 2.5 V F–4(a). 12 V

F–4(b). 0 V

F–2(a). 4k� F–4(c). 0 V

3k� F–4(d). 12 V

F–2(b).

F–2(c). 5mA

F–2(d). 4mA

F–2(e). 18 V

F–2(f). 2.5 mV

Appendix G Schematic Diagrams for Chapter-End Problems

(This item omitted from WebBook edition)

(This item omitted from WebBook edition)

(This item omitted from WebBook edition)

(This item omitted from WebBook edition)

(This item omitted from WebBook edition)

(This item omitted from WebBook edition)

(This item omitted from WebBook edition)

(This item omitted from WebBook edition)

(This item omitted from WebBook edition)

Appendix H 8051 Instruction Set Summary*

*Courtesy of Intel Corporation.

Index

555 IC timersADC controllersschematic symbol, 63
astable operation, 698–704implementation, 605timing analysis, 68
block diagram, 699process state diagram, 606truth tables, 63, 65
monostable operation, 704–707simulation file for, 608AND-OR-INVERT gates, 201–205
one-shot operation, 705state machine implementation, 607configurations, 203
8051 microcontroller, 816–847. See alsoAdder circuitsdefined, 202, 214
Microcontrollersbasic, 276in SOP implementation, 204
addressing modes, 825–826BCD, 290–292Answers, problem, 893–916
ALE/PROG, 819block diagrams, 280–281AOIs. See AND-OR-INVERT gates
analog-to-digital converter interface, 835full-adder, 277–280Applications
applications, 831–835half-adder, 276–2778051 microcontroller, 831–835
architecture, 817–822VHDL, 285–287alarm encoder for microcontroller, 360–361
arithmetic operations, 830–831Additionanalog multiplexer, 362–363
assembly language, 826binary arithmetic, 261–262BCD adder circuit, 290–292
block diagram, 818hexadecimal, 271–273controlled inverter, 245–247
data acquisition and control system application,two’s complement, 270counter circuits, 564–570
835–845Address bus, 796, 810data acquisition and control system, 835–845
EA/VPP, 820Address decoders, 796data acquisition system (DAS), 738–741
family, 817Address decoding, 778, 779, 788digital LCD thermometer, 782–783
with input/output, 837Address spaces, 820–821FPGA, 147–150, 295–301
instruction set, 825Addresses, 359, 369Karnaugh map, 211–213
instruction set summary, 942–946Advanced Low-Power Schottky (ALS), 404microprocessor address decoding, 359–360
instruction timing, 831Alphanumeric data, 18, 23multiplexed display, 363–364
interfacing external memory to,Altera CPLDs, 115numbering systems, 20–22
823–824Altera Cyclone II family, 420–421parallel binary comparator, 245
keyboard interface, 834Altera LPM flip-flop, 467–469parity error-detection system, 244
logical and bit operations, 827–829ALUs. See Arithmetic logic unitsPROM look-up table, 781–782
module, 836–838Analog comparators, 520–521sequential, 536
pin configuration, 819Analog multiplexer switch, 740serial data multiplexing for microcontroller,
port 0, 818Analog multiplexer/demultiplexer, 357–358361–362
port 1, 818Analog representation, 717–718shift registers, 647–651
port 2, 819Analog systems, 3, 23S-R flip-flop, 434
port 3, 819Analog waveforms, 4, 5, 6synchronous counter ICs, 592–595
program branch instructions, 826–827Analog-to-digital converters (ADCs), 5, 7, 604,two’s-complement adder/subtractor circuit,
PSEN, 820717287–289
RST, 8198051 microcontroller interface, 835Application-specific integrated circuits (ASICs),
time delay, 831–835counter-ramp, 729–730116, 121
XTAL1, XTAL2, 820data acquisition system (DAS), 740–741defined, 150–151
8085A microprocessor, 798–808. See alsodefined, 717, 747hard-coded logic function, 121
Microprocessorsintegrated-circuit, 733–738Architecture, 799, 810
architecture, 799, 810interface module, 838Architecture body, 124, 150
assembly language, 807interfacing linear temperature sensor to, 743Arithmetic
basic I/O, 803–805MultiSIM simulation, 737–738BCD, 274–275
CPU, 800need for, 717binary, 261–266
CPU functional block diagram, 799op amp, 718hexadecimal, 271–274
design, 798parallel-encoded, 728–729two’s complement, 269–270
features, 798–799specification definition, 727Arithmetic circuits, 275–281
LDA instruction execution, 801successive-approximation, 730–733adder, 276
machine language, 807–808AND gates, 63–65block diagrams, 280–281
pin configuration, 799associative law of multiplication for, 162full-adder, 277–280
STA instruction execution, 802Boolean equation, 64half-adder, 276–277
AC waveforms, 485, 526commutative law of multiplication for, 162MSI, 275
Accelerometers, 523defined, 63Arithmetic logic units (ALUs), 292–295, 798
Accumulatorselectrical analogy, 64defined, 292, 302, 798, 810
defined, 798, 810enable/disable functions, 70–72function select, 292
load, 801–802forming from two NAND gates, 196function table, 293
store, 802–803in ICs, 73–74logic symbol, 293
Active clock edge, 486, 526inverted-input, 178, 179mode control, 292
Active-LOW, 189, 214, 442, 470MultiSIM analysis, 68–69Arithmetic operations, 830–831
Note

Note: Page numbers in boldface type indicate end-of-chapter glossary definition for the term.

ASICs. See Application-specific integrated circuitscommutative law of addition and multiplication,BCD-to-seven-segment, 343
(ASICs)162defined, 343, 369
Assemblers, 805, 810, 847distributive law, 162Gray code, 345
Assembly languagelaws and rules, 162–166Column address strobes (CAS), 788
defined, 798, 810laws and rules summary, 166Combinational logic, 157–162, 430
mnemonics, 807ORed rules, 164–165circuit simplification, 167–172
programs, writing, 805–808Boolean equationsdefined, 157, 215, 470
Associative law of addition and multiplication,defined, 96encoder design with, 331
162drawing digital logic for, 132–133with multiplexers, 352–353
Astable multivibrators, 685–687AND gate, 64Common-anode LED display, 570–571, 612
555, 698–704inverter, 80Common-cathode LEDs, 571
defined, 681NAND gate, 81Commutative law of addition and multiplication,
MultiSIM simulation, 703NOR gate, 84162
operation, 685–686OR gate, 65Comparators, 313–316, 709
Schmitt trigger, 685Boolean reductionsanalog, 520–521
Asynchronous, 435, 470defined, 157, 214binary, 313
Asynchronous counters, 543, 612equation forms, 201defined, 245, 253, 313, 369
ATM-thermal printer interface, 608–611VHDL proof, 158–162LPM, 365–366
Automatic Reset, 502–503, 526Borrows, 262, 302 Bubble pushing, 188–189magnitude, 313–314, 370 symbols, 698
BASIC language, 806, 807, 810Buffers, 401, 781VHDL, using IF-THEN-ELSE, 316–318
BCD addersdefined, 422, 656, 667, 788Compilers, 122, 151, 805, 810
correction, using IF-THEN-ELSE, 298–299octal IC, 781Complement, 80, 96, 432, 470
defined, 290three-state, 656–657Complementing switch, 287
IC, 291Burn in, 707, 709Complex programmable logic devices (CPLDs),
illustrated, 290Bus contention, 757, 788116, 119
MultiSIM simulation, 291–292Buses, 247, 363, 733Altera, 115
BCD decoders, 318, 324address, 796, 810connecting multiple I/O to, 523–524
BCD-to-binary conversion, 340–343control, 740, 796, 811defined, 119, 151
BCD-to-seven-segment decoder, 572–573data, 32, 656, 667, 740, 796, 811internal structure of, 119
Bias, 43, 56defined, 253, 369, 747nonvolatile characteristic, 119
BiCMOS, 409, 422external, 796Components, 662, 667
Bidirectional, 657, 667Bytes, 755, 788 data bus, 796, 810Concatenation, 329, 369, 455, 470 Concurrent assignments, 251
I/O ports, 847CAD (computer-aided design), 151Concurrent statements, 278, 302
outputs, 357, 369CapacitorsConditional jump, 807
Binary addercharge/discharge rates, 681–685Conditional signal assignments, 296, 302
block diagram, 281charging formula transposition, 682Continuous conversions, 730, 747
MultiSIM simulation, 284–285in time durations, 681Control buses, 796, 811
Binary arithmetic, 261–266voltage, 683, 685Controlled inverters, 245–247, 253
addition, 261–262Carry-in, 261, 302circuit illustration, 246
division, 265–266Carry-out, 261, 277, 302defined, 245
multiplication, 264–265CAS (column address strobes), 788FPGA, 250
subtraction, 262–264Cascade, 541MultiSIM simulation, 246–247
Binary numbering system (base 2), 8–10CASE statements, 455Conversion
conversion to hexadecimal, 15–17CDs (compact discs), 786BCD-to-binary, 340–343
defined, 23Cells (Karnaugh map)continuous, 730
hexadecimal conversion to, 15adjacent, 206–207, 214d, 343
Binary strings, 245, 253defined, 205, 214data, 628
Binary weighting factors, 8–10, 719, 747input variable correspondence, 205Gray code, 344–345
Binary words, 281, 302number determination, 205parallel-to-serial, 629
Binary-to-coded-decimal system (BCD), 17–18Celsius thermometer, 841–843serial-to-parallel, 631–633
addition, 274–275Central processing units (CPUs), 798,time, 730, 747
arithmetic, 274–275810Conversion time, 747
conversion, 17–18Charge/discharge rates, 681–685Counter-ramp A/D converters, 729–730
defined, 17Chip Planner, 174, 176, 214Counters
Binary-to-octal decoding, 319–320Chips, 50, 56asynchronous, 543, 612
Bipolar transistors, 45–48, 405, 422Clock Enable, 650, 667divide-by-N, 548–559, 612
Bistable multivibrators, 681Clock waveformdown-counter, 546–547
Bit-addressable memory, 822, 847frequency, 30glitch-free, 558–559
Bits (binary digits), 11, 23period, 30Gray code, 600–601
Block Design File (bdf), 131–132periodic, 29–30Johnson shift, 633–635
Block diagramstiming, 29–31LPM, 599–600
555 IC timer, 699Clocks, 441, 470modulus of, 537
8051 microcontroller, 818Closed-loop feedback circuitry, 651, 667MSB, 567
adder circuit, 280–281CMOS (complementary metal oxideprogram, 800, 811
arithmetic circuit, 280–281semiconductor)ring shift, 633–635
binary adder, 281advantages, 3ripple, 541–548, 613
decoders, 327availability, 408–410synchronous, 543, 579–583, 613
defined, 280, 302comparing logic families, 412–413up-counter, 547–548
full-adder, 280defined, 53, 56, 406, 422up/down, 583–591, 613
half-adder, 280devices, handling, 407VHDL, 595–598
monostable multivibrator, 688gates, 95CPLDs. See Complex programmable logic devices
octal decoder, 327hex inverter, 53, 54CPUs (central processing units), 798, 810
shift register, 627interfacing to TTL, 415–416Crystal, 707, 710
two-gate, 688logic family, 405–410Crystal oscillators, 707–708
Block editors, 122, 151multiplexers, 347Current
Boolean algebra, 162–172NAND gates, 407input/output, 388–391
ANDed rules, 163–164NOR gates, 407sink, 389, 423
associative law of addition and multiplication, 162TTL interfacing to, 414–415source, 389, 423
device family data sheet, 881–887defined, 7, 23DVDs (Digital Versatile Disk), 787
family, 420–421hexadecimal conversion to, 16Dynamic RAMs (DRAMs), 765–771
propagation delay, 500–501number system conversion to, 8 Decimal-to-BCD encoders. See also Encoderscontrollers, 768–770 data sheet, 767
D flip-flops, 441–450. See also Flip-flopsfunction table, 332defined, 758, 765, 788
with asynchronous Set and Reset, 448–450illustrated, 332delay lines, 769, 770
creating with block design method, 446MultiSIM simulation, 334–335memory cell, 765–766
for debouncing, 512, 513truth table, 331Read cycle timing, 768
defined, 436Decimal-to-binary conversion, 10–12Refresh cycle timing, 768
function table, 442Decoders, 800refresh period, 766
gated, 436–4371-of-8, 320sample, 770
IC, 441–4433-line-to-8-line, 320storage capacitor, 766
from J-K flip flop, 462BCD, 318, 324 MultiSIM simulation, 443Write cycle timing, 768 block diagrams, 327
octal, 465–466, 657defined, 318, 369ECL. See Emitter-coupled logic
simulation file for, 448, 450hexadecimal, 324–325Edge-triggered devices, 441, 470
VHDL description, 445–448implemented in VHDL, 326–330Edge-triggered J-K flip-flops, 453–457
D latches, 437–441instruction, 800, 811defined, 453
IC, 437–439LPM, 366–367function table, 454
simulation file for, 440octal, 321–324, 327–330negative edge, 453
VHDL description, 439–440DecodingVHDL description, 455–457
VHDL design file, 4403-bit binary-to-octal, 319–320Electrical noise, 238, 253
Data acquisition and control system application,defined, 318Electrically erasable PROM (EEPROM), 772, 774,
835–845microprocessor address, 359–360777, 788
8051 microcontroller module, 836–838DecouplingElectricity
ADC interface module, 838defined, 403, 422engineering prefixes, 924
applications, 841–845power supply, 403, 515Ohm’s law and, 925–930
celsius thermometer, 841–842Delay lines, 769, 770, 788open circuits, 928
DAC interface module, 838–841Delay-gate ICs, 490principles, 924–932
hardware, 836–841Demultiplexers, 354–358. See also Multiplexersseries circuits, 926
integrating solar radiometer, 843–845analog, 357–358units, 924
temperature-dependent PWM speed control,configurations, 355voltage-divider equation, 927
843connections, 357Electromagnetic interference (EMI), 403, 422
Data acquisition system (DAS), 738–741as data distributor, 354Electrostatic discharge (ESD), 407
analog multiplexer switch, 740defined, 354, 369Emitter-coupled logic (ECL), 410–412, 422
analog-to-digital converter, 740–741functional diagram, 355comparing logic families, 412–413
defined, 738, 747logic symbol and diagram, 356interfacing, 418
illustrated, 739waveform simulation editor, 355logic family, 410–412
programmable-gain instrumentation amplifier,Dependency notation, 888OR/NOR gate, 410–411
740Differential amplifiers, 410, 422series, 410
sample-and-hold circuit, 740Differential measurements, 736, 747supply voltage, 410
Data bits, 626, 667Differential nonlinearity, 727Enable function
Data buses, 656, 733, 796Digital representation, 3–6, 717–718defined, 70, 97
bidirectional, 796Digital sequencers, 633, 667MultiSIM simulation, 72
defined, 32, 667, 811Digital signals, 29–31AND/OR gates, 70–72
Data conversion, 628, 667clock waveform timing, 29–31Enabled, 434, 451, 470
Data loggers, 6, 7illustrated, 29Encoders
Data selectors. See Multiplexerstiming diagram, 29decimal-to-BCD, 331
Data sheets, 491–494, 852–887Digital states, 451, 470defined, 331, 369
74ABT244 octal buffer/line driver (3-state),Digital systems, 3, 23design with combinational logic, 331
867–870Digital waveforms, 4, 6for microcontroller, 360–361
74HC00 quad two-input NAND gate, 854–862Digital-to-analog converters (DACs), 5, 717octal-to-binary, 335–337
74LV00 quad 2-input NAND gate, 863–866binary-weighted, 719–720priority, 335, 370, 729
7400 quad two-input NAND gate, 393–395defined, 717VHDL octal priority, 338–339
7476/74LS76 dual J-K flip-flop, 491–494integrated-circuit, 723–726Encoding, 331–339
Cyclone II device family, 881–887interface module, 838–841Energized relay coils, 39, 56
KA741 single operational amplifier, 871–874MultiSIM simulation, 725Engineering prefixes, 924
LM555 single timer, 875–880op amp, 718Entity declaration, 124, 151
Web site links to, 852–853R/2R ladder, 720–722Enumeration types, 600, 612
Data transfer rate, 786specification definition, 727Equivalent circuits
Data transmission, 655, 667Diodes, 37defined, 162, 215
Data types, VHDL, 919defined, 42–43, 56distributive law for, 163
De Morgan’s theorem, 177–191forward-biased, 43, 44NAND gates for, 197
active-LOW, 189, 214reverse-biased, 43TTL NAND, 386–388
bubble pushing, 188–189, 214as switches, 42–45Erasable-programmable read-only memory
defined, 177, 215voltage, 43(EPROMs), 771
inversion bubbles, 177, 215DIP (dual-in-line package), 50, 56address decoding, 778, 779
NAND gate application, 177Disable functiondata sheet, 775
NOR gate application, 178defined, 70, 97defined, 788
product-of-sums (POS) and, 202MultiSIM simulation, 72electrically erasable (EEPROM), 772, 774, 777,
sum-of-products (SOP) form, 183AND/OR gates, 70–72788
for three/more variables, 177Disabled, 451, 470Flash memory, 772, 774, 777
Debouncing. See also SwitchesDischarge transistors, 699Program cycle, 776
cross-NAND method, 511Distributive law, 162programming, 775–777
D flip-flop method, 512, 513Divide-by-N, 612Read cycle, 776
methods, 510Division, binary arithmetic, 265–266representative, 777
Schmitt method, 511Don’t care, 187, 215, 322, 369simplified diagram and memory cell, 774
Decimal numbering system (base 10), 7–8Double quotes, 192UV, 772–773
BCD conversion to, 17–18Down-counters, 546–547Error indicator, 241, 253
conversion to hexadecimal, 16Dual-in-line package (DIP), 50ESD (electrostatic discharge), 407
Exclusive-OR gates, 237Fusible-link PROMs, 772, 788CMOS, 53–54
defined, 237, 253configuration as DIPs, 51
operation, 238Gated S-R flip-flops, 435–436A/D converter, 733–738
parity generator/checker, 242Gates, 62–97D/A converter, 723–726
Exponential charge/discharge, 682, 710AND, 63–65delay-gate, 490
External Access, 820, 847defined, 63, 97full-adder, 281–285
External buses, 796enable/disable functions, 70–72AND gates in, 73–74
External memory, interfacing to, 823–824exclusive-NOR, 238–239monostable multivibrator, 690–695
External resistors, 691exclusive-OR, 237 IC, using, 73–74, 92–94octal, 465, 471 OR gates in, 73–74
Fall time, 397, 422inverter, 79–80parity generator/checker, 242–244
Fan-out, 388–391, 422multitap delay, 496ripple counter, 559–563
Fast-look-ahead carry, 283, 303NAND, 80–83shift register, 638–646
Faults, 74–79, 97NOR, 83–85stepper motor driver, 654–655
Ferromagnetic material, 651, 667NOT, 80synchronous counter, 588–590
Field-programmable gate arrays (FPGAs), 116,OR, 65troubleshooting techniques, 74–79
119–121. See also Programmable logicAND-OR-INVERT, 201–205, 214volatile, 789
devices (PLDs)SSI, 352Integrating slope converters, 730
applications, 147strobe, 434Integrating solar radiometer, 843–845
applications with VHDL and LPMs, 295–301summary, 94–96Interfacing, 740, 747
connecting multiple I/O to, 523–524timing analysis, 67–70Interfacing logic families, 413–420
controlled inverter, 250–252troubleshooting, 74–79Internal resistors, 691
defined, 119, 151in TTL and CMOS families, 95Interrupts, 800, 811
design applications with LPMs, 365–368universal, 196–201, 215Inversion bar, 80, 97
design applications with VHDL, 247–252unused, 403Inversion bubbles, 177, 215
design flow, 122waveform generation, 86Inverters
electrical characteristics, 420–421Glitches, 369, 549, 612Boolean equation, 80
illustrated, 120–121Gray code, 343–344, 369controlled, 245–247, 253
look-up table (LUT), 119counter, 600–601defined, 49, 56
parallel binary comparator, 249–250defined, 343forming from NAND gates, 196
programming, 141, 143–144four-bit, 344forming from NOR gates, 198
Flash memory, 772, 774wheel, 344hex, 53, 56, 92
Flip-flop memory circuitry, 117Groups, 247, 253 Flip-flopsas NOT gate, 80 Schmitt trigger, 503–509
ac waveforms, 485Half-adder, 276–277, 280, 303symbol, 79
active clock edge, 486Hall-effect switch, 521–522timing analysis, 80
automatic Reset, 502–503Hand assembly, 805, 811truth table, 79
D, 441–450Handshaking, 740, 747 D latch, 437–441I/O-mapped I/O, 803, 811 Handshaking signals, 650, 667
defined, 471Hard disks, 784–786Jitter, 503, 526
gated D, 436–437Hardware, 339, 370, 804J-K flip-flops, 450–465
gated S-R, 435–436data acquisition and control system application,automatic power-up Reset, 502–503
hold time, 486836–841connected as toggle flip-flop, 463
J-K, 450–465defined, 811D flip-flop from, 462
metastable state, 490requirements for I/O programming, 803–805defined, 450
octal, 657Hertz (Hz), 30edge-triggered, 453–457
propagation delay, 487Hex, 92, 97in flip-flop formation, 462
race condition, 485Hex inverters, 53, 56, 92IC, 457–465
setup time, 485Hexadecimal arithmetic, 271–274master-slave, 450–453
S-R, 431–435addition, 271–273MultiSIM simulation, 459
T, 463–464subtraction, 273synchronous operating modes, 450
time parameters, 485–502Hexadecimal decoders, 324–325toggles, 450
Float, 75, 97, 513, 526, 644, 667Hexadecimal numbering system (base 16),Johnson shift counter, 86–92
Floating-gate MOSFET, 773–774, 78814–17defined, 86, 97
Floorplan Editor Display, 215conversions, 15–17MultiSIM simulation, 87–88
Floppy disks, 784–786defined, 14, 23use of, 87
Flowcharts, 806, 811PC I/O devices, 22waveform generation illustration, 86
Flux lines, 651, 667High-impedance state, 644, 667 For Loop, 247, 253Johnson shift counters, 633–634, 635 High-order bits, 283, 303
Forward-biased diodes, 43, 44Hold time, 486, 526Karnaugh maps (K-maps), 183, 205–211
Four-bit full-adder ICs, 281–285Hysteresis, 503, 526 FPGAs. See Field-programmable gate arraysadjacent cells, 206–207, 214 cell correspondence, 205
Frequency, 30, 31, 56IEEE/IEC logic symbols, 94–96, 888–892cell number determination, 205
Full-adder, 277–281. See also ArithmeticIF-THEN-ELSE statements, 298–299, 303cells, 205, 214
circuitsoctal decoder VHDL program with, 330defined, 205, 215
block diagram, 280VHDL comparator using, 316–318encircling adjacent cells in, 207
carry-out, 277IN FFH, 804–805illustrated, 206–207
defined, 277, 303Input ports, 797reduction procedure, 206
four-bit ICs, 281–285Input/outputtruth tables, 206
logic diagram, 2788051 microcontroller with, 837 MultiSIM simulation, 279–280wraparound, 209 I/O-mapped, 803, 811
sum function, 277memory-mapped, 803, 811LAB (Logic Array Block), 215
Function select, 292, 303multiple, connecting to CPLD or FPGA,Latches
Function tables, 242, 243, 253, 431523–524D, 437–441
ALU, 293practical considerations, 514–524defined, 430, 471
D flip-flop, 442Instantiations, 662, 667octal, 657
decimal-to-BCD encoder, 332Instruction decoders, 800, 811transparent, 430–431, 472, 657, 668
defined, 471Instruction registers, 798, 811LCDs (liquid-crystal displays), 572, 612, 782, 788
edge-triggered J-K flip-flop, 454Instruction timing, 831–835Least significant bit (LSB), 11, 12, 23, 276
octal-to-binary encoder, 335Integers, 285, 303LEDs. See Light-emitting diodes
defined, 417, 423expansion, 762–765, 780–781555 astable multivibrator, 703
illustrated, 417external, 823–824ADC, 737–738
optocoupler for, 517–518Flash, 772, 774, 777BCD adder, 291–292
Level-triggered master-slave J-K flip-flops, 452locations, 755binary adder, 284–285
Library declaration, 124, 151magnetic, 754, 784–786, 789controlled inverter, 246–247
Library of Parameterized Modules (LPM)mapping, 780D flip-flops, 443
adder/subtractor, 299–301nonvolatile, 151DAC, 725
comparator, 365–366optical, 754, 786–787, 789decimal-to-BCD encoder, 334–335
counter, 599–600read-only, 771–778electro-mechanical relay switching, 41–42
decoder, 366–367read/write, 758full-adder, 279–280
defined, 295, 303semiconductor, 754–777AND gate, 68–69
flip-flop, 467–468Memory-mapped I/O, 803, 811J-K flip-flop, 459
flip-flop with asynchronous control, 468–469MEMS (Micro-Electro-Mechanical Systems),Johnson shift counter, 87–88
FPGA applications with, 295–301, 365–368522–523MOD-5 counter, 550–551
multiplexer, 367–368Metastable state, 490, 526monostable multivibrator, 693
shift register, 660–662Microcontrollers. See also 8051 microcontrollermultiplexer, 350–351
Light-emitting diodes (LEDs)alarm encoder for, 360–361octal decoder, 323–324
common-anode, 570–571, 612defined, 360, 370, 808, 817, 847parallel transmission, 36
common-cathode, 571octal D flip-flops for, 465–466ripple counter, 545–546
display decoders, 570–583serial data multiplexing for, 361–362Schmitt triggers, 505–506
driving, 516–517Microprocessor-based systems, 795serial transmission, 35–36
Linear IC temperature sensors, 742–743example illustration, 796seven-segment LED display, 573–574
Liquid-crystal displays (LCDs), 572, 612, 782,software control of, 798shift registers, 630–631, 643
788Microprocessors, 794–812. See also 8085Asimplification of logic circuits, 171–172,
Load accumulators, 801–802microprocessor190–191
Logic Array Block (LAB), 215address decoding, 359–360switching circuits, 51
Logic cells, 215defined, 370, 740, 747, 795, 811T flip-flop, 463–464
Logic families, 384–423instruction execution within, 800–803TTL NAND, 386–387
Altera Cyclone II, 420–421internal architecture of, 798two’s complement adder/subtractor circuit,
CMOS, 405–410I/O software comparison, 798288–289
comparing, 412–413manufacturers, 808–809MultiSIM Logic Converter, 171–172, 190
comparing structure objects, 412–413support circuitry, 795Multitap delay gates, 496
ECL, 410–412survey of, 808–809Multivibrators, 681–698
interfacing, 413–420Mnemonics, 798, 807, 811astable, 681, 685–687, 701
performance specifications, 412MOD-5 counters, 549–551bistable, 681
TTL, 385–405block diagram, 549defined, 681, 710
types of, 384MultiSIM simulation, 550–551 Logic gates. See Gatesmonostable, 681, 687–698 state diagram, 550
Logic probes, 75, 97waveform, 549NAND gates, 80–83
Logic pulsers, 75, 97MOD-8 counters, 548Boolean equation, 81
Logic state, 34, 56MOD-10 counters, 556–557CMOS, 407
Logic symbols, 94–96, 888–892MOD-16 counters, 544–546, 547–548De Morgan’s theorem application, 177
Logical operators, 918Mode control, 292, 303, 640, 667defined, 80
Look-up tables (LUTs)Modulus, 537, 612equivalent logic circuit using, 197
defined, 119, 151, 788Monitor programs, 797, 811forming AND gates from, 196
illustrated, 120–121Monostable multivibrators, 687–698forming inverters from, 196
PROM, 781–782555, 704–707forming NOR gates from, 198
Low-order inputs, 283, 303block diagram, 688forming OR gates from, 197
Low-Power Schottky, 404defined, 681logic circuit implementation with, 196
LPM. See Library of Parameterized Modulesintegrated circuit, 690–695symbols, 80, 81
LSB (least significant bit), 11, 12, 23MultiSIM simulation, 693 retriggerable, 690, 695–698timing analysis, 82 truth tables, 81, 82
Machine code, 801, 811MOSFETs (metal oxide semiconductor field-effectTTL form, 80
Machine language, 805–808transistors)universal capability, 196–201
Macro-functions, 247, 253, 661defined, 405, 423Negative edge, 453, 471
Magnetic memory, 784–786driving relay and AC motor, 520Netlist Viewer, 175, 176, 184, 215
data transfer rate, 786floating-gate, 773–774, 788Next state, 601, 612
defined, 754, 789N-channel, 405, 406NMOS, 405, 406, 423
floppy disk, 784–786as ON/OFF switches, 406Node Finder, 137, 138
hard disk, 784–786P-channel, 406Noise, 452, 471
MRAM, 786switching characteristics, 406Noise margin, 391–396, 423
Magnetoresistive random access memoryMost significant bit (MSB), 11, 12, 24, 567Nonlinearity, 727, 747
(MRAM), 786, 788MRAM (magnetoresistive random access memory),Nonmonotonic, 727, 747
Magnitude comparators, 313–314, 370786, 788Nonvolatile memory, 119, 151
Mask ROMs, 771, 789MSB (most significant bit), 11, 12, 24, 567NOR gates, 83–85
Master-slave J-K flip-flops, 450–453. See alsoMultiplexed display application, 363–364CMOS, 407
J-K flip-flopsMultiplexers, 346–354De Morgan’s theorem, 178
defined, 451, 471analog, 357–358, 362–363defined, 83
level-triggered, 452CMOS, 347forming from NAND gates, 198
pulse-triggered, 451, 452combinational logic functions with, 352–353forming inverters from, 198
MCS-51 instruction set, 943–946data select input codes, 346repetitive waveform, 86
Medium-scale-integration (MSI) circuits, 260,defined, 346, 370symbol, 83
275, 303eight-line, 348–350truth table, 84
Memory, 786–787, 797. See also Random-accessfour-line, 353–354TTL form, 83
memory (RAM)functional diagram, 346universal capability, 196–201
addresses, 755, 789logic diagram, 347NOT, 81, 97
banks, 359LPM, 367–368NOT gates. See Inverters
bit-addressable, 822, 847for microcontroller, 361–362Numbering systems
cells, 758, 765–766, 774, 789MultiSIM simulation, 350–351applications of, 20–22
concepts, 755–758TTL form, 347BCD, 17–18
comparison of, 18defined, 32, 57effect on ripple counter, 543
decimal (base 10), 7–8MultiSIM simulation, 36Pull-down resistors, 514, 526–527
hexadecimal (base 16), 14–17PC printer port use, 33Pull-up resistors, 401, 423, 513–514, 527
octal (base 8), 12–14Parallel-encoded A/D converters, 728–729 Parallel-to-serial conversion, 629Pulse stretching, 680, 710 Pulse-triggered master-slave J-K flip-flops, 451,
Octal D flip-flops, 465–466Parentheses, 180 Octal decoders, 321–324452, 471 Parity, 238, 253
block diagrams, 327Parity error-detection system, 244Quad, 92, 97
defined, 321Parity generator/checker, 241–244Quartus II software, 126–147
with enable input, 329construction of, 242arithmetic operators, 174
implementation with vectors, 328eight-bit, 243Block Design Editor, 127
logic symbol and diagram, 321error indicator, 241block design file creation, 131–132
MultiSIM simulation, 323–324even, 241, 242Chip Planner, 174, 176, 214
pin configuration, 321from exclusive-OR gates, 242circuit connections, 134
VHDL program with Boolean equations,five-bit, 243Compilation Report, 174
327–328IC, 242–244computer screen displays, 123
VHDL program with IF-THEN-ELSE, 330with input bus configuration, 247–248defined, 126–127
Octal ICs, 465, 471, 657, 667odd, 241, 242digital logic for Boolean equation, 132–133
Octal numbering system (base 8), 12–14Period, 30, 31, 57enter symbol mode, 247
conversions, 12–14Periodic clock waveform, 29–30Floorplan Editor Display, 215
defined, 12, 24PhototransistorsFPGA applications, 147–150
uses, 12defined, 517, 526, 613FPGA programming, 141, 143–144
Octal priority encoder, 338–339as input to latching alarm system, 517functional simulation, 140–141
Octal-to-binary encoders, 335–337resistance, 581inputs and outputs, 137–138
Ohm’s law, 925–930PLA (programmable logic array), 116–117logic testing, 144
Ones catching, 452, 471PLDs. See Programmable logic devicesmain screen, 127
One’s complement, 267, 303PMOS, 405, 406, 423Netlist Viewer, 175, 176, 184, 215
Op amps, 718, 747Pole pairs, 651, 668New Project Wizard, 128–131
Opcodes, 807, 811Polling, 740Node Finder, 137, 138
Open circuits, 928PORT MAP keyword, 662, 664, 668pin assignment, 141–142
Open-drain (OD) outputs, 401Port numbers, 804, 811project compilation, 134–135
Open-collector (OC) outputs, 400–401, 423Positive edge, 441, 471project creation, 127–131
Operands, 807, 811Positive feedback, 503, 526project re-compilation, 142–143
Operating systems, 797, 811Power dissipation, 400, 423running, 123–126
Optical interrupter switch, 518–520Power supply decoupling, 403, 515in simplified equations determination, 172–177
Optical memory, 754, 786–787Power-up, 502, 526Text Editor, 127
CD-Rs, 787Present state, 601, 613timing waveforms creation, 138–139
CD-RWs, 787Priority encoders, 335, 370, 729tutorials, 126–147
CDs, 786Problemsvector waveform file creation, 135–137
defined, 789odd-numbered answers, 893–916VHDL design entry, 144–147
DVDs, 787schematic diagrams, 933–942 OptocouplersQuotes, 192 Process statement, 247, 253
defined, 517, 526Product terms, 151R/2R ladder digital-to-analog converters (DACs)
for level shifting, 517–518Product-of-sums (POS)analog output versus digital input, 722
OR gatesDe Morgan’s theorem and, 202current division, 721
associative law of addition for, 162defined, 201–205, 215defined, 720
Boolean equation, 65logic circuit, 203illustrated, 721
commutative law of addition for, 162Products, 263, 303Race condition, 485, 527
defined, 65Program counters, 800, 811Radix, 247, 253
electrical analogy, 66Program instructions, 795–796Random-access memory (RAM), 758
enable/disable functions, 70–72Program Store Enable, 820–821, 847defined, 789
forming from three NAND gates, 197Programmable array logic (PAL), 116–118, 151dynamic, 765–771
in ICs, 73–74Programmable logic array (PLA), 116–117, 151magnetoresistive (MRAM), 786
inversion bubbles, 177Programmable logic devices (PLDs)as read/write memory (RWM), 758
with inverted inputs, 177application-specific integrated circuits (ASICs),static, 758–765
inverted-input, 178116, 121use of, 758
programmable, 116architecture, 116–121RAS (row address strobe), 789
schematic symbols, 65, 66complex (CPLDs), 116, 119RC circuits, 502, 527
truth tables, 65, 67defined, 112, 151Read-only memories (ROMs), 771–778. See also
Oscillation, 583, 612design flow, 113–115Memory
Oscillatorsdevelopment boards, 115defined, 771, 789
crystal, 707–708field-programmable gate arrays (FPGAs), 116,erasable-programmable, 771
defined, 707, 710119–121mask, 771
voltage-controlled, 707power of, 114programmable, 772
Oscilloscopes, 29price of, 115Read/write memory (RWM), 758
defined, 56sample illustration, 113Recirculating registers, 629–630, 641, 668
illustrated, 29schematic capture, 113, 151Rectifier circuits, 515, 527
pulse rise/fall times, 397simple (SPLDs), 116–117Redundancy, 211, 215
OUT FEH, 805for solving logic designs, 122–126Reference voltage, 734, 747
Output Enable, 656–657, 668types of, 116Refresh period, 766
Output ports, 797Programmable read-only memories (PROMs), 772Register arrays, 800
Oxide isolation, 405defined, 789 erasable, 771, 772–777Register banks, 821, 847 Registers, 465, 471. See also Shift registers
PAL (programmable array logic), 116–118fusible-link, 772commonly used, 655
Parallel binary comparators, 245look-up tables (LUTs), 781–782defined, 655, 668
FPGA, 249–250Programmable-gain amplifiers, 740, 747instruction, 798, 811
illustrated, 245PROMs. See Programmable read-only memoriesRelational operators, 918
Parallel Enable, 645, 668Propagation delay, 397, 423Relays. See also Switches
Parallel format, 628for asynchronous input, 489defined, 38, 57
Parallel Load, 588–590, 613, 627–628for clock to output, 489in digital circuits, 40
energized relay coils, 56simulation, 578gated, 435–436
MultiSIM simulation, 41–42three-digit display, 574, 575as storage register, 434
normally closed (NC), 38VHDL description of, 577–578symbols, 432
normally open (NO), 39SFRs (Special Function Registers), 821, 847synchronous, 435
symbolic representation, 39Shaft encoder disks, 519timing analysis, 432–433
timing diagram, 40Shift countersSRAM (static random-access memory), 120
Remainders, 262, 303defined, 633, 668Stack pointers, 800, 811
Repetitive waveforms, 86, 97Johnson, 633–634, 635State diagrams, 543
Representation, 32–37ring, 633–635ADC controller process, 606
parallel, 32–36Shift registers, 626–668ATM-thermal printer interface, 609
serial, 32basics, 627–629defined, 543, 613
Resetblock diagram, 627MOD-5 counter, 550
automatic, 502–503, 526defined, 626, 629, 668ripple counters, 543
defined, 431, 471ICs, 638–646State machines
synchronous counters, 594LPM, 660–662ADC controller, 607
Resolution, 718, 747MultiSIM simulation, 630–631, 643defined, 600, 613
Retriggerable monostable multivibrators, 690,parallel-load shift-right, 637for Gray code sequencer, 600–601
695–698parallel-to-serial conversion, 629implementation in VHDL, 600–611
defined, 690, 695, 710recirculating, 629–630, 641, 668for multiple control inputs, 604–611
nonretriggerable comparison, 695serial-in parallel-out, 638–639for stepper motor, 601–604
output pulse width, 696serial-in shift-right, 636Statement labels, 807, 812
timing chart, 696serial-to-parallel conversion, 631–633Static RAMs (SRAMs), 758–765. See also
Reverse-biased diodes, 43system design applications, 647–651Random-access memory (RAM)
Rewritable CDs (CD-RWs), 787three-state outputs, 643–644data sheet, 759
Ring shift counters, 633–635universal, 640defined, 758, 789
Ripple, 515, 527VHDL description of, 635–637functional diagram, 760
Ripple blanking, 572, 613Sign bits, 267, 303logic symbols, 764
Ripple carry, 283, 303Signal conditioning, 745memory expansion, 762–765
Ripple counters, 541–548SignalsMOS technology, 758
defined, 541, 613defined, 191, 215read operation, 761–762
down-counter, 546–547digital, 29–31sample, 764
ICs, 559–563handshaking, 650, 667timing waveforms, 761
MOD-16, 544–546selected assignment, 192write operation, 762
MultiSIM simulation, 545–546vector, 191–195Stator coils, 651, 668
propagation delay effect on, 543Signed numbers, 296, 303Stepper motors
state diagram, 542Simple programmable logic devices (SPLDs),defined, 651, 668
up-counter, 547–548116–117drive circuitry, 653
waveforms, 542defined, 116, 151driver ICs, 654–655
Rise time, 397, 423flip-flop memory circuitry, 117driving with shift registers, 651–655
Rotors, 651, 668PAL architecture, 116, 117illustrated, 652, 653
Row address strobe (RAS), 789PLA architecture, 116, 117 Simplification of logic circuitspin configuration, 654 state machine for, 601–604
Sample-and-hold circuits, 740, 747with Boolean Algebra, 167–172wiring, 655
Saturation, 49, 57defined, 167Stepping angles, 651, 668
Scalars, 353, 370MultiSIM examples, 171–172, 190–191Storage registers, 466, 471
Schematic capture, 113, 151Simplified equationsStore accumulators, 802–803
Schematic diagrams, problems, 933–942with Netlist Viewer technique, 184Strain gages
Schmitt triggers, 503–509Quartus II to determine, 172–177defined, 744
astable multivibrator, 685Single quotes, 192foil type, 744
for debouncing, 511Single-pole, double throw (SPDT) switches, 511,in measuring force, 744
defined, 503, 527527signal conditioning for, 745
inverting, 509Single-pole, single throw (SPST) switches, 509,Strobe gates, 434, 471
MultiSIM simulation, 505–506527Strobes, 632, 668
positive feedback, 503Sink current, 389, 423Structural approach, 662, 668
switching characteristics, 504Skewed, 543, 613Substrate, 405, 423
transfer function, 504, 505Small Computer Systems Interface (SCSI), 32Subtraction
Schottky TTL, 404Small-scale integration (SSI) logic gates, 352binary arithmetic, 262–264
SCSI (Small Computer Systems Interface), 32SMDs (surface-mount devices), 54, 55, 57hexadecimal, 273
Seconds (s), 30Software, 339, 798two’s complement, 270
Selected Signal Assignment, 192, 215celsius thermometer, 842Successive division, 11, 16
Semiconductor memory, 754–778, 789defined, 370, 811Successive-approximation A/D conversion,
Sequential applications, 536integrating solar radiometer, 845730–733
Sequential circuitstemperature-dependent PWM speed control,defined, 730, 747
analysis of, 538–541844timing waveforms, 732
defined, 613Solar radiation data-logger system, 6voltage-level contributions, 732
Sequential logic, 117, 430, 471Solder bridge, 75, 76Summation symbol (sigma), 261
Sequential operations, 251, 253SOP. See Sum-of-productsSum-of-products (SOP), 116, 152
Sequential statements, 298–299, 303Source current, 389, 423AOI IC implementation, 204
Serial format, 628SPDT (single-pole, double throw) switches, 511,form, 183, 201, 215
Serial representation, 32527logic circuit, 203
of binary numbers, 32Special Function Registers (SFRs), 821, 847AND-OR-INVERT gates for implementing,
defined, 32, 57SPLDs. See Simple programmable logic devices201–205
MultiSIM simulation, 35–36SPST (single-pole, single-throw) switches, 509,truth tables from, 202
Serial-to-parallel conversion, 631–633527use of, 202
Series circuits, 926S-R flip-flops, 431–435variables, 202
Set, 431, 471application, 434Sums, 261, 303
Setup time, 443, 471, 485, 527asynchronous, 435Superimpose, 362, 370
Seven-segment decoders, 570–583cross-NAND, 432Support chips, 795
BCD-to, 572cross-NOR, 431Support circuitry, 795, 812
defined, 613defined, 431Surface-mount devices (SMDs), 54, 55, 57
bounce, 509, 527defined, 49, 57, 423entering truth tables with, 191–195
as clock input to toggle flip-flop, 510fan-out, 388–391selected assignment, 192
complementing, 287gates, 95Vector Waveform File (vwf), 135–137
debouncing, 509–513improved series, 403–405VHDL (VHSIC Hardware Description Language)
diode, 42–45input/output current, 388–3914-line multiplexer, 353–354
in electronic circuits, 37input/output voltage, 391–396adders with integer arithmetic, 285–287
Hall-effect, 521–522integrated circuit, 50architecture body, 124, 150
manual, 37interfacing to CMOS, 414–415arithmetic operators, 918
ON/OFF resistances, 37inverter circuit schematic, 51circuit reduction proof, 158–162
optical interrupter, 518–520logic family, 385–405comments, 192
relay, 38–42multiplexers, 347comparator, using IF-THEN-ELSE,
SPDT, 511, 527NAND, 386–388316–318
SPST, 509, 527noise margin, 391–396components and instantiations, 662–666
transistor, 45–48open-collector (OC) outputs, 400–401D flip-flop description, 445–448
transistor-transistor logic (TTL), 49–51power dissipation, 400D latch description, 439–440
Switching circuits, MultiSIM simulation, 51–52power supply decoupling, 403data types, 919
Synchronous, 435, 471pulse-time parameters, 397–399decoder implementation in, 326–330
Synchronous counters, 579–583Schottky, 404defined, 113, 152
applications, 592–595totem-pole arrangement, 50, 57design entry, 144–147
circuit connections, 580unused inputs/gates, 403edge-triggered J-K flip-flop description,
with component instantiations, 665voltage and current ratings, 388–397455–457
defined, 543, 613wired-output operation, 401–402entity declaration, 124
high-speed multistage, 591Transition arrows, 605, 613by example, 920–923
ICs, 588–590TransitionsFPGA applications with, 247–252, 295–301
output waveforms, 580defined, 441, 472full-adder description, 278–279
system design application, 581–583unconditional, 605, 613general rules, 918
up/down, 583–591Transmission, 238, 253glitch-free counter description, 558–559
Synthesizing, 122, 152Transparent latches, 430–431, 472, 657, 668language reference, 917–923
System design applications. See ApplicationsTriggerslibrary declaration, 124
Systematic approach, 205defined, 441, 472 Schmitt, 503–509logical operators, 918 For Loop, 247, 253
T flip-flopsTroubleshooting techniques, 74–79, 97MOD-10 up-counter description, 556–557
J-K flip-flop connected as, 463Truth tablesMOD-16 up-counter description, 547–548
MultiSIM simulation, 463–464BCD-to-seven-segment decoder, 577naming conventions, 917
Temperature-dependent PWM speed control, 843binary addition, 261octal priority encoder, 338–339
Terminal Count, 584, 588, 613binary subtraction, 263Process statement, 247, 253
Thermistors, 741–742, 747decimal-to-BCD encoders, 331program comments, 918
with ADC, 742defined, 97program listing, 145
characteristic curve, 741ECL OR/NOR, 411program model, 917
defined, 717entering in VHDL with vector signal,programs, reading, 124
Three-state buffers, 656–657191–195relational operators, 918
Three-state outputs, 643–644, 668exclusive-NOR gate, 238seven-segment decoder description,
Thresholds, 505, 527exclusive-OR gate, 237577–578
Time constant, 701, 710AND gate, 63, 65shift registers description, 635–637
Time delay, 831–835inverter, 79state machine implementation in,
Timing analysisKarnaugh maps (K-maps), 206600–611
AND gate, 80NAND gate, 81, 82std_logic data type values, 919
gates, 67–70NOR gate, 84text editor, 114, 122, 152
inverter, 80OR gate, 65, 67truth tables with vector signal, 191–195
NAND gate, 82from SOP expression, 202up-counter, 595–596
S-R flip-flop, 432–433SOP form in building, 183up-down counter, 597–598
Timing diagramsTTL. See Transistor-transistor logicVirtual ground, 718, 747
defined, 29, 57, 67Two’s complementVolatile ICs, 789
relay, 40adder/subtractor circuit, 287–289Voltage regulators, 515, 527
Timing waveforms, 496addition, 270Voltage-controlled oscillators (VCOs),
Toggles, 450–453, 471arithmetic, 269–270707, 710
Totem-pole arrangement, 50, 57to decimal number, 268–269Voltage-divider equation, 927
Totem-pole output, 403, 423decimal number to, 267–268Voltages
Transceivers, 657–659defined, 263, 267, 303capacitor, 683, 685
as bidirectional, 657negative numbers, 287input/output, 391–396
defined, 657, 668numbers, 267reference, 734, 747
octal, 659representation, 267–269 pin configuration, 659supply, 410 subtraction, 270
Transducers, 718, 741, 747Type declaration, 192, 215 Transfer functionsWaveform generators, 86, 97 Waveform simulation editor, 124
defined, 504, 527Unconditional transitions, 605, 613Waveform simulators, 123, 152
Schmitt trigger, 504, 505Universal gates, 196–201, 215Web sites, 850–851
Transistors, 37, 45–48Unsigned numbers, 298, 304Weighting factors
bipolar, 45–48, 405, 422Up-countersfor BCD bit positions, 340
defined, 45, 57MOD-16, 547–548defined, 340, 370
discharge, 699VHDL, 595–596powers-of-2 binary, 8
NPN, 46Up/down-counters, 583–591WHEN-ELSE conditional signal statements, 296,
regions, 45defined, 583, 613304
as switches, 45–48function table, 584Wired-AND logic, 401–402, 423
Transistor-transistor logic (TTL), 49–51, 405. SeeVHDL, 597–598 also SwitchesWraparound, 209, 215 USB (Universal Serial Bus), 6
bipolar transistors, 405User-recordable CDs (CD-Rs), 787Zener breakdown, 516, 527
chip operation, 385UV-erasable PROM, 772–773Zero flags, 807, 812

Supplementary Index of ICs

This is an index of the integrated circuits (ICs) used in this book. Page numbers indicate where the IC is first discussed. Page numbers in boldface type indicate pages containing a data sheet for the device.

1N749Zener diode, 516741488-input priority encoder, 335–337
2118Dynamic RAM, 7687415016-input multiplexer, 352
2147HStatic MOS RAM, 758–764741518-input multiplexer, 348–352
27162K X 8 EPROM, 773741541-of-16 decoder, 324–326
27324K X 8 EPROM, 77874160Synchronous counter, 590
27C64EPROM, 85374161Synchronous counter, 590
3242DRAM controller, 76874162Synchronous counter, 590
4001Quad 2-input NAND gate, 9274163Synchronous counter, 590
40084-bit full adder, 287741648-bit shift register, 638–639
4011Quad 2-input NAND gate, 94741658-bit shift register, 639–640
4049CMOS hex inverter, 53741814-bit ALU, 292
4050Buffer, 41574184BCD-to-binary converter, 341–343
4050BLevel-shifting buffer, 41774185Binary-to-BCD converter, 341–342
40504BCMOS level shifter, 41774190BCD up/down counter, 588–589
4051Multiplexer/demultiplexer, 357741914-bit binary up/down counter, 588–589
4052Multiplexer/demultiplexer, 35774192BCD up/down converter, 567
4053Multiplexer/demultiplexer, 357741934-bit binary up/down converter, 583
4077CMOS quad Ex-NOR gate, 238741944-bit universal shift register, 640–643
555Timer, 698–703, 875–88074244Octal 3-state buffer, 409
6800Motorola microprocessor, 79574280Parity generator/checker, 242–244
6809Microprocessor, 35974280bParity generator/checker, 747–748
68HC11Microcontroller, 465–466742834-bit full adder, 295
7400Quad 2-input NAND gate, 55, 393–39574395A4-bit shift (right) register, 644
7402Quad 2-input NOR gate, 8374ABT244Octal buffer, 409, 867–870
7404Hex inverter, 5074AHC16244Widebus octal buffer, 410
7405Buffer/driver, 40174ALS112Negative edge-triggered flip-flop, 540
7406Inverter buffer/driver, 40174ALS32OR gate, 419
7407Buffer/driver, 40174F00NAND, 852
7408Quad 2-input AND gate, 7374F112Flip-flop, 852
7411Triple 3-input AND gate, 7374H106J-K flip-flop, 487
7414Schmitt trigger inverter, 503–50674H71Master-slave flip-flop, 451
7421Dual 4-input AND gate, 7374HC00High-speed CMOS NAND, 408, 852, 854–862
7427Triple 3-input NOR gate, 9574HC192CMOS counter, 583
74308-input NAND gate, 10774HC193CMOS counter, 583
7432Quad 2-input OR gate, 7374HC1G00Single-gate NAND, 410
7442BCD-to-decimal decoder, 32474HC280Parity generator/checker, 242–244
7447BCD-to-seven-segment converter, 34374HC2834-bit full adder, 283
7472Master-slave flip-flop, 45174HC4543BCD-to-seven segment LCD decoder, 782
7473Master-slave flip-flop, 45174HC86CMOS quad Ex-OR gate, 255
7474Dual D flip-flop, 441–44574HCT00High-speed CMOS NAND, TTL compatible, 408
7475Quad bistable latch, 437–43974HCT04Inverter, 419
7476Dual J-K flip-flop, 457, 491–49474HCT08Quad 2-input AND gate, 520
74834-bit full adder, 28174HCT138Octal decoder, 359
74854-bit magnitude comparator, 31474HCT151Multiplexer, 362
7486Quad Ex-OR gate, 23874HCT238Multiplexer/demultiplexer, 362
74904-bit decade counter, 55974HCT2738-bit D flip-flop, 465
7492Divide-by-12 counter, 55974HCT4051Multiplexer/demultiplexer, 357
74934-bit binary ripple counter, 55974HCT5834-bit BCD adder, 291
74104Master-slave flip-flop, 45174LS00NAND gate, 400
74105Master-slave flip-flop, 45174LS01Open-collector NAND gate, 400
74109Dual J-K flip-flop, 46174LS08AND gate, 419
74112Dual J-K flip-flop, 51774LS112Dual J-K flip-flop, 458
74121Monostable multivibrator, 69074LS138Address decoder, 778
74123Retriggerable monostable multivibrator, 69074LS194Shift register, 643
74132Quad 2-input Schmitt NAND, 50774LS244Buffer, 520
74138Octal decoder, 32174LS245Octal three-state transceiver, 659
74139Dual 1-of-4 decoder/multiplexer, 355–35674LS373Octal flip-flop, 441
7414710-line-to-4-line priority encoder, 331–33574LS374Octal flip-flop, 441
74LV00Low-voltage NAND, 863–866HM62W8512BStatic RAM, 765
74LVC8T2458-bit transceiver, 660HM6264BStatic RAM, 765
74S124VCO, 698–703HM5165805Dynamic RAM, 770
74S1541-of-16 decoder, 757IRF130Power MOSFET, 520
78055-V voltage regulator, 515KA741Operational amplifier, 871–874
8031Microcontroller, 817LF198Sample-and-hold circuit, 740
8051Microcontroller, 816–847, 853LH0084Programmable-gain instrumentation amplifier, 740
8052Microcontroller, 821LM35Linear temperature sensor, 520
8085Intel microprocessor, 795LM185Precision reference diode, 743
8085AMicroprocessor, 359LM339Analog comparator, 520
8155RAM with I/O, 824LM555Timer, 698–703, 875–880
8751Microcontroller, 817LM741Operational amplifier, 853
10124ECL level translator, 418MAX7000S CPLD, 119
10125ECL level translator, 418MC1408DAC, 723–724
ADC0801Analog-to-digital converter, 834, 853MJ2955PNP power transistor, 653
ADC0804Analog-to-digital converter, 734–737NE5034Analog-to-digital converter, 733–734
AM3705Analog multiplexer circuit, 740PAL16L8SPLD, 117–118
DAC0808Digital-to-analog converter, 723, 853UCN5804BStepper motor driver, 654–655
EP2C35FPGA, 500–501, 881–887Z80Zilog microprocessor, 795
114VCC114VCC114VCC114VCC114VCC
213213213 3 4 5 62 12 11 10 913 3 4 5 62 12 11 10 913 3 4 5 612 11 10 93 4 5 612 11 10 93 4 5 612 11 10 9
GND78GND78GND78GND7 74148 7421 0GND 7427 17 7432 168 7442 VCC
114VCC1 2 3 4 5 614 13 12 11 10 9VCC 2 3 4 5 61 13 12 11 10 914 2 3 4 5 6VCC 13 12 11 10 91 2 3 4 5 614 13 12 11 10 9VCC 2 3 4 5 61 3 4 5 6 72 14 13 12 11 1015 A1 A2 A3 9 8A0
GND78 A2GND A1 f BI/RBO7 1 1 LT a8 16 14 3 3GND VCC VCC 14 127 Q0 RD1 D1 Cp18 1 1 3 3GND 16 14 2 g 14 12 47 7447 Q0 VCC 15 2 Q1 D2 138 7454 CP1 D0 2 13 RD1 E2-3 4GND 7474 1 Q1 15 D1 3 E0-1 138 7475 16 SD1 2 2 14 J1 49 7476 K1 Q1 15 13RD2 Q1 GND 137
RBI512b411SD1411 Cp2VCC512GNDVCC512K2
A3611c510Q1510SD2D2611Q2CP2611Q2
A0710d69Q169Q2D3710Q2SD2710Q2
GND89eGND78GND A47 18 16Q2 7483 B4Q3 7485 B38 7486 19 7490 16Q3 7492 VCCRD289J2
∑3∑4 B3IA< B A3 CINA3 IA= B IA> B1 B2 A214 2 3VCC 13 12CP1 MR1 MR21 2 314 13 12CP0 NC 3 Q0CP1 2 NC 14 NC 41 15 2 COUT 3 1314 2 13 3 12 4CP0 15 NC 14 Q0 13
VCC512GNDA > B512A1411NC411Q3NC411Q1
∑2611B1A = B611B1510VCC510GNDVCC510GND
B2710A1A < B710A069MS169Q1MR169Q2
A28 CP19 1 MR2∑1 CP1 14 3GND 1 CP0 RD1 128 16 SD1 3 Q09 K1 Q1 14 J1B0 RD1 J1 Q1 GNDGND 1 RD2 MR1 K1 CP17 16 K1 2 2 3 K2 48 7493 VCC RD1 15 13 14 SD1 13MS2 74106 CP1 Q 2 NC J2 CP2 47 74109 1 1 15 RD2 J1 A1 138 74112 16 14 2 2 3 3 4Q2 74121 VCC VCC 15 13 14 12 13MR278Q3
NC411Q3VCC512K2SD1512CP2Q1512K2A2411Rext/Cext
VCC510GNDCP2611Q2Q1611RD2Q1611J2B510C
NC69Q1SD2710Q2Q1710Q2Q2710SD2Q6Q Q9Rint
A1116VCCA0116VCCEa116VCCI4116VCC
114VCCA1Eb B1I5 215Rext/Cext 12150A0a2152 215 13
RD13 I414 1Cext 1 16A2 VCC3 GND D614 Q1 Q2 Rext/Cext2 A2 D81 Q1 Q2 Cext2 6 B2 GND I3A1a 3 4 4 5 5 11 6 7 7 8 D7 13 12 13 11 12 10 RD2 9 10 8 9 1 1614 E1 4 E2 5 E3 6 7 7 GND 8 24 VCCA0b 2 13 3 12 4 11 5 10 6 9 74148 VCC A0 2I6 0a 4 1a 5 2a 6 3a 7 GND 8 74150 0 SR 233 A1b 13 0b 12 1b 11 2b 10 3b 9 74151 1 1 114 I7 4 I8 5 A2 6 A1 7 GND 8 74154 24 16 2A3 I3 13 I2 12 I1 11 I9 10 A0 9 74163 VCC VCC 23
I5215 I6EO GS I7D5 D4 43 4 1322 21 I3D9 D10 D2I2 I1 D3 I02 I5 5 4 615 3 3 20 13 19I4 4 14 D11 I6 D122 21 3 4 D1 53 A2 14 5 4 622 D0 3 20 13 19A1 Q0 14 A3 Q1 E1CP215TC
EI512 A2I2 I1D1 D0 A17 8 718 17 10D13 D14 I0Y Y E E Y5 S0 9 7 1012 7 6 16 10 15I7 8 11 D15 S1 S06 17 6 8 CEP 97 15 11 9 7 1018 D3 6 16 10 15E0 Q3 11 14 CET 13D2512Q2
GND89A0S31114S1GND GND8 129 13S2 S2 7416410 GND 74165 B011 12 74181 114 13 74190 2412 11 74191 VCCGND89PE
PL116 Q0VCC Dsa D4 3A0 1 3 122 14 14 Q623 VCC D3 D5A1 CP B2 4D1 CE Dsb Q0 131 S3 2 2 3 D216 3 15 13 14 CE S0VCC 22 2 Q7 CP 4 6D1 B1 15 S2 Q0 13 191 Q1 2 4 3 S1 RC A316 D0 15 21 14 5 CE 4VCC Q1 D0 A2 CP 20 RC 13
Q1411 Q2Q5 5D6 105 Q412 D7D1 D0Cn M7 818 17 6B3 G 11U/D Q2 6 F05 PL 11 912 Q2 6 16TC PL 11 Cn + 4U/D512TC
Q369MRQ7710DSF1PQ3710D2Q3 107 1510D2
GND78CPGND89Q7F2 OEa11 114 20A = B 74192 VCCGND GND 74193 S/R8 12 74194 19 13 74244 20D3 F3 74245 VCCGND89D3
D1116VCCD1116VCCMR116VCCIa0OEbA0 22 1919CE
Q1215D0Q1215D0DSR215Q0Yb0Ya0A1 33 1818B0
Q0314MRQ0314MRD0314Q1Ia1417Ib0A2417B1
CPD413TCDCPD413TCDD1413Q2Yb1516Ya1A3516B2
CPU512TCUCPU512TCUD2512Q3Ia2615Ib1A4615B3
Q2611PLQ2611PLD3611CPYb2714Ya2A5714B4
Q3710D2Q3710D2DSL710S1Ia3813Ib2A6813B5
GND89D3GND89D3GND GND OE8 10 19 11 20S0 Ib3 74280 VCCYb3 GND 74283 OE9 10 74373 112 11 74374 20Ya3 B7 74395 VCCA7912B6
∑2116VCC I7Q0 I6 22 1 1319 14 I5Q7 VCC A2Q0 B2 2 D12 B3 15 4 319 D0 3 17 14Q7 D7 18 D6 A3MR D0 3 D1 D01 D7 18 4 316 DS 2 17 14VCC Q0 15 D6 Q1
312I4∑1 ∑E4 I8 513 I3 10∑3 Q2 I2Q1 6 B15 15 4 D2 6 D316 Q5 11 7 11 8Q6 Q2 A1 14 B4 13Q1 6 5 D5 D3 D45 15 12 D2 6 D316 Q5 A4 7 11 8Q6 D2 5 14 Q3 13D1 Q3 12 D5 ´ D4413Q2
∑O69I1CIN710∑4Q3912Q4Q3912Q4PE710CP

William Kleitz

VHDL by Example

SIGNALDeclare
"input"before

BEGIN

MakeA vector with3 elements
LibraryDeclare which VHDL Declaration Entity declaration quotes for bits andafter BEGIN library to use Selected signal assignment Entity name Note: Singleassignments
Architecturedouble quotes bodyfor vectors Define the logic

Architecture name fig5_62.vhd

Figure 4-13 (b) output level sent to X input (0) input (1)

input (2)

Figure 5-62

Note

Note: VHDL has no order

of precedence so parentheses are required for proper grouping.

Loop 4 times for i = 3, 2, 1 then 0

Figure 5-52

ex6_10.vhd

Sequential process Figure 6-24

5 6 Enable must be HIGH to execute the THEN clause Asynchronous Reset

when a = 000,Check for positive
y = 00000001clock edge

Synchronous operation Each IF requires an END IF ex10_9.vhd

all LOW outputs Figure 10-26 (a) decoder_d.vhd

Figure 8-21 (a)

Buffer declares q as output and input Concatenate j and k into a 2-bit vector Double quote required for vector quantities ex10_14.vhd

Required for vector arithmetic

add or subtract control Sensitivity list alb 3-bit internal aeb 8-bit vectors agb WHEN ELSE conditional assignment

ex7_26.vhdAssign vector elements
Figure 7-31to outputs

compare_8b.vhd

Figure 8-5

y0y7
Internal interconnection signala2 a0

Sensitivity list ex7_27.vhd IF-THEN-ELSE sequential statements

Figure 7-33 decoder_b.vhd

Figure 8-19

7 8 Input and output

Asynchronous Reset has priorityAsynchronous
Input to equationNegative clock edgeClock enable

Output to CPLD pins

mod16up.vhd Up/down control counter_b.vhd

Figure 12-71

Defines a new

data type havingD flip-flopfrom
the allowableExample values s0-s7.10-9

Increment state to next state.

External I/Ofor shiftreg
Declare theuse of the
componentI/O for eachcomponent dflipflop
Assign binary to qdflipflopfrom above
based on valueThis defines the internal and external connections
of state.Four

instantiations

state_gray.vhd component name Keyword shiftreg.vhd

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Replying to