Microcomputer Basics
Microcomputer Basics
Microcomputer Basics
O B jE C Ti v E s KEy TERMs
After completing this chapter, the student will be 46 digital computer 46-2 logic instructions
able to:
46-1 arithmetic logic 46-2 masking
■■ Identify the basic blocks of a digital computer.
unit (ALU) 46-2 microprocessor
■■ Explain the function of each block of a digital
computer. 46-1 central 46-2 miscellaneous
processing unit instructions
■■ Describe what a program is and its relationship
(CPU)
to both digital computers and microprocessors. 46-2 program-control
■■ Identify the basic registers in a microprocessor. 46-1 control unit instruction
■■ Explain how a microprocessor operates. 46-1 input/output 46-2 program counter
Identify the instruction groups associated with (I/O)
■■
46-2 rotate and shift
microprocessors. 46-1 instruction instructions
■■ Identify the purpose of microcontrollers. register
46-2 stack
■■ Describe the function of microcontrollers in 46-1 interrupt
everyday life. 46-2 stack instructions
46-1 microprocessing
unit (MPU) 46-2 stack pointer
46-1 program 46-3 microcontroller
46-2 accumulator 46-3 PDIP
46-2 arithmetic 46-3 PLCC
instructions 46-3 programmable
46-2 compare interface
instructions controller (PIC)
46-2 complement 46-3 QFN
instruction 46-3 reduced
46-2 condition-code instruction set
register computer (RISC)
46-2 data movement 46-3 SOIC
instructions 46-3 SSOP
46-2 input/output
(I/O) instructions
438
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Microcomputer Basics CHAPTER 46 439
T
he greatest application of digital circuits is in digi- ■■FiguRE 46-1
tal computers. A digital computer is a device Basic blocks of a digital computer.
that automatically processes data using digital
techniques. Data are pieces of information. Process-
ing refers to the variety of ways that data can be Input
manipulated.
Digital computers are classified by size and com-
puting power. The largest computers are called CPU Arithmetic
mainframes. These computers are expensive, having or Control logic unit Memory
MPU
extensive memory and high-speed calculating capa- (ALU)
bilities. Smaller-scale computers—the minicomputer
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
440 sECTi ON 6 D IgItAL ELECtRONIC CIRCUItS
■■FiguRE 46-2
Control unit of a computer.
To logic circuitry
Clock
To From
memory or input memory or input
The arithmetic logic unit (aLu) performs math (decreased by one), shifted right (one position), or
logic and decision-making operations. Most ALU can shifted left (one position). The accumulator is the
do addition and subtraction. Multiplication and divi- same size as the memory word; the memory word is 32
sion are programmed in the control unit. The ALU bits wide, and the accumulator is also 32 bits wide in a
can perform logic operations such as inversion, AND, 32-bit microprocessor.
OR, and exclusive OR. It can also make decisions by The arithmetic logic circuitry is basically a binary
comparing numbers or test for specific quantities such adder. Both addition and subtraction can be done with
as 0s, 1s, or negative numbers. the binary adder as well as logic operations. To add
Figure 46-3 shows an arithmetic logic unit. It con- two binary numbers, one number is stored in the ac-
sists of arithmetic logic circuitry and an accumulator cumulator register and the other is stored in the data
register. All data to the accumulator and the ALU are register. The sum of the two numbers is then placed in
sent via the data register. The accumulator register the accumulator register, replacing the original binary
can be incremented (increased by one), decremented number.
Memory is the area where programs are stored.
programs contain the instructions that tell the com-
puter what to do. A program is a sequential set of in-
■■FiguRE 46-3 structions to solve a particular problem.
Arithmetic logic unit (ALU). A computer memory is simply a number of stor-
age registers. Data can be loaded into the registers
Arithmetic logic unit and then taken out, or “read out” to perform some
Arithmetic
logic operation, without losing the register content. Each
unit register or memory location is assigned a number
called an address. The address is used to locate data
in memory.
Figure 46-4 shows a typical memory layout. The
Accumulator Data register memory registers retain the binary data. This memory,
based on its ability to store (write) or retrieve (read)
© 2014 Cengage Learning
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Microcomputer Basics CHAPTER 46 441
■■FiguRE 46-4
Memory layout for a computer.
Memory
cell ID circuitry
Data storage
The memory address register allows access to peripheral equipment enters data into a computer
specific memory locations by the memory address through the input unit. Data from the computer are
decoder. The size of the memory address register de- passed to external peripheral equipment through the
termines the maximum memory size for a computer. output unit.
For example, a memory address register of 16 bits al- The input and output units are under the control of
lows a maximum number of 2 16 or 65,536 memory the CPU. Special I/O instructions are used to transfer
locations. data in and out of the computer.
A word to be stored in memory is located in the Most digital computers can perform I/O operations
data register and then placed in the desired memory at the request of an interrupt. An interrupt is a sig-
location. To read data from memory, the memory lo- nal from an external device requesting service in the
cation is determined, and data at the memory location form of receiving or transmitting data. The interrupt
are loaded into the shift register. results in the computer leaving the current program
The input and output units of a computer al- and jumping to another program. When the interrupt
low it to receive and transmit information from and request is accomplished, the computer returns to the
to the world outside the computer. An operator or original program.
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
442 sECTi ON 6 D IgItAL ELECtRONIC CIRCUItS
■■FiguRE 46-5
46–1 QuestioNs Parts of an 8-bit microprocessor.
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Microcomputer Basics CHAPTER 46 443
■■FiguRE 46-6
Data movement instructions.
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
444 sECTi ON 6 D IgItAL ELECtRONIC CIRCUItS
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Microcomputer Basics CHAPTER 46 445
■■FiguRE 46-7
Block diagram of a microcontroller.
Input
Address bus
Control bus
Data bus
Memory
Address
Microprocessor ROM &
decoder
RAM
The MCS 51 features 4 kbytes of EPROM/ ROM; a family of microcontrollers made by Microchip
128 bytes of RAM; 32 input/out lines; two 16-bit timer/ Technology that use reduced instruction set
counters; five-source, two-level interrupt structures; a computer (risC) . RISC is based on the strategy
full-duplex serial port; and an on-chip oscillator and that fewer basic instructions allow for higher perfor-
clock circuitry. mance. Basing microcontrollers on this architecture is
The 68HC11 is a powerful 8-bit, 16-bit address a strategy that was derived from the original PIC1640
microcontroller developed by Motorola, now pro- microcontroller.
duced by Freescale Semiconductor. It has an in- PIC microcontrollers are widely available, inex-
struction set that is similar to the older 68xx (6801, pensive, and do not require a lot of prerequisites be-
6805, and 6809) family. Depending on the applica- fore running in an application. The PIC development
tion, the 68HC11 comes with a variety of features environment is freely available and up to date. There
including built-in windowed EPROM/ EEPROM/ is a broad range of different PIC microcontrollers, to
OTPROM (one-time programmable), static RAM, fit any application. The hardware programming is easy
digital I/O, timers, A/D converter, PWM generator, and does not require a lot of additional equipment
and synchronous and asynchronous communication or programmers. The various PIC packages available
channels. Freescale Semiconductor offers a low-cost include pDip (plastic dual in-line package), ssop
evaluation board to explore the capabilities of the (shrink small outline package), soiC (small outline
68HC11. package), pLCC (plastic leaded chip carrier), and QFN
The Microelectronics Division of General Instru- (quad flat no-lead package) (Figure 46-9). PIC pack-
ment developed the first version of a program- ages allow for convenient prototyping without a lot of
mable interface controller (piC). PICs are now effort.
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
446 sECTi ON 6 D IgItAL ELECtRONIC CIRCUItS
■■FiguRE 46-8
Microcontroller block diagram of the MCS 51.
P0.0–P0.7 P2.0–P2.7
VCC
Ram addr.
register
Program
addr.
ACC Stack register
pointer
Buffer
B TMP2 TMP1
Register
Interrupt, serial port, PC
ALU
and timer blocks incrementer
Program
PSW
counter
PSEN
Instruction
Timing
register
ALE
and DPTR
EA
control
RST
Port 1 Port 3
latch latch
Port 1 Port 3
Osc.
drivers drivers
■■FiguRE 46-9
Various PIC package outlines.
28
27
26
25
24
23
22
1 18 1 20 1 21
44
43
42
41
40
39
38
37
36
35
34
2 19 2 20
2 17 1 33
3 18 2 32 3 19
4 17 3 31 4 18
3 16
5 16 4 30 5 17
4 15 6 15 5 29 6 16
7 14 6 28
5 14 7 15
8 13 7
12
13
14
10
27
11
8
9
9 12 8 26
6 13 10 11 9 25 QFN
7 12 10 24
© 2014 Cengage Learning
SSOP 11 23
20
21
22
12
13
14
15
16
17
18
19
8 11
9 10
PLCC
PDIP, SOIC
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.