Professional Documents
Culture Documents
(1) PC: Figure below shows the 80x86 microprocessor and other peripherals in mother-board
Monitor
Graphics Parallel
Adapter Printer
Interface
ROM and
RAM
80x86 serial
Controllers Modem
CPU Interface
of Timer,
DMA,
Interrupt
Hard-disk LAN
LAN Hub
Keyboard/ Floppy Adapter
Mouse/ Controller
Speker
(4) RISC Processors: In 1980, reduces instruction set computers were designed (for servers)
- required less processor registers, clock cycles, addressing
modes compared to CISC (complex instruction set) computers
1
Internal Architecture of Microprocessor: Employ simultaneous operation
Address
Address
Instruction
Princeton
Instruction
Harvard
Architecture Architecture
Data
Data
and
Control
and
Control
Output Arithmetic
Output Arithmetic Control
Control Control
Control Input Logic Unit
Input Logic Unit
Clock
Clock Status
Status
Number systems: Bit (One Binary digit), Byte (Consist of Eight Bits), Word (two Bytes), Double-Word
MSB LSB
Addition Substation
2FH = 00101111B = 47D 0–0=0 0+0=0
0 – 1 = -1 (with 0+1=1
borrow)
MS LS 1–0=1 1+0=1
1–1=0 1 + 1 = 10
nibble nibble (the 1 is carried)
2
Dec. Bin. Operation Quotient Remainder
Example 3: 6D 2D 3D 0 LSB
Convert 6D into 3D 2D 1D 1
Binary number
Thus, 6D = 110B 1D 2D 0D 1 MSB
3
Software Model of 8088/8086 microprocessor:
Registers used for physical address generation
CPU
Input/Output
Code Segment, (CS)
00000 H 1 Byte
Data Segment, (DS) 0000 H 1 Byte
00001 H 5 AH
Stack Segment, (SS) 0001 H 5 AH
00002 H
Extra Segment, (ES) 0002 H
00003 H 64-KByte of
0003 H
00004 H Accumulator Reg., (AX) bytewide
1-MByte of . input- output
. Base Register, (BX)
byte–wide address
Main . spaces
Counter Register, (CX)
. memory
storage Data Register, (DX)
locations FFFE H F FH
FFFFC H Stack pointer, (SP) FFFF H A 6H
FFFFC H Base pointer, (BP)
FFFFE H 8 CH Destination Index, (DI) Registers used for physical address generation
FFFFF H A 6H
Status Register, (SR)
Physical Memory
- 80x86 registers are 16-bit or 4-hex digit Address(PA) Contents
00000 H 4 9H
Aligned
- Main memory (RAM) 1 Mega byte (8-bit)
00001 H 5 AH Word
- Note, PA=00001H stores a data Byte of “5AH”, 00002 H 6 2H
4
(a) Carry Flag (CF): Carry or Borrow occurred from the MSB of DATA. [CY=1 (set) or NC=0 (reset)].
Example: 10001111B +11110000B = 01111111B and CF CY
(b) Parity FLAG (PF): Depends on the number of binary 1’ in DATA. [PE=1 (set) or PO=0 (reset)
only for 8086 and 8088]. Example: 10001111B +11110000B = 01111111B and PF PO
(c) Auxiliary FLAG (AF): Carry or Borrow from the LSNibble of DATA. [AC=1 (set) or NA=0 (reset)].
Ex: 10001111B +01001000B = 11010111B and AF AC
(d) Zero FLAG (ZF): Previous program-line results in zero DATA. [ZR=1 (set) or NZ=0 (reset)]. Example:
00000001B -00000001B = 0B and ZF ZR only for 8086 and 8088….. not for 8051
The 8051 microcontrollers: This chapter discussed the role and importance of microcontrollers
(MC) in everyday life. Microprocessors (MP) and MC will be contrasted and compared. Discussion will
include the use of MC in embedded market and the criteria for selecting a MC for certain application
based on required speed, memory, I/O, packaging and cost per unit. The 2nd section of this chapter
described various families of 8051 with related features.
Timer: count pulses as counter, or generate pulses related time delay Chapter 9
Oscillator: needs a external qurtz crystal clock generator.
Four I/O ports with 32 pins: P0 = ‘A’/’D’ (ALE=0D), P2=‘A’, P3=control or interrupt
signals (when connected with external memory)
An Interrupt: is an external or internal event that interrupts the MC to inform it that a
device needs its service. Every interrupt has a program associated with it called
the INT service routine. The 8051 has 6 interrupts, 5 of which are user
accessible. Interrupts One is for reset, Two for the timers, Two for the external
hardware interrupts, and One for serial communication interrupt. Chapter 11
5
Figure 1-2: SFR (special function register), PC, Timers/counters, RAM, -processor (ALU..)
• Typically, microcontroller can perform ONE external task at a time (as programmed in ROM)
• A PC can be used for any number of applications as processor, memory (RAM, ROM) … can
be instantly accessed using keyboard. It often contain several peripherical with inbuilt
microcontrollers (like Mouse, HD, Keyboard…..)
• Telephones, computers, security systems, fax machines, microwave, copier, laser printer,
color printer, paging
• Trip computer, engine control, air bag, ABS, instrumentation, security system,
transmission control, entertainment, climate control, cellular phone, keyless entry
6
integrate more functions on the CPU chip and let designer decide which features they wants.
Popular 8-bit microcontrollers
• Motorola’s 6811: Princeton/Von-Neumann architecture
• Intel’s 8051: Harvard architecture
• ARM’s ARM2: RISC microcontroller that uses Princeton/Von-Neumann architecture. It is
mostly suitable for systems that require fast computing, large number of timer and ADC's
• Microchip’s PIC: Harvard architecture and mostly used in Cheap , used in refrigerators and low
budget projects
• Amtel’s AVR: Harvard architecture, has on-chip flash memory (no EPROM) ARDUINO
Note that 8051 and PIC need multiple clock cycles per instruction. AVR and ARM execute most
instructions in a single clock cycle
8051 and PIC have limited stack space - limited to 128 bytes for the 8051, and as little as 8 words or
less for PIC. Writing a C compiler for these architectures must have been challenging, and compiler
choice is limited.
8051, AVR and ARM can directly address all available RAM. PIC can only directly address 256 bytes
and must use bank switching to extend it at a cost of speed.
• There are also 16-bit and 32-bit microcontrollers made by various chip makers
• Selection Criteria of microcontroller: needs to meet the computing needs of the task at hand
efficiently and cost effectively
• Speed
• Packaging
• Power consumption
• The amount of RAM and ROM on chip
• The number of I/O pins and the timer on chip
• How easy to upgrade to higher-performance or lower power-consumption versions
• Cost per unit
• Availability of software development tools, such as compilers, assemblers, and debuggers
7
• Wide availability and reliable sources of the microcontroller
• The 8051 family has the largest number of diversified (multiple source) suppliers
• The 8051 became widely popular after allowing other manufactures to make and market any
flavor of the 8051, but remaining code-compatible
• The 8051 is a subset of the 8052
- All programs written for 8051 will run in 8052, but not vice versa
- External ROM (<64K) is addressed using 16-pins of port 0 & 1
- UV-EPROM version of 8051 is called 8751 & AMTEL 8051 is AT89C51.
- Has two external hardware interrupt (INT0 & INT1 of last slide & used through pins P3.2
& P3.3) are activated with “0” and use location 0003 and 0031 (pg 326)
• The 8031 is a ROM-less 8051
• Add external ROM to it
• You lose two ports, and leave only 2 ports for I/O operations
- Summary table:
8
- Various 8051 family of microcontrollers: