1 of 37

Microprocessor and Microcontroller

(ECC-313)

DEPARTMENT OF INSTRUMENTATION AND CONTROLS ENGINEERING

Bharati Vidyapeeth’s College of Engineering

Paschim Vihar, New Delhi, Delhi, 110063

2 of 37

COURSE OUTLINE

  • UNIT I
  • Introduction to Microprocessor Systems: Architecture and PIN diagram of 8085, Timing Diagram, memory organization, addressing modes, interrupts. Assembly Language Programming.

  • UNIT II
  • 8086 Microprocessor: 8086 Architecture, difference between 8085 and 8086 architecture, generation of physical address, PIN diagram of 8086, Minimum Mode and Maximum mode, Bus cycle, Memory Organization, Memory Interfacing, Addressing Modes, Assembler Directives, Instruction set of 8086, Assembly Language Programming, Hardware and Software Interrupts.

  • UNIT III
  • Interfacing of 8086 with 8255, 8254/8253, 8251, 8259: Introduction, Generation of 1/0 Ports, Programmable Peripheral Interface (PPI)-Intel 8255, Sample-and-Hold Circuit and Multiplexer, Keyboard and Display Interface, Keyboard and Display Controller (8279), Programmable Interval timers (Intel 8253/8254), USART (8251), PIC(8259), DAC, ADC, LCD, Stepper Motor.

  • UNIT IV
  • Overview of Microcontroller 8051: Introduction to 8051 Micro-controller, Architecture, Memory organization, Special function registers, Port Operation, Memory Interfacing, 1/0 Interfacing, Programming 8051 resources, interrupts, Programmer's model of 8051, Operand types, Operand addressing, Data transfer instructions, Arithmetic instructions, Logic instructions, Control transfer instructions, Timer & Counter Programming, Interrupt Programming.

3 of 37

Microprocessor Vs Microcontroller

Microprocessor

Microcontroller

1. The functional blocks of a microprocessor are the ALU, registers, and timing and control unit.

1. The microcontroller includes the functional blocks of a microprocessor and in addition has a timer, a parallel IO port, a serial IO port, internal RAM and EPROM/EEPROM memory. Some controllers even have ADC and/or DAC.

2. A microprocessor is concerned with rapid movement of code and data between the external memory and the microprocessor. Hence it has a large number of instructions for moving data between the external memory and the microprocessor.

2. A microcontroller is concerned with rapid movement of code and data within the microcontroller. Hence it has few instructions for data transfer between the external memory and the microcontroller.

3. Microprocessors mostly operate on byte/word data and so have very few bit manipulating instructions.

3. Microcontrollers often manipulate with bits and so have a large number of bit manipulating instructions.

4. Microprocessors usually require interfacing of a large number of additional ICs to form a microcomputer-based system. Hence the PCB of a microprocessor-based system will be large and so the system will be costly.

4. Microcontrollers can be used to form a single chip microcomputer-based system without any additional ICs. Hence the PCB of a microcontroller-based system will be small and so the system will be cheap.

5. The microprocessors are used for designing general purpose digital computing system (or computers).

5. Microcontrollers are used for designing application specific dedicated systems.

4 of 37

Microprocessor

  • A microprocessor is a multipurpose, programmable, clock-driven, register-based electronic device that reads binary instructions from a storage device called memory, accepts binary data as input and processes data according to those instructions, and provides results as output.

A programmable Machine

  • A typical programmable machine can be represented with four components: micro-processor, memory, input, and output, as shown in Figure. These four components work together or interact with each other to perform a given task; thus, they comprise a system. The physical components of this system are called hardware. A set of instructions written for the microprocessor to perform a task is called a program, and a group of programs is called software.

5 of 37

Intel Series

Generation of Intel Microprocessor

6 of 37

Terminology

  • Bit : A digit of the binary number or code is called a bit.
  • Nibble : The 4-bit (4-digit) binary number or code is called a nibble.
  • Byte : The 8-bit (8-digit) binary number or code is called a byte.
  • Word : The 16-bit (16-digit) binary number or code is called a word.
  • Double Word : The 32-bit (32-digit) binary number or code is called a double word.
  • Multiple Word : The 64, 128, ... bit/digit binary numbers or codes are called multiple words.

  • An instruction is a binary pattern entered through an input device in memory to command the microprocessor to perform that specific function.

7 of 37

Microprocessor

  • A microprocessor is a multipurpose, programmable, clock-driven, register-based electronic device that reads binary instructions from a storage device called memory, accepts binary data as input and processes data according to those instructions, and provides results as output.

A programmable Machine

  • A typical programmable machine can be represented with four components: micro-processor, memory, input, and output, as shown in Figure. These four components work together or interact with each other to perform a given task; thus, they comprise a system. The physical components of this system are called hardware. A set of instructions written for the microprocessor to perform a task is called a program, and a group of programs is called software.

8 of 37

Organisation of Microprocessor

  • Arithmetic/Logic Unit This is the area of the microprocessor where various computing functions are performed on data. The ALU unit performs such arithmetic operations as addition and subtraction, and such logic operations as AND, OR, and exclusive OR.
  • Register Array This area of the microprocessor consists of various registers identified by letters such as B, C, D, E, H, and L. These registers are primarily used to store data temporarily during the execution of a program and are accessible to the user through instructions.
  • Control Unit The control unit provides the necessary timing and control signals to all the operations in the microcomputer. It controls the flow of data between the microprocessor and memory and peripherals.

9 of 37

Organisation of Microprocessor

  • Memory stores such binary information as instructions and data, and provides that information to the microprocessor whenever necessary. To execute programs, the microprocessor reads instructions and data from memory and performs the computing operations in its ALU section. Results are either transferred to the output section for display or stored in memory for later use. The memory block shown in Figure has two sections: Read-Only memory (ROM) and Read/Write memory (R/WM), popularly known as Random-Access memory (RAM).
  • The Read/Write memory (R/WM) is also known as user memory. It is used to store user programs and data. In single-board microcomputers, the monitor program monitors the Hex keys and stores those instructions and data in the R/W memory. The information stored in this memory can be easily read and altered.
  • The ROM is used to store programs that do not need alterations. The monitor program of a single-board microcomputer is generally stored in the ROM. This program interprets the information entered through a keyboard and provides equivalent binary digits to the microprocessor. Programs stored in the ROM can only be read; they cannot be altered.

10 of 37

Organisation of Microprocessor

  • I/O (INPUT/OUTPUT): The third component of a microprocessor-based system is I/O (input/output); it communicates with the outside world. I/O includes two types of devices: input and output; these I/O devices are also known as peripherals.
  • The input devices such as a keyboard, switches, and an analog-to-digital (A/D) converter transfer binary information (data and instructions) from the outside world to the microprocessor. Typically, a microcomputer used in college laboratories includes either a hexadecimal keyboard or an ASCII keyboard as an input device.
  • The output devices transfer data from the microprocessor to the outside world. They include devices such as light emitting diodes (LEDs), a cathode-ray tube (CRT) or video screen, a printer, X-Y plotter, a magnetic tape, and digital-to-analog (D/A) converter.

11 of 37

Organisation of Microprocessor

  • SYSTEM BUS The system bus is a communication path between the microprocessor and peripherals; it is nothing but a group of wires to carry bits. In fact, there are several buses in the system.
  • All peripherals (and memory) share the same bus; however, the microprocessor communicates with only one peripheral at a time. The timing is provided by the control unit of the microprocessor.

12 of 37

Microprocessor Working

  • The sequence of the process is read, interpret, and perform.
  • The instructions are stored sequentially in the memory.
  • The microprocessor fetches the first instruction from its memory sheet, decodes it, and executes that instruction.
  • The sequence of fetch, decode, and execute is continued until the microprocessor comes across an instruction to stop.
  • During the entire process, the microprocessor uses the system bus to fetch the binary instructions and data from the memory.
  • It uses registers from the register section to store data temporarily, and it performs the computing function in the ALU section. Finally, it sends out the result in binary, using the same bus lines.

13 of 37

Writing and Executing an Assembly Language Program

  • A program is a set of logically related instructions written in a specific sequence to accomplish a task. To manually write and execute an assembly language program on a single-board computer, with a Hex keyboard for input and LEDs for output, the following steps are necessary:
  • Write the instructions in mnemonics obtained from the instruction set supplied by the manufacturer.
  • 2. Find the hexadecimal machine code for each instruction by searching through the set of instructions.
  • 3. Enter (load) the program in the user memory in a sequential order by using the Hex keyboard as the input device.
  • 4. Execute the program by pressing the Execute key. The answer will be displayed by the LEDS.

14 of 37

8085

  • Generally, the 8085 is an 8 bit microprocessor, and it was launched by Intel team in the year of 1976 with the help of NMOS technology.

  • It has the following configuration
    • 8 bit data bus
    • 16 bit address bus, which can address upto 64KB
    • A 16 bit program counter
    • A 16 bit stack pointer
    • Six 8 bit registers arranged in pairs: BC, DE, HL
    • Requires +5V supply to operate at 3.2 MHZ single phase clock
    • It is an NMOS device having around 6200 transistors contained in a 40 pin DIP package.

    • The signals of 8085 can be classified into seven groups according to their functions. These are:
    • Power supply and frequency signals
    • Data and Address buses
    • Control bus
    • Interrupt signals
    • Serial I/O signals
    • DMA signals
    • Reset signals.

15 of 37

Pin Diagram of 8085

Functional pin diagram

8085 SIGNAL DESCRIPTION SUMMARY

16 of 37

Pin Diagram of 8085

Functional pin diagram

 

17 of 37

Pin Diagram of 8085

Functional pin diagram

 

18 of 37

Pin Diagram of 8085

Functional pin diagram

8085 Machine Cycle Status and Control Signal

19 of 37

Pin Diagram of 8085

Functional pin diagram

 

20 of 37

Pin Diagram of 8085

Functional pin diagram

 

21 of 37

Pin Diagram of 8085

Ashutosh

Assistant Professor

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

Functional pin diagram

22 of 37

Pin Diagram of 8085

Functional pin diagram

SERIAL I/O PORTS: The 8085 has two signals to implement the serial transmission: SID (Serial Input Data) and SOD (Serial Output Data). In serial transmission, data bits are sent over a single line, one bit at a time, such as the transmission over telephone lines.

23 of 37

8085 Bus Structure

24 of 37

8085 Bus Structure: Address Bus

 

25 of 37

8085 Bus Structure: Data Bus

Ashutosh

Assistant Professor

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

 

26 of 37

8085 Bus Structure: Control Bus

  • The control bus is comprised of various single lines that carry synchronization signals.
  • The MPU uses such lines to perform the third function: providing timing signals.
  • The term bus, in relation to the control signals, is somewhat confusing.
  • These are not groups of lines like address or data buses, but individual lines that provide a pulse to indicate an MPU operation.
  • The MPU generates specific control signals for every operation (such as Memory Read or I/O Write) it performs.
  • These signals are used to identify a device type with which the MPU intends to communicate.

27 of 37

Architecture

Architecture of 8085

The various functional blocks of 8085 are as follows:

  • Registers
  • Arithmetic logic unit
  • Address buffer
  • Incrementer/decrementer address latch
  • Interrupt control
  • Serial I/O control
  • Timing and control circuitry
  • Instructions decoder and machine cycle encoder.

28 of 37

List of Various Registers in 8085

29 of 37

Architecture: The ALU

  • The arithmetic/logic unit performs the computing functions; it includes the accumulator, the temporary register, the arithmetic and logic circuits, and five flags.
  • The temporary register is used to hold data during an arithmetic/logic operation. The result is stored in the accumulator, and the flags (flip-flops) are set or reset according to the result of the operation.

30 of 37

Architecture: Registers

  • The 8085 has six general-purpose registers to store 8-bit data; these are identified as B, C, D, E, H, and L, as shown in Figure.
  • They can be combined as register pairs— BC, DE, and HL to perform some 16-bit operations.
  • The programmer can use these registers to store or copy data into the registers by using data copy instructions.

31 of 37

Architecture: Accumulator

  • The accumulator is an 8-bit register that is part of the arithmetic/logic unit (ALU).
  • This register is used to store 8-bit data and to perform arithmetic and logical operations.
  • The result of an operation is stored in the accumulator.
  • The accumulator is also identified as register A.

32 of 37

Architecture: Program Counter (PC) And Stack Pointer (SP)

  • These are two 16-bit registers used to hold memory addresses. The size of these registers is 16 bits because the memory addresses are 16 bits.
  • The microprocessor uses the PC register to sequence the execution of the instructions. The function of the program counter is to point to the memory address from which the next byte is to be fetched. When a byte (machine code) is being fetched, the program counter is incremented by one to point to the next memory location.
  • The stack pointer is also a 16-bit register used as a memory pointer. It points to a memory location in R/W memory, called the stack. The beginning of the stack is defined by loading a 16-bit address in the stack pointer.

33 of 37

Architecture: Timing And Control Unit

  •  

Ashutosh

Assistant Professor

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

34 of 37

Architecture: Instruction Register And Decoder

  • The instruction register and the decoder are part of the ALU. When an instruction is fetched from memory, it is loaded in the instruction register.
  • The decoder decodes the instruction and establishes the sequence of events to follow. The instruction register is not programmable and cannot be accessed through any instruction.

35 of 37

Architecture: Status Flag Register

Ashutosh

Assistant Professor

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

The flag register format

The following flags are set or reset after the execution of an arithmetic or logic operation; data copy instructions do not affect any flags.

  • Z- Zero: The Zero flag is set to 1 when the result is zero; otherwise it is reset.
  • CY- Carry: If an arithmetic operation results in a carry, the CY flag is set; otherwise it is reset.
  • S- Sign: The Sign flag is set if bit D, of the result = 1; otherwise it is reset.
  • P- Parity: If the result has an even number of 1s, the flag is set; for an odd number of 1s, the flag is reset.
  • AC- Auxiliary Carry: In an arithmetic operation, when a carry is generated by digit D3 and passed to digit D4, the AC flag is set. This flag is used internally for BCD (binary-coded decimal) operations; there is no Jump instruction associated with this flag.

36 of 37

Communication and Bus Timings

  •  

A. Data Flow from memory to MPU

B. Timing: Transfer of Byte from Memory to MPU

The process of communication (reading from and writing into memory) between the microprocessor and memory and the timings of these signals in relation to the system clock is examined.

37 of 37