Quick viewing(Text Mode)

Microprocessor, Microcomputer and Their Applications Fourth Edition

Microprocessor, Microcomputer and Their Applications Fourth Edition

Microprocessor, and their Applications Fourth Edition

A.K. Mukhopadhyay

Alpha Science International Ltd. Oxford, U.K. Contents

vii Preface to the Fourth Edition Preface to the First Edition ix

1. -A Physical System 1

2. The Microprocessor System 5 2.1 (CPU) 5 2.2 Arithmetic-Logic Section 6

2.3 6

2.4 Status Registers 7

2.5 ALU 7

2.6 General Purpose Registers 8 2.7 Control Registers 8 2.8 (PC) 8 2.9 Stack Pointer (SP) 8 2.10 Index Register (IX) 9 2.11 Instruction Register (IR) and Decoder 9 2.12 Timing and Control Unit 9

2.13 The Clock 70

2.14 Reset 70 2.15 Interrupt 70 2.16 Hold 70

2.17 READ and WRITE 7 7

2.18 IORandMR77

2.19 Address Latch Enable 77

3. The 8085A Microprocessor 12 3.1 Architecture and Organisation of 8085A 72 3.2 The ALU 14 3.3 Registers 14 3.4 Timing and Control Unit 75 3.5 Pin Configuration of 8085A 77 3.6 Interface 18 8085 Assembly Language Programming 4.1 Instruction Set for 8085/8085A 22

4.2 Data Movement Instructions 23

4.3 PUSH and POP 25

4.4 Increment and Decrement Instructions 26

4.5 Rotate and Shift Instructions 26 4.6 Set, Compliment and Decimal Adjustment Instructions 28 4.7 Add, Subtract and Compare Instructions 29 4.8 AND, OR EXCLUSIVE-OR Instructions 30 4.9 JUMP, CALL and RESTART Instructions 31 4.10 CONDITIONAL JUMP, CALL and RETURN 31 4.11 Loops in Programs 32 4.12 Uses of Subroutines 33 4.13 Delay Subroutine 38

4.14 Instruction Modes 43 4.15 Instruction Bytes 43

Memories

5.1 Semiconductor Memories 45

5.2 Non-volatile RAM 46

5.3 Pin Configuration of RAM, EPROM and EEPROM 47 5.4 Dynamic RAM 48 5.5 Memory Map 49

Interfacing the 6.1 Speed 50

6.2 Level 50

6.3 Data Form 57

6.4 Control Function 51 6.5 Bus-Demultiplexing 54 6.6 Decoder and Address Decoding 54 6.7 Mapping 58 6.8 Timing Parameters 60 6.9 READ Operation 60 6.10 WRITE Operation 61 6.11 63

6.12 HOLD State 64

6.13 HALT State 65 6.14 Interrupt States 65 Contents

7. Input-Output Devices 7.1 I/O Ports 66

7.1.1 Mode-1 (Hand-shake input port) P as input port 68 7.1.2 Hand shake input port (Mode 1) PB as input port 69 7.1.3 Hand shaking mode (Mode 1), Ph as output port 70 7.1.4 Hand shaking mode (Mode 1) PB as output port 71 7.1.5 Mode 2: Stroke bi-direction bi-directional but input/output 71 7.1.6 Control word format for Mode 1 operation, PA and PB acting input/output port 72 7.1.7 Control word format for 8255 in Mode 2 72

7.1.8 Single port Set/Reset (BSR) Mode 73 7.2 Key Board and Display 75 7.3 Seven Segment Display and Key Board Interface 76 7.4 D/A Converter 80

7.4.1 DAC 0800 80

7.4.2 DAC0808 81 7.4.3 Digital voice communication 81 7.5 A/D Converter 82

7.5.1 ADC 0809 83

7.5.2 Converter characteristics 85 7.6 Standard Peripherals 86

8. Serial Interface Techniques 8.1 Introduction 88 8.2 Protocols for Synchronous Serial Communication 88 8.3 IBM's Synchronous Data Link Control (SDLC) 88 8.3.1 Bit-Format 89

8.3.2 Non-return to zero-format 89 8.3.3 Phase encoding format 89 8.3.4 Double frequency format 90 8.3.5 Manchester coding format 90 8.3.6 Pulse width Modulation format 90 8.3.7 Kansas city standard 90 8.3.8 Serial communication standards 91

8.4 RS-232C 91 8.5 Universal Synchronous Asynchronous Receiver Transmitter (USART) 92 8.6 Telephone Lines 95 xiv Contents

8.7 Teletypes 96 8.8 Audio Cassette Tapes 97 8.9 Disc systems 97 8.10 Floppy Disc 97 8.11 Video Monitors 98

9. Controlling and Peripheral Devices 99 9.1 Timer/Counter 99

9.1.1 Pin configuration of timer/counter 99 9.2 Interrupt Controllers 103 9.2.1 Master-slave configuration of 8259 106 9.3 DMA Controller 8237 107

9.3.1 Command registor format for 8237 A109 9.3.2 DMA controller 8257 111 9.4 Single Step Logic 114

10. Some Useful I/O Devices 115 10.1 Introduction 115 10.2 Zero Crossing Detector (ZCD) 115 10.3 Peak Detector 116 10.4 Opto-Coupler 116 10.5 Relay 117

10.6 Parallel Communication Bus Standard 118 10.7 General Purpose Interface Bus (GPIB) 118 10.8 Multitalker-Listener 119 10.9 Printer 121

10.10 Sixteen Channel Multiplexer (1H6116) 121

11. Programming a Microprocessor 125 11.1 Writing a Program 125 11.2 Display Techniques for INTEL 8279 126 11.3 Program Examples 127 11.4 Developing Subprogram 135 11.5 Space and Speed 137 11.6 Data Structure 138 11.7 System Programming 138 11.8 Some More Program Development 138 11.9 Use of Timer/Counter in Different Modes 164

11.9.1 Mode 0 interruption terminal count 164 Contents

11.9.2 Mode 1 Programmable one shot 766 11.9.3 Mode 2 rate generator 166

11.9.4 Mode 3 square wave generator 767 11.9.5 Mode 4 software triggered strobe 765 11.9.6 Mode 5 hardware triggered strobe 765

12. Microprocessor: An overview 12.1 Types of Microprocessors 7 70 12.2 Variety of Microprocessor 7 77 12.3 Special Feature 777 12.4 Instruction Set 772 12.5 Addressing Modes 773 12.6 Writing Programs 7 73 12.7 General Purpose Microporcessors 775 12.7.1 ZilogZ-80 775 12.7.2 Software examples with z-80 based microprocessor 7 12.8 Motorola MC 6809 779

12.9 MOS Tech 6502 750

12.10 Bit Slice Processors 750 12.11 Zilog Z-8000 Family 752 12.12 Motorola MC 68000 Family 752 12.13 Texas Instruments TMS 9900 Family 752 12.14 32-Bit Processors 183 12.15 Zilog Z-80000 753

13.

13.1 INTEL 8086: iAPZ86 Family 184 13.2 Architecture and Organisation of 8086 184 13.3 Execution Unit (EU) 755 13.4 Bus Interface Unit (BIU) 756 13.5 Register Structure 756 13.5.1 General registers 756 13.5.2 Pointer register and index register 757 13.5.2 Segment registers 755 13.5.3 Control registers 755 13.6 Memory Addressing 759 13.6.1 Physicl address generation 790 13.7 Dynamically Relocatable Code 797 13.8 Dedicated and Reserved Memory Location 792 13.9 Pin Configuration of INTEL 8086 193 13.9.1 Minimum and maximum modes of operation 194 13.9.2 Pin configuration of intel 8086 in minimum mode 194 13.9.3 Pin configuration of intel 8086 in minimum mode 198 13.9.4 Memory interface of intel 8086 in minimum mode configuration 13.9.5 Memory interface of intel 8086 in maximum mode configuration 13.9.6 Multiprogramming and multiprocessing 203 13.9.7 Interrupt structure of intel 8086 204 13.9.8 Interrupt interface in minimum mode configuration 206 13.9.9 Interrupt interface in maximum mode configuration 207 13.10 Addressing Modes 207

13.11 Instruction Set 208

13.12 Arithmetic Instruction 210 13.13 Bit Manipulation Instruction 211 13.14 Processor Control Instruction 214 13.15 Program Examples 214 13.16 277

13.16.1 Different modes of operation of 8088 217 13.16.2 Comparison between 8086 and 8088 219

14. Microprocessor Applications and Development of On-Line Real-Time Systems 14.1 Introduction 220 14.2 Voltage Measurement 221 14.3 Current Measurement 226

14.4 Frequency Measurement 227 14.5 Speed Measurement 232 14.6 Temperature Monitoring 234 14.7 Over Current Protection 238 14.8 Speed Control of DC Series Motor 240 14.9 Monitoring of Power Factor, Horse Power, Efficiency Slip and Speed of a Three Phase Induction Motor 246

15. Single Chip ()

15.1 Intel 8031 270 15.2 Description of the 8031 Chip 270 15.3 Pin Configuration of the 8031 and Intel 51-Family 271 15.4 Organisation of the 8031 272 15.5 277 Contents xvii

15.6 Memory Organisation 279

15.7 Intel 8751 282

15.8 Programming Technique of Intel 51 -Family 283 15.9 Some Programming Examples 287 15.10 Some Useful Sub-routines 294

15.11 The Motorola MC 68701 299

16. From Intel 8086 to the Processor 300

16.1 Introduction 300 16.2 The (i 186) Microprocessor 301 16.2.1 Pin configuration of Intel 80186 301

16.2.2 Instruction set 303

16.3 The (i286) Microprocessor 304 16.3.1 Processing units of the 80286 305 16.3.2 Memory address modes of the 80286 306 16.3.3 Descriptors and selectors 308 16.3.4 Address translation registers and physical addresses 309

16.3.5 Protection mechanisms in the 80286 310

16.3.6 Task switching and task gates 310

16.3.7 Some instructions for PVAM 311 16.3.8 Pin configuration of intel 80286 311 16.4 The Intel 80386 32-Bit Microprocessor 314

16.4.1 Code segment, instruction pointer and program execution 315 16.4.2 Stack segment and stack pointer 316

16.4.3 Data segment and memory addressing 317

16.4.4 RISC mechanism and hardware instructions 317

16.4.5 Non destructive operation 318 16.4.6 Instruction pipelining 318 16.5 The Intel 80486 Processor 319

16.5.1 Basic 80486 architecture 320

16.5.2 The internal structure of the 321

16.5.3 The 80486 memory and 323 16.5.4 The i486 and the cache register 324

16.5.5 The 80486 instruction set 325

16.5.6 Pin configuration of the intel 80486 microprocessor 326

16.6 The Pentium Processor 328 16.6.1 The pentium registers 329 16.6.2 The flag register of the pentium 331 xviii Contents

16.6.3 Control registers of the pentium 331 16.6.4 The debug registers 333

16.6.5 The memory management, test and model specific registers 334 16.6.6 Registers of the floating-point unit 334 16.6.7 The integer pipelines U and V 335 16.6.8 The floating point pipeline 336 16.6.9 Pin configuration of the pentium 336

17. Introduction to 342 17.1 Introduction 342 17.2 Features of Embedded System 342 17.3 Some Examples of Embedded System 342

17.4 Characteristics of an Embedded System 343 17.5 8/16 Bits Microprocessor/Microcontroller 344 17.6 Static VAR Controller 344 17.7 Major Causes of Energy Loss 344

17.8 Introduction to SVC 345 17.9 Why Static Var Compensator (SVC) 345 17.10 Types of SVC 345 17.11 Why 8051 CPU Based Microcontroller Used 345 17.12 Modeling 346 17.13 Load Bus Voltage Control Philosophy 346 17.14 System Hardware 347 17.15 Power Circuit 348

17.16 Firing Angle Controller Module 348 17.17 Signal Transmitting Circuitry 348 17.18 System Software 349

17.19 Generation of a Set of Six Triggering Pluses 349 17.20 Limitation^

Appendices

1. 8085/8085A Instruction Set 353

2. Z-80 Instruction Set 358

3. Some Instruction Sets of 8086 CPU 369

4. Some Advanced Features in 8085A 372 5. Standard Peripherals for Motorola, Zilog and Rockwell System 377

References 379 Index 381