Microprocessors and Interfacing 8086, 8051, 8096, and Advanced Processors
Total Page:16
File Type:pdf, Size:1020Kb
Microprocessors and Interfacing 8086, 8051, 8096, and advanced processors N. Senthil Kumar Professor Department of Electrical and Electronics Engineering Mepco Schlenk Engineering College Sivakasi, Tamil Nadu Press M. Saravanan Professor Department of Electrical and Electronics Engineering Thiagarajar College of Engineering Madurai, Tamil Nadu S. Jeevananthan UniversityProfessor Department of Electrical and Electronics Engineering Pondicherry Engineering College Puducherry S.K. Shah OxfordProfessor and Head Department of Electrical Engineering MS University of Baroda Vadodara, Gujarat © Oxford University Press. All rights reserved. 3 Oxford University Press is a department of the University of Oxford. It furthers the University’s objective of excellence in research, scholarship, and education by publishing worldwide. Oxford is a registered trade mark of Oxford University Press in the UK and in certain other countries. Published in India by Oxford University Press YMCA Library Building, 1 Jai Singh Road, New Delhi 110001, India © Oxford University Press 2012 The moral rights of the author/s have been asserted. First published in 2012 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, without the prior permission in writing of Oxford University Press, or as expressly permitted by law, by licence, or under terms agreed with the appropriate reprographics rights organization. Enquiries concerning reproduction outside the scope of the above should be sent to the Rights Department, Oxford University Press, at the address above. Press You must not circulate this work in any other form and you must impose this same condition on any acquirer. ISBN-13: 978-0-19-807906-4 ISBN-10: 0-19-807906-0 Typeset in Times New Roman by Trinity Designers & Typesetters, Chennai Printed in India byUniversity Tara Art Printers (P) Ltd, Noida Oxford © Oxford University Press. All rights reserved. Brief Contents xi Brief Contents Features of the Book iv Preface vii 1. Microprocessors—Evolution and Introduction to 8085 1 2. Methods of Data Transfer and Serial Transfer Protocols 47 PART I: INTEL 8086—16-BIT MICROPROCESSORS 3. Intel 8086 Microprocessor Architecture, Features, and Signals 63 4. Addressing Modes, Instruction Set, and Programming of 8086 80 5. 8086 Interrupts 175 6. Memory and I/O Interfacing Press 210 7. Features and Interfacing of Programmable Devices for 8086-based Systems 240 0XOWLSURFHVVRU&RQ¿JXUDWLRQ 9. 8086-based Systems 372 PART II: INTEL 8051—8-BITUniversity MICROCONTROLLERS 10. Introduction to 8051 Microcontrollers 391 11. 8051 Instruction Set and Programming 402 12. Hardware Features of 8051 427 13. 8051 InterfaceOxford Examples 464 PART III: INTEL 8096—16-BIT MICROCONTROLLERS 14. Overview of Intel 8096 Microcontrollers 517 15. 8096 Instruction Set and Programming 530 16. Hardware Features of 8096 549 PART IV: ADVANCED TRENDS 17. Microprocessor System Developments and Recent Trends 591 18. Advanced Microprocessors and Microcontrollers 604 19. Embedded Systems 663 20. Hybrid Programming Techniques Using ASM and C/C++ 736 © Oxford University Press. All rights reserved. xii Brief Contents Appendix A: 8086 Case Studies 752 Appendix B: 8051 Case Studies 758 Appendix C: 8275 CRT Controller Chip 766 Appendix D: Multiple Choice Questions 777 Appendix E: 8086 Instruction Set 797 Appendix F: 8051 Instruction Set 803 Bibliography 811 Index 812 Press University Oxford © Oxford University Press. All rights reserved. Detailed Contents xiii Detailed Contents Features of the Book iv Preface vii Brief Contents xi 1. Microprocessors—Evolution and Introduction to 8085 1 1.1 Introduction 1 1.2 Explanation of Basic Terms 2 1.3 Microprocessors and Microcontrollers 5 1.4 Microprocessor-based System 6 1.5 Origin of Microprocessors 7 1.5.1 First generation (1971–1973) 8 1.5.2 Second generation (1974–1978) 8 1.5.3 Third generation (1978–1980) 8 1.5.4 Fourth generation (1981–1995) 8 1.5.5 Fifth generation (1995–till date) Press 9 1.5.6 Timeline of microprocessor evolution 9 &ODVVL¿FDWLRQRI0LFURSURFHVVRUV 1.7 Types of Memory 11 1.8 Input and Output Devices 13 1.9 Technology Improvements Adapted to Microprocessors and Computers 14 1.10 Introduction to 8085 ProcessorUniversity 14 1.11 Architecture of 8085 16 1.11.1 Arithmetic and logic unit 16 1.11.2 General-purpose registers 17 1.11.3 Special-purpose registers 17 1.11.4 Instruction register and decoder 19 1.11.5 TimingOxford and control unit 19 1.12 Microprocessor Instructions 23 &ODVVL¿FDWLRQRI,QVWUXFWLRQV 1.13.1 Based on functionality 24 1.13.2 Based on length 26 1.13.3 Addressing modes in instructions 28 1.14 Instruction Set of 8085 30 1.14.1 Format of assembly language instructions and programs 31 1.14.2 Data transfer instructions 31 1.14.3 Arithmetic instructions 34 1.14.4 Logical instructions 36 1.14.5 Branching instructions 38 1.14.6 Machine control instructions 39 1.15 Sample Programs 40 1.16 Instruction Execution 42 © Oxford University Press. All rights reserved. xiv Detailed Contents 2. Methods of Data Transfer and Serial Transfer Protocols 47 2.1 Data Transfer Mechanisms 47 2.2 Memory-mapped and I/O-mapped Data Transfer 47 2.3 Programmed Data Transfer 48 2.4 Direct Memory Access 49 2.5 Parallel Data Transfer 50 2.6 Serial Data Transfer 50 2.6.1 Introduction to RS-232 standard 51 2.6.2 Introduction to RS-485 standard 54 2.6.3 GPIB/IEEE 488 standards 55 2.7 Interrupt Structure of a Microprocessor 57 2.8 Types of Interrupts 57 2.8.1 Vectored and non-vectored interrupts 57 2.8.2 Maskable and non-maskable interrupts 58 2.8.3 Software and hardware interrupts 58 2.9 Interrupt Handling Procedure 58 PART I: INTEL 8086—16-BIT MICROPROCESSORS 3. Intel 8086 Microprocessor Architecture, Features,Press and Signals 63 3.1 Introduction 63 3.2 Architecture of 8086 63 3.2.1 Execution unit 63 3.2.2 Bus interface unit 66 3.2.3 Minimum and maximum mode operations 67 3.3 Accessing Memory Locations 67 3.4 Pin Details of 8086 University 70 3.4.1 Function of pins common to minimum and maximum modes 70 3.4.2 Function of pins used in minimum mode 72 3.4.3 Function of pins used in maximum mode 73 3.5 Differences Between 8086 and 8088 74 4. Addressing Modes,Oxford Instruction Set, and Programming of 8086 80 4.1 Addressing Modes in 8086 80 4.1.1 Register Addressing Mode 80 4.1.2 Immediate Addressing Mode 80 4.1.3 Data Memory Addressing Modes 81 4.1.4 Program Memory Addressing Modes 83 4.1.5 Stack Memory Addressing Mode 85 6HJPHQW2YHUULGH3UH¿[ 4.3 Instruction Format of 8086 87 4.3.1 One-byte instruction 87 4.3.2 Register to register 87 4.3.3 Register to/from memory with no displacement 87 4.3.4 Register to/from memory with displacement 89 4.3.5 Immediate operand to register 89 4.3.6 Immediate operand to memory with 16-bit displacement 89 © Oxford University Press. All rights reserved. Detailed Contents xv 4.4 Instruction Set of 8086 91 4.4.1 Data transfer instructions 91 4.4.2 Arithmetic instructions 94 4.4.3 Logical instructions 102 4.4.4 Flag manipulation instructions 103 4.4.5 Control transfer instructions 103 4.4.6 Shift/rotate instructions 106 4.4.7 String instructions 109 4.4.8 Machine or processor control instructions 110 4.5 8086 Assembly Language Programming 110 4.5.1 Writing programs using line assembler 111 4.5.2 Writing time delay programs 127 4.5.3 8086 Assembler directives 129 4.5.4 Writing assembly language programs using MASM 138 4.6 Program Development Process 162 4.7 Modular Programming 164 4.7.1 CALL instruction 165 4.7.2 RET instruction 166 4.7.3 Macro 167 4.7.4 Illustrative example Press 168 5. 8086 Interrupts 175 5.1 Introduction 175 5.2 Interrupt Types in 8086 175 5.3 Processing of Interrupts by 8086 176 5.4 Dedicated Interrupt Types in 8086 178 5.4.1 Type 00H or divide-by-zero interrupt 178 5.4.2 Type 01H, single step,University or trap interrupt 178 5.4.3 Type 02H or NMI interrupt 178 5.4.4 Type 03H or one-byte INT interrupt 179 5.4.5 T\SH+RURYHUÀRZLQWHUUXSW 5.5 Software Interrupts—Types 00H–FFH 179 5.6 INTR Interrupts—TypesOxford 00H–FFH 180 5.7 Priority Among 8086 Interrupts 182 5.8 Interrupt Service Routines 182 5.9 BIOS Interrupts or Function Calls 189 5.9.1 INT 10H 189 5.9.2 INT 11H 191 5.9.3 INT 12H 192 5.9.4 INT 13H 192 5.9.5 INT 14H 192 5.9.6 INT 15H 192 5.9.7 INT 16H 192 5.9.8 INT 17H 192 5.10 Interrupt Handlers 194 5.11 DOS Services: INT 21H 195 5.12 System Calls—BIOS Services 198 5.12.1 Print screen service: INT 05H 199 © Oxford University Press. All rights reserved. xvi Detailed Contents 5.12.2 Video services: INT 10H 200 5.12.3 Keyboard services: INT 16H 202 5.12.4 Printer services: INT 17H 204 6. Memory and I/O Interfacing 210 6.1 Physical Memory Organization in 8086 210 6.2 Formation of System Bus 211 6.3 Interfacing RAM and EPROM Chips using Only Logic Gates 213 6.4 Interfacing RAM/EPROM Chips using Decoder IC and Logic Gates 217 6.5 I/O Interfacing 220 6.5.1 I/O instructions in 8086 220 6.5.2 I/O-mapped and memory-mapped I/O 220 6.6 Interfacing 8-bit Input Device with 8086 222 6.6.1 Assigning 8-bit address to 8-bit input device using address decoder having only logic gates 222 6.6.2 Assigning 8-bit address to 8-bit input device using address decoder IC 74LS138 222 6.6.3 Assigning 16-bit address to 8-bit DIP switch using address decoder having only logic gates Press 224 6.7 Interfacing 8-bit Output Device with 8086 224 6.8 Interfacing Printer with 8086 225 6.9 Interfacing 8-bit and 16-bit I/O Devices or Ports with 8086 229 6.10 Interfacing CRT Terminal with 8086 233 7.