CONTENTS CHAPTER - 1 INTRODUCTION TO MICROPROCESSORS ....................................... 1 1.1 Terms used in microprocessor literature ..................................................... 1 1.2 Evolution of microprocessor........................................................................ 3 1.3 Basic functional blocks of a microprocesor....................................................... 7 1.4 Microprocessor based system... ................................................................. (Organisation of microcomputer) 8 1.5 Concept of multiplexing in microprocessor. ................................................ 9 1.6 INTEL 8085............................ ..................................................................... 11 1. 7 ZILOG Z80........................................................................................................... 18 1.8 MOTOROLA 6800 ...................................................................................... 22 1.9 INTEL 8086................................................................................................. 27 1.10 MOTOROLA MC68000 ............................................................................... 1.10.1 Pins and signals of 68000 ................................................................ 1.10.2 Architecture of MC68000 microprocessor ........................................ 37 38 42 1.11 Short questions and answers ...................................................................... 45 CHAPTER - 2 INTRODUCTION TO MICROCONTROLLERS ....................................... 53 . 2.1 Microprocessors and microcontrollers ........................................................ 53 2.2 INTEL 8031/8051 microcontroller ............................................................... 2.2.1 Pins and signals of 8031/8051 .......................................................... 2.2.2 Architecture of 8031/8051 ................................................................. 2.2.3 Programming model of 8031/8051 ..................................................... 55 55 60 63 2.3 INTEL 8096 microcontroller ........................................................................ 2.3.1 Pins and signals of 8096 ................................................................... 2.3.2 Architecture of 8096 microcontroller .................................................. 2.3.3 Special function registers (SFRs) of 8096.......................................... 73 73 78 87 2.4 Short questions and answers...................................................................... 94 CHAPTER - 3 INSTRUCTION SET OF 8085 .................................................................. 97 3.1 Processor cycles......................................................................................... 97 3.2 Machine cycles of 8085 .............................................................................. 97 3.3 Instruction format of 8085 ........................................................................... 111 3.4 Addressing modes ...................................................................................... 111 3.5 Instruction set ............................................................................................. 112 3.6 Data transfer instructions ............................................................................ 121 3.7 Arithmetic instructions ................................................................................ 133 3.8 Logical instructions ..................................................................................... 143 3.9 Branching instructions ................................................................................ 3.10 Machine control instructions 152 156 3.11 Timing diagram of 8085 instructions ........................................................... 159 3.12 Short questions and answers...................................................................... 167 CHAPTER - 4 INSTRUCTION SET OF 8086. ............................................................... 173 4.1 Bus cycles and timing diagram. .................................................................. 173 4.2 Classification of 8086 instructions............................................................... 181 4.3 Format of 8086 instructions ........................................................................ 182 4.4 Addressing modes of 8086 ......................................................................... 188 4.5 Instruction execution time ........................................................................... 194 4.6 Instructions affecting flags .......................................................................... 212 4.7 Data transfer instructions. ........................................................................... 214 4.8 Arithmetic instructions ................................................................................. 219 4.9 Logical instructions ..................................................................................... 229 4.10 String manipulation instructions .................................................................. 237 4.11 Control transfer instructions ....................................................................... 241 4.11.1 CALL and RET instructions............................................................. 242 4.11.2 Unconditional jump instructions ...................................................... 245 4.11.3 Conditional jump instructions .......................................................... 246 4.11.4 Loop instructions. ............................................................................ 248 4.12 Processor control instructions ..................................................................... 251 4.13 Examples of 8086 instructions .................................................................... 253 4.14 Short questions and answers...................................................................... 262 CHAPTER - 5 INSTRUCTION SET OF MC68000 ......................................................... 267 5.1 Bus cycles and timing diagram ................................................................... 267 5.2 Format of 68000 instruction ........................................................................ 270 5.3 Addressing modes of 68000 instructions .................................................... 271 5.4 Instructions of MC68000 processor ............................................................ 277 5.5 Short questions and answers...................................................................... 296 CHAPTER - 6 INSTRUCTION SET OF 8031/8051 ........................................................ 299 6.1 Machine cycles and timing diagram ............................................................ 299 6.2 Addressing modes ...................................................................................... 307 6.3 Classification of 8031/8051 instructions ...................................................... 308 6.4 Data transfer instructions ............................................................................ 315 6.5 Arithmetic instructions ................................................................................. 318 6.6 Logical instructions. .................................................................................... 321 6.7 Program branching instructions .................................................................. 324 6.8 6.9 Boolean variable instructions ...................................................................... Short questions and answers 328 330 CHAPTER - 7 MEMORY AND I/O INTERFACING ........................................................ 333 7.1 Introduction to memory ............................................................................... 333 7.2 Semiconductor memory .............................................................................. 333 7.3 ROM and PROM......................................................................................... 335 7.4 EPROM ...................................................................................................... 336 7.5 Static RAM .................................................................................................. 340 7.6 DRAM and NVRAM .................................................................................... 345 7.7 Interfacing static RAM and EPROM............................................................ 346 7.8 Even and odd memory banks in 16-bit microprocessors ............................ 350 7.8.1 Even and odd memory banks in 8086 based system ....................... 7.8.2 Even and odd memory banks in 68000 based system ..................... 350 353 Memory organisation in microprocessor system ......................................... 353 7.9.1 Memory organisation in 8085 based system ..................................... 355 7.9.2 Memory organisation in 8086 based system ..................................... 358 7.9.3 Memory organisation in 68000 based system ................................... 363 7.9.4 Memory organisation in 8031/8051 based system ............................ 364 7.10 I/O structure of a typical microcomputer ..................................................... 365 7.11 Interfacing I/O and peripheral devices ........................................................ 366 7.12 Memory and I/O interface examples ........................................................... 372 7.12.1 Examples of memory and I/O interface in 8085 based system ........ 372 7.12.2 Examples of memory and I/O interface in 8086 based system ........ 386 7.12.3 Examples of memory and I/O interface in 68000 based system ...... 392 7.9 7.12.4 Examples of memory and I/O interface in 8031/8051 based system …….397 7.13 Short questions and answers...................................................................... 401 CHAPTER-8 INTERRUPTS ............................................................................................ 407 8.1 Interrupt and its need .................................................................................. 407 8.2 Classification of interrupts ........................................................................... 408 8.3 Interrupts of 8085........................................................................................ 8.3.1 Software interrupts of 8085 ............................................................... 8.3.2 Hardware interrupts of 8085 ............................................................. 8.3.3 Priorities of interrupts of 8085 ........................................................... 8.3.4 Enabling, disabling and masking of 8085 interrupts .......................... 8.3.5 INTR and its expansion in 8085 ........................................................ 409 409 410 411 411 414 8.4 Interrupts of 8086........................................................................................ 416 8.4.1 INTEL predefined (or dedicated) interrupts ....................................... 416 8.4.2 Software interrupts of 8086 ............................................................... 418 8.4.3 Hardware interrupts of 8086 ............................................................. 418 8.4.4 Priorities of interrupts of 8086 ........................................................... 419 8.4.5 Implementing interrupt scheme in 8086 ............................................ 8.4.6 INTR and its expansion in 8086 419 422 Programmable interrupt controller-INTEL 8259 .......................................... 423 8.5.1 Interfacing 8259 with 8085 microprocessor ...................................... 424 8.5.2 Interfacing 8259 with 8086 microprocessor ...................................... 426 8.5.3 Functional block diagram of 8259 ..................................................... 427 8.5.4 Processing of interrupts by 8259 ...................................................... 430 8.5.5 Programming (or initializing) 8259 .................................................... Short questions and answers ...................................................................... 432 437 CHAPTER-9 ASSEMBLY LANGUAGE PROGRAMMING ............................................ 445 8.5 8.6 9.1 Levels of programming ............................................................................... 445 9.2 Flowchart .................................................................................................... 446 9.3 Assembly language program development tools ........................................ 448 9.4 Variables and constants used in assemblers ............................................. 453 9.5 Assembler directives ................................................................................... 454 9.6 Procedures and macros .............................................................................. 461 9.7 Delay routine .............................................................................................. 463 9.8 Stack .......................................................................................................... 467 9.9 Interrupts of personal computers ................................................................ 469 9.10 Hand coding of assembly language programs in 8086 ............................... 477 9.11 Examples of 8085 assembly language programs ....................................... 481 9.12 Examples of 8031 assembly language programs ....................................... 535 9.13 Examples of 8086 assembly language programs ....................................... 546 9.14 Short questions and answers ...................................................................... 650 CHAPTER-10 PERIPHERAL DEVICES AND INTERFACING ..................................... 655 10.1 Programmable peripheral devices .............................................................. 655 10.2 Parallel data communication interface ........................................................ 10.2.1 Parallel data transfer schemes ........................................................ 10.2.2 INTEL 8212 ..................................................................................... 10.2.3 Programmable I/O port and Timer-INTEL 8155/8156 ..................... 10.2.4 Programmable peripheral interface -INTEL 8255 ............................ 10.2.5 Programmable I/O port and memory-INTEL 8355 ........................... 10.2.6 Programmable I/O port and memory-INTEL 8755 ........................... 10.2.7 DMA data transfer scheme ............................................................. 10.2.8 DMA controller - INTEL 8237 ........................................................... 10.2.9 DMA controller - INTEL 8257 ........................................................... 10.3 Serial data communication interface ........................................................... 10.3.1 Serial data communication 655 656 659 660 667 677 678 680 682 698 707 707 10.3.2 USART-INTEL 8251A ...................................................................... 712 10.3.3 Serial communication in 8051 microcontroller ................................ 718 10.4 Keyboard and display interface ................................................................... 10.4.1 Keyboard interface using ports ........................................................ 10.4.2 Display interface using ports ............................................................ 10.4.3 Latches and Buffers as I/O devices ................................................. 10.4.4 Keyboard / Display controller -INTEL 8279 ...................................... 10.4.5 Keyboard and Display interface using 8279..................................... 719 719 722 727 729 733 10.5 Programmable Timer-INTEL 8254 .............................................................. 739 10.5.1 Operating modes of 8254 ................................................................ 746 DAC interface............................................................................................. 753 10.6.1 DAC 0800 ........................................................................................ 755 10.7 ADC interface.............................................................................................. 760 10.7.1 ADC 0809 ........................................................................................ 762 10.8 Short questions and answers ....................................................................... 770 10.6 CHAPTER-11 INTEL 80x86 FAMILY OF PROCESSORS .......................................... 775 11.1 Introduction ................................................................................................ 775 11.2 INTEL 80186 .............................................................................................. 777 11.2.1 Pins and signals of 80186 ................................................................ 777 11.2.2 Architecture of 80186 ....................................................................... 782 11.3 INTEL 80286 .............................................................................................. 786 11.3.1 Pins and signals of 80286 ................................................................ 786 11.3.2 Architecture of 80286 ....................................................................... 789 11.3.3 Real address mode of 80286 ........................................................... 792 11.3.4 Protected virtual address mode of 80286 ........................................ 793 11.4 INTEL 80386 microprocessor ..................................................................... 797 11.4.1 Pins and signals of 80386 ................................................................ 800 11.4.2 Architecture of 80386 microprocessor ............................................. 802 11.4.3 Registers of 80386 microprocessor ................................................. 804 11.4.4 Operating modes of 80386 microprocessor ..................................... 809 11.5 INTEL 80486 microprocessor ..................................................................... 813 11.5.1 Pins and signals of 80486 ................................................................ 813 11.5.2 Architecture of 80486 ....................................................................... 817 11.6 Pentium microprocessor ............................................................................ 820 11.6.1 Pins and signals of Pentium microprocessor ................................... 821 11.6.2 Architecture of Pentium microprocessor .......................................... 827 11.7 Advanced Pentium processors ................................................................... 11.7.1 Pentium Pro ..................................................................................... 11.7.2 Pentium II......................................................................................... 11.7.3 Pentium III........................................................................................ 11.7.4 Pentium 4......................................................................................... 830 831 831 831 832 CHAPTER-12 SYSTEM DESIGN WITH MICROPROCESSORS ................................ 833 12.1 Designing a microprocessor based system................................................ 12.2 INTEL 8085 microprocessor based systems 833 836 12.2.1 8085 based minimum system ......................................................... 836 12.2.2 Temperature control system ........................................................... 836 12.2.3 Motor speed control system ............................................................ 840 12.2.4 Traffic light control system .............................................................. 843 12.2.5 Stepper motor control system ......................................................... 847 12.3 Support chips needed for 8086 based system ............................................ 849 12.3.1 Clock generator-INTEL 8284A ........................................................ 849 12.3.2 Bus controller-INTEL 8288.............................................................. 852 12.3.3 Coprocessor-INTEL 8087 ............................................................... 853 INTEL 8086 based system ......................................................................... 857 12.4.1 Minimum mode 8086 based system ............................................... 857 12.4.2 Maximum mode 8086 based system .............................................. 858 12.4.3 Multiprocessor configurations ....................................................... 860 I List of microprocessors released by INTEL .................................... 863 APPENDIX II 8031/ 8051 instructions in hexadecimal order ................................. 865 APPENDIX III 8031/ 8051 instructions in alpahbetical order................................... 867 APPENDIX IV 8085 instructions in hexadecimal order .......................................... 869 APPENDIX V 871 12.4 APPENDIX 8085 instructions in alphabetical order ........................................... APPENDIX VI Templates for 8086 instructions ....................................................... 873 APPENDIX VII DOS and BIOS interrupts .................................................................. 883 GENERAL INDEX............................................................................................................ 887 CHIP INDEX..................................................................................................................... 895