Module1 8086 Microprocessor and Peripherals part2 .

Signal Description of 8086 Microprocessor

The 8086 Microprocessor is a 16-bit CPU available in 3 clock rates, i.e. 5, 8 and 10MHz, packaged in a 40 pin CERDIP or plastic package. The 8086 Microprocessor operates in single processor or multiprocessor configurations to achieve high performance. The pin configuration is as shown in fig1. Some of the pins serve a particular function in minimum mode (single processor mode) and others function in maximum mode (multiprocessor mode) configuration.

Maximum mode

clip_image002

The 8086 signals can be categorized in three groups. The first are the signals having common functions in minimum as well as maximum mode, the second are the signals which have special functions in minimum mode and third are the signals having special functions for maximum mode

The following signal description are common for both the minimum and maximum modes.

clip_image003AD15-AD0: These are the time multiplexed memory I/O address and data lines. Address remains on the lines during T1 state, while the data is available on the data bus during T2, T3, TW and T4. Here T1, T2, T3, T4 and TW are the clock states of a machine cycle. TW is a wait state. These lines are active high and float to a tristate during interrupt acknowledge and local bus hold acknowledge cycles.

A19/S6, A18/S5, A17/S4, A16/S3: These are the time multiplexed address and status lines. During T1, these are the most significant address lines or memory operations. During I/O operations, these lines are low. During memory or I/O operations, status information is available on those lines for T2, T3, TW and T4 .The status of the interrupt enable flag bit(displayed on S5) is updated at the beginning of each clock cycle. The S4 and S3 combinedly indicate which segment register is presently being used for memory accesses as shown in Table 1.1.

These lines float to tri-state off (tristated) during the local bus hold acknowledge. The status line S6 is always low(logical). The address bits are separated from the status bits using latches controlled by the ALE signal.

image

BHE/S7Bus High Enable/Status: The bus high enable signal is used to indicate the transfer of data over the higher order (D15-D8) data bus as shown in Table 1.2. It goes low for the data transfers over D15-D8 and is used to derive chip selects of odd address memory bank or peripherals. BHE is low during T1 for read, write and interrupt acknowledge cycles, when- ever a byte is to be transferred on the higher byte of the data bus. The status information is available during T2, T3 and T4. The signal is active low and is tristated during ‘hold’. It is low during T1 for the first pulse of the interrupt acknowledge cycle.

image

clip_image006RD-Read: Read signal, when low, indicates the peripherals that the processor is performing a memory or I/O read operation. RD is active low and shows the state for T2, T3, TW of any read cycle. The signal remains tristated during the ‘hold acknowledge’.

READY: This is the acknowledgement from the slow devices or memory that they have completed the data transfer. The signal made available by the devices is synchronized by the 8284A clock generator to provide ready input to the 8086. The signal is active high.

INTR-lnterrupt Request: This is a level triggered input. This is sampled during the last clock cycle of each instruction to determine the availability of the request. If any interrupt request is pending, the processor enters the interrupt acknowledge cycle. This can be internally masked by resetting the interrupt enable flag. This signal is active high and internally synchronized.

TEST: This input is examined by a ‘WAIT’ instruction. If the TEST input goes low, execution will continue, else, the processor remains in an idle state. The input is synchronized internally during each clock cycle on leading edge of clock.

NMI-Non-maskable Interrupt: This is an edge-triggered input which causes a Type2 interrrupt. The NMI is not maskable internally by software. A transition from low to high initiates the interrupt response at the end of the current instruction. This input is internally synchronized.

RESET: This input causes the processor to terminate the current activity and start execution from FFFF0H. The signal is active high and must be active for at least four clock cycles. It restarts execution when the RESET returns low. RESET is also internally synchronized.

CLK-Clock Input: The clock input provides the basic timing for processor operation and bus control activity. Its an asymmetric square wave with 33% duty cycle. The range of frequency for different 8086 versions is from 5MHz to 10MHz.

VCC : +5V power supply for the operation of the internal circuit. GND ground for the internal circuit.

MN/MX :The logic level at this pin decides whether the processor is to operate in either minimum (single processor) or maximum (multiprocessor) mode.

The following pin functions are for the minimum mode operation of 8086.

M/IO -Memory/IO: This is a status line logically equivalent to S2 in maximum mode. When it is low, it indicates the CPU is having an I/O operation, and when it is high, it indicates that the CPU is having a memory operation. This line becomes active in the

previous T4 and remains active till final T4 of the current cycle. It is tristated during local bus "hold acknowledge".

INTA -Interrupt Acknowledge: This signal is used as a read strobe for interrupt acknowledge cycles. In other words, when it goes low, it means that the processor has accepted the interrupt. It is active low during T2, T3 and TW of each interrupt acknowledge cycle.

ALE-Address latch Enable: This output signal indicates the availability of the valid address on the address/data lines, and is connected to latch enable input of latches. This signal is active high and is never tristated.

DT /R -Data Transmit/Receive: This output is used to decide the direction of data flow through the transreceivers (bidirectional buffers). When the processor sends out data, this signal is high and when the processor is receiving data, this signal is low. Logically, this is equivalent to S1 in maximum mode. Its timing is the same as M/I/O. This is tristated during ‘hold acknowledge’.

DEN-Data Enable This signal indicates the availability of valid data over the address/data lines. It is used to enable the transreceivers (bidirectional buffers) to separate the data from the multiplexed address/data signal. It is active from the middle ofT2 until the middle of T4 DEN is tristated during ‘hold acknowledge’ cycle.

HOLD, HLDA-Hold/Hold Acknowledge: When the HOLD line goes high, it indicates to the processor that another master is requesting the bus access. The processor, after receiving the HOLD request, issues the hold acknowledge signal on HLDA pin, in the middle of the next clock cycle after completing the current bus (instruction) cycle. At the same time, the processor floats the local bus and control lines. When the processor detects the HOLD line low, it lowers the HLDA signal. HOLD is an asynchronous input, and it should be externally synchronized.

If the DMA request is made while the CPU is performing a memory or I/O cycle, it will release the local bus during T 4 provided:

1. The request occurs on or before T 2 state of the current cycle.

2. The current cycle is not operating over the lower byte of a word (or operating on an odd address).

3. The current cycle is not the first acknowledge of an interrupt acknowledge sequence.

4. A Lock instruction is not being executed.

So far we have presented the pin descriptions of 8086 in minimum mode.

The following pin functions are applicable for maximum mode operation of 8086.

S2, S1, S0 Status Lines: These are the status lines which reflect the type of operation, being carried out by the processor. These become active during T4 of the previous cycle

and remain active during T1 and T2 of the current bus cycle. The status lines return to passive state during T3 of the current bus cycle so that they may again become active for the next bus cycle during T4. Any change in these lines during T3 indicates the starting of a new cycle, and return to passive state indicates end of the bus cycle. These status lines are encoded in table 1.3.

image

LOCK: This output pin indicates that other system bus masters will be prevented from gaining the system bus, while the LOCK signal is low. The LOCK signal is activated by the ‘LOCK’ prefix instruction and remains active until the completion of the next instruction. This floats to tri-state off during "hold acknowledge". When the CPU is executing a critical instruction which requires the system bus, the LOCK prefix instruction ensures that other processors connected in the system will not gain the control of the bus. The 8086, while executing the prefixed instruction, asserts the bus lock signal output, which may be connected to an external bus controller.

QS1, QS0Queue Status: These lines give information about the status of the code- prefetch queue. These are active during the CLK cycle after which the queue operation is performed. These are encoded as shown in Table 1.4.

image

This modification in a simple fetch and execute architecture of a conventional microprocessor offers an added advantage of pipelined processing of the instructions. The 8086 architecture has a 6-byte instruction prefetch queue. Thus even the largest (6- bytes) instruction can be prefetched from the memory and stored in the prefetch queue. This results in a faster execution of the instructions. In 8085, an instruction (opcode and operand) is fetched, decoded and executed and only after the execution of this instruction, the next one is fetched. By prefetching the instruction, there is a considerable speeding up in instruction execution in 8086. This scheme is known as instruction pipelining. At the starting the CS:IP is loaded with the required address from which the execution is to be started. Initially, the queue will be empty and the microprocessor starts a fetch operation to bring one byte (the first byte) of instruction code, if the CS:IP address is odd or two bytes at a time, if the CS:IP address is even. The first byte is a complete opcode in case of some instructions (one byte opcode instruction) and it is a part of opcode, in case of other instructions (two byte long opcode instructions), the remaining part of opcode may lie in the second byte. But invariably the first byte of an instruction is an opcode. These opcodes along with data are fetched and arranged in the queue. When the first byte from the queue goes for decoding and interpretation, one byte in the queue becomes empty and subsequently the queue is updated. The microprocessor does not perform the next fetch operation till at least two bytes of the instruction queue are emptied. The instruction execution cycle is never broken for fetch operation. After decoding the first byte, the decoding circuit decides whether the instruction is of single opcode byte or double opcode byte. If it is single opcode byte, the next bytes are treated as data bytes depending upon the decoded instruction length, other wise, the next byte in the queue is treated as the second byte of the instruction opcode. The second byte is then decoded in continuation with the first byte to decide the instruction length and the number of subsequent bytes to be treated as instruction data. The queue is updated after every byte is read from the queue but the fetch cycle is initiated by BIU only if at least, two bytes of the queue are empty and the EU may be concurrently executing the fetched instructions.

The next byte after the instruction is completed is again the first opcode byte of the next instruction. A similar procedure is repeated till the complete execution of the program. The main point to be noted here is, that the fetch operation of the next instruction is overlapped with the execution of the current instruction. As shown in the architecture, there are two separate units, namely, execution unit and bus interface unit. While the execution unit is busy in executing an instruction, after it is completely decoded, the bus interface unit may be fetching the bytes o( the next instruction from memory, depending upon the queue status. Figure 1.6 explains the queue operation.

RQ/GT0, RQ/GT1-ReQuest/Grant: These pins are used by other local bus masters, in maximum mode, to force the processor to release the local bus at the end of the processor’s current bus cycle. Each of the pins is bidirectional with RQ/GT0 having higher priority than RQ/ GT1, RQ/GT pins have internal pull-up resistors and may be left unconnected. The request! grant sequence is as follows:

1. A pulse one clock wide from another bus master requests the bus access to 8086.

2. During T4 (current) or T1 (next) clock cycle, a pulse one clock wide from 8086 to the requesting master, indicates that the 8086 has allowed the local bus to float and that it will enter the "hold acknowledge" state at next clock cycle. The CPU’s bus interface unit is likely to be disconnected from the local bus of the system.

3. A one clock wide pulse from the another master indicates to 8086 that the ‘hold’ request is about to end and the 8086 may regain control of the local bus at the next clock cycle.

Thus each master to master exchange of the local bus is a sequence of 3 pulses. There must be at least one dead clock cycle after each bus exchange. The request and grant pulses are active low. For the bus requests those are received while 8086 is performing memory or I/O cycle, the granting of the bus is governed by the rules as discussed i~ case of HOLD, and HLDA in minimum mode.

Until now, we have described the architecture and pin configuration of 8086. In the next section, we will study some operational features of 8086 based systems.

8284A Clock Generator

The 8284A is an ancillary component to the 8086/8088 microprocessor. Without

the clock generator, many additional circuits to generate the clock (CLK in an 8086/8088 based system. The clock Generator 8284A provides the following basic functions or signals: clock generation, RESEST synchronization, READY synchronization, and a TTL level peripheral clock signal.

image

Pin Functions: The 8284A is an 18-pin integrated circuit designed specifically for use with the 8086/8088 microprocessors as shown in fig1. The following is a list of each pin and its function.

AEN1* and AEN2*: The address enable pins are provided to qualify the ready signals. RDY1 and RDY2, respectively. Which are used to cause wait states, along with the RDY1 and RDY2 inputs. Wait states are generated by the READY pin of the 8086/8088 microprocessor. This is controlled by these two inputs.

RDY1 and RDY2: The bus ready inputs are provided in conjunction with the AEN1* and AEN2* pins to cause wait states in an 8086/8088 microprocessor based system.

ASYNC*: The ready synchronization selection input selects either one or two stages of synchronization for the RDY1 and RDY2 inputs.

READY: Ready is an output pin that connects to the 8086/8088 microprocessor READY input. This signal is synchronized with the RDY1 and RDY2 inputs.

X1 and X2: The Crystal Oscillator pins connect to an external crystal used as the timing source for the clock generator and all its functions.

F/C*: The Frequency/Crystal select input results the clocking source for the 8284A. If this pin is held high, an external clock is provided to the EFI input pin, and if it is held low, the internal crystal oscillator provides the timing signal.

EFI: The External Frequency input is used when the F/C is pulled high. EFI supplies the timing whenever the F/C* pin is high.

CLK: The clock output pin provides CLK input signal to the 8086/8088 microprocessors and other components in the system. The CLK pin has an output signal that is one-third of the crystal or EFI input frequency and has a 33 percent duty cycle, which is required by the 8086/8088 microprocessors.

PCLK: The Peripheral Clock signal is one-sixth the crystal or EFI input frequency and has a 50 percent duty cycle. The PCLK output provides a clock signal to the peripheral equipment in the system.

OSC: The Oscillator output is a TTL level signal that is at the same frequency as the crystal or EFI input. (The OSC output provides and EFI input to other 8284A clock generators in some multiple processor systems).

RES*: The reset input is an active-low input to the 8284A. The RES* pin is often connected an RC network that provides power-on resetting.

RESET: The Reset output is connected to the 8086/8088 microprocessors RESET input pin.

CSYNC: The clock synchronization pin is used whenever the EFI input provides synchronization in systems with multiple processors. When the internal crystal oscillator is used, this pin must be grounded.

GND: The ground pin is connects to ground.

Vcc: This power supply pin connects to + 5.0V with a tolerance of ± 10 percent

Operation of the 8084A:

clip_image026

Fig1.1. The clock generator (8284A) and the 8086/8088 microprocessor illustrating the connection for the clock and reset signal. (A 15 MHz of crystal provides the 5MHz clock for the microprocessor.)

The Reset section of the 8284A is very simple. It consists of a Schmitt trigger buffer and a single D-type flip flop circuit. The D-type flip flop ensures that the timing requirements of the 8086/8088 microprocessor RESET input are met. The circuit applies the RESET signal to the microprocessor negative edge (1-to-0 transition) of each clock. The 8086/8088 microprocessor sample RESET at the positive edge (0-to-1 transition) of the clocks; therefore, the circuit meets the timing requirements of the 8086/8088 microprocessor.

The RC circuit provides a logic 0 to the RES* input pin when power is first applied to the system. After a short time, the RES* input becomes a logic 1 because the capacitor charges toward +5.0V through the resistor. A push-button switch allows the microprocessor to be reset by the operator. Correct reset timing requires the RESET input

to become logic 1 no later than four clocks after system power is applied and to be held high for at least 50µs. The flop-flop makes certain that RESET goes high in four clocks, and the RC time constant ensures that it stays high for at least 50µs.

Ready Logic

clip_image028

The Ready Logic generates the Ready signal for the 8086/8088 microprocessor. If the Ready signal is made low by this circuit during T2 state of a machine cycle, the microprocessor introduces a wait state between T3 and T4 states of the machine cycle. The Ready logic is indicated in the figure. There are two pairs of signals in 8284 which can make the Ready output of 8284 to go low. If (RDY1=0 or AEN1*=1) and (RDY2=0 or AEN2*=1), the Ready output becomes low when the next clock transition takes place. In PCs, RDY2 and AEN2* are not used, and as such RDY2 is tied to Ground and /or AEN2* is tied to +5V. AEN1* is used for generating wait states in the 8086/8088 bus cycle, and RDY1 is used for generating wait state in the DMA bus cycle.

Reset Logic

clip_image030

The Reset logic generates the Reset input signal for the 8086/8088. When the RESET* pin goes low, the Reset output is generated by the 8284 when the next clock transition takes place.

In PCs, the RES* input is activated by one of the following.

  • From the manual Reset button on the front panel.
  • From the ‘Power on Reset’ circuit, which uses RC components.
  • If the ‘Power Good’ signal from the SMPS is not active.
 

Module1 8086 Microprocessor and Peripherals part2.

Physical address formation:

The 8086 addresses a segmented memory. The complete physical address which is 20-bits long is generated using segment and offset registers each of the size 16-bit.The content of a segment register also called as segment address, and content of an offset register also called as offset address. To get total physical address, put the lower nibble 0H to segment address and add offset address. The fig 1.3 shows formation of 20-bit physical address.

image

Register organization of 8086:

8086 has a powerful set of registers containing general purpose and special purpose registers. All the registers of 8086 are 16-bit registers. The general purpose registers, can be used either 8-bit registers or 16-bit registers. The general purpose registers are either used for holding the data, variables and intermediate results temporarily or for other purpose like counter or for storing offset address for some particular addressing modes etc. The special purpose registers are used as segment registers, pointers, index registers or as offset storage registers for particular addressing modes. Fig 1.4 shows register organization of 8086. We will categorize the register set into four groups as follows:

General data registers:

image

The registers AX, BX, CX, and DX are the general 16-bit registers.

AX Register: Accumulator register consists of two 8-bit registers AL and AH, which can be combined together and used as a 16- bit register AX. AL in this case contains the low-order byte of the word, and AH contains the high-order byte. Accumulator can be used for I/O operations, rotate and string manipulation.

BX Register: This register is mainly used as a base register. It holds the starting base location of a memory region within a data segment. It is used as offset storage for forming physical address in case of certain addressing mode.

CX Register: It is used as default counter or count register in case of string and loop instructions.

DX Register: Data register can be used as a port number in I/O operations and implicit operand or destination in case of few instructions. In integer 32-bit multiply and divide instruction the DX register contains high-order word of the initial or resulting number.

Segment registers:

To complete 1Mbyte memory is divided into 16 logical segments. The complete 1Mbyte memory segmentation is as shown in fig 1.5. Each segment contains 64Kbyte of memory. There are four segment registers.

Code segment (CS) is a 16-bit register containing address of 64 KB segment with processor instructions. The processor uses CS segment for all accesses to instructions referenced by instruction pointer (IP) register. CS register cannot be changed directly. The CS register is automatically updated during far jump, far call and far return instructions. It is used for addressing a memory location in the code segment of the memory, where the executable program is stored.

Stack segment (SS) is a 16-bit register containing address of 64KB segment with program stack. By default, the processor assumes that all data referenced by the stack pointer (SP) and base pointer (BP) registers is located in the stack segment. SS register can be changed directly using POP instruction. It is used for addressing stack segment of memory. The stack segment is that segment of memory, which is used to store stack data.

Data segment (DS) is a 16-bit register containing address of 64KB segment with program data. By default, the processor assumes that all data referenced by general registers (AX, BX, CX, DX) and index register (SI, DI) is located in the data segment. DS register can be changed directly using POP and LDS instructions. It points to the data segment memory where the data is resided.

Extra segment (ES) is a 16-bit register containing address of 64KB segment, usually with program data. By default, the processor assumes that the DI register references the ES segment in string manipulation instructions. ES register can be changed directly using POP and LES instructions. It also refers to segment which essentially is another data segment of the memory. It also contains data.

image

Pointers and index registers.

The pointers contain within the particular segments. The pointers IP, BP, SP usually contain offsets within the code, data and stack segments respectively

Stack Pointer (SP) is a 16-bit register pointing to program stack in stack segment.

Base Pointer (BP) is a 16-bit register pointing to data in stack segment. BP register is usually used for based, based indexed or register indirect addressing.

Source Index (SI) is a 16-bit register. SI is used for indexed, based indexed and register indirect addressing, as well as a source data addresses in string manipulation instructions.

Destination Index (DI) is a 16-bit register. DI is used for indexed, based indexed and register indirect addressing, as well as a destination data address in string manipulation instructions.

Flag register

image

Flags Register determines the current state of the processor. They are modified automatically by CPU after mathematical operations, this allows to determine the type of the result, and to determine conditions to transfer control to other parts of the program. The 8086 flag register as shown in the fig 1.6. 8086 has 9 active flags and they are divided into two categories:

1. Conditional Flags

2. Control Flags

Conditional Flags

Conditional flags are as follows:

Carry Flag (CY): This flag indicates an overflow condition for unsigned integer arithmetic. It is also used in multiple-precision arithmetic.

Auxiliary Flag (AC): If an operation performed in ALU generates a carry/barrow from lower nibble (i.e. D0 – D3) to upper nibble (i.e. D4 – D7), the AC flag is set i.e. carry given by D3 bit to D4 is AC flag. This is not a general-purpose flag, it is used internally by the Processor to perform Binary to BCD conversion.

Parity Flag (PF): This flag is used to indicate the parity of result. If lower order 8-bits of the result contains even number of 1’s, the Parity Flag is set and for odd number of 1’s, the Parity flag is reset.

Zero Flag (ZF): It is set; if the result of arithmetic or logical operation is zero else it is reset.

Sign Flag (SF): In sign magnitude format the sign of number is indicated by MSB bit. If the result of operation is negative, sign flag is set.

Control Flags

Control flags are set or reset deliberately to control the operations of the execution unit. Control flags are as follows:

Trap Flag (TF): It is used for single step control. It allows user to execute one instruction of a program at a time for debugging. When trap flag is set, program can be run in single step mode.

Interrupt Flag (IF): It is an interrupt enable/disable flag. If it is set, the maskable interrupt of 8086 is enabled and if it is reset, the interrupt is disabled. It can be set by executing instruction sit and can be cleared by executing CLI instruction.

Direction Flag (DF): It is used in string operation. If it is set, string bytes are accessed from higher memory address to lower memory address. When it is reset, the string bytes are accessed from lower memory address to higher memory address.

 

Module1 8086 Microprocessor and Peripherals part1.

Introduction:

Microprocessor:

It is a semiconductor device consisting of electronic logic circuits manufactured by using either a Large scale (LSI) or Very Large Scale (VLSI) Integration Technique. It includes the ALU, register arrays and control circuits on a single chip.

The microprocessor has a set of instructions, designed internally, to manipulate data and communicate with peripherals. This process of data manipulation and communication is determined by the logic design of the microprocessor called the architecture.

The era microprocessors in the year 1971, the Intel introduced the first 4-bit microprocessor is 4004. Using this the first portable calculator is designed. The following table1 shows the list of Intel microprocessors.

image

The different manufacturing companies are introduced different bit size microprocessors in the past decade is shown in the table 2

image

A microcomputer system just as any other computer system, include two principal components Hardware and Software. The hardware is a course the circuitry, cabinetry etc and the software is the collection of programs which direct the computer while it performs its tasks.

The memory is used to store both data and instructions that are currently being used. It is normally broken into several modules, each module containing several thousand locations. Each location may contain part or all of a datum or instruction and is associated with an identifier called a memory address. The CPU does its work by successfully inputting, or fetching instructions from memory and carrying out the tasks detected them.

image

Figure1.1 shows block diagram of a simple microcomputer. The major parts are the central processing unit or CPU, memory and the input and output circuitry or Input/output. Connecting these parts are three sets of parallel line is called buses and control bus. In a microcomputer the CPU is a microprocessor and is often referred to as the microprocessor unit (MPU). Its purpose is to decode the instruction and use them to control the activity with in the system. It performs all arithmetic and logical computations.

Memory: Memory section usually consists of a mixture of RAM and ROM. It may also magnetic floppy disks, magnetic hard disks or optical disks, to store the data.

Input/output: The input/output section allows the computer to take in data from the outside world or send data to the outside world. Peripherals such as keyboards, video display terminals. Printers and modem are connected to the input/output section. These allow the user and computer to communicate with each other. The actual physical devices used to interface the computer buses to external systems are often called ports. An input/output port allows data from keyboard, an analog to digital converter (ADC) or some other source to be read into the computer under the control of the CPU. An output port is used to send data from the computer to some peripheral, such as a video display terminal, a printer or a digital to analog converter (DAC).

Central processing Unit (CPU): CPU controls the operation of the computer .In a microcomputer the CPU is a microprocessor. The CPU fetches the binary coded instructions from memory, decodes the instructions into a series of simple action and carries out these actions in sequence of steps.

CPU contains an a address counter or instruction pointer register which holds the address of the next instruction or data item to be fetched from memory, general purpose register, which are used for temporary storage or binary data and circuitry, which generates the control bus signals.

Address bus: The address bus consists of 16, 20, 24 or 32 parallel lines. On these lines the CPU sends out the address of the memory locations that are to be written to or read from. The number of memory locations that the CPU can addresses is determined by the number of address lines, then it can directly address 2n memory location. When the CPU reads data from or writes data to a port, it sends the port address on the address bus.

Ex: CPU has 16 address lines can address 216 or 65536 memory locations.

Data bus: It consists of 8, 16, 32 parallel signal lines. The data bus lines are bidirectional. This means that the CPU can read, data from memory or from a port on these lines, or it can send data out to memory or to port on these lines.

Control bus: The control bus consists of 4 to 10 parallel signals lines. The CPU sends out signals on the control bus enable the outputs of addressed memory devices or port devices. Typical control bus signal are memory read, memory write, I/O read and I/O write.

Hardware, software and Firmware: hardware is the given to the physical devices and circuitry of the computer. Software refers to collection of programs written for the computer. Firmware is the term given programs stored in ROM’s or in other devices which permanently keep their stored information.

Introduction to 16-bit Microprocessor:

The 16-bit Microprocessor families are designed primarily to complete with microcomputers and are oriented towards high-level languages. Their applications sometimes overlap those of the 8-bit microprocessors. The have powerful instruction sets and capable of addressing mega bytes of memory.

The era of 16-bit Microprocessors began in 1974 with the introduction of PACE chip by National Semiconductor. The Texas Instruments TMS9900 was introduced in the year 1976. The Intel 8086 commercially available in the year 1978, Zilog Z800 in the year 1979, The Motorola MC68000 in the year 1980.

The 16-bit Microprocessors are available in different pin packages.

image

The primary objectives of this 16-bit Microprocessor can be summarized as follows.

1. Increase memory addressing capability

2. Increase execution speed

3. Provide a powerful instruction set

4. Facilitate programming in high-level languages.

The INTEL iAPX 8086/8088:

It is a 16-bit Microprocessor housed in a 40-pin Dual-Inline-Package (DIP) and capable of addressing 1Megabyte of memory, various versions of this chip can operate with different clock frequencies

i. 8086 (5 MHz)

ii.8086-2 (8 MHz)

iii. 8086-1 (10 MHz).

It contains approximately 29,000 transistors and is fabricated using the HMOS technology . The term 16-bit means that its arithmetic logic unit, its internal registers and most of its instructions are designed to work with 16-bit binary word. The 8086 Microprocessor has a 16-bit data bus, so it can read from or write data to memory and ports either 16-bits or 8-bits at a time. The 8086 Microprocessor has 20-bit address bus, so it can address any one of 220 or 1,048,576 memory locations. Here 16-bit words will be stored in two consecutive memory locations. If the first byte of a word is at an even address, the 8086 can read entire word in one operation, If the first byte of the word is at an odd address the 8086 will read the first byte with one bus operation and the second byte with another bus operation.

Architecture:

The internal architecture 8086 microprocessor is as shown in the fig 1.2.The 8086

CPU is divided into two independent functional parts, the Bus interface unit (BIU) and execution unit (EU).

The Bus Interface Unit contains Bus Interface Logic, Segment registers, Memory addressing logic and a Six byte instruction object code queue. The execution unit contains the Data and Address registers, the Arithmetic and Logic Unit, the Control Unit and flags.

image

The BIU sends out address, fetches the instructions from memory, read data from ports and memory, and writes the data to ports and memory. In other words the BIU handles all transfers of data and addresses on the buses for the execution unit.

The execution unit (EU) of the 8086 tells the BIU where to fetch instructions or data from, decodes instructions and executes instruction. The EU contains control circuitry which directs internal operations. A decoder in the EU translates instructions fetched from memory into a series of actions which the EU carries out. The EU is has a 16-bit ALU which can add, subtract, AND, OR, XOR, increment, decrement, complement or shift binary numbers. The EU is decoding an instruction or executing an instruction which does not require use of the buses.

The Queue: The BIU fetches up to 6 instruction bytes for the following instructions. The BIU stores these prefetched bytes in first-in-first-out register set called a queue. When the EU is ready for its next instruction it simply reads the instruction byte(s) for the instruction from the queue in the BIU. This is much faster than sending out an address to the system memory and waiting for memory to send back the next instruction byte or bytes. Except in the case of JMP and CALL instructions, where the queue must be dumped and then reloaded starting from a new address, this prefetch-and-queue scheme greatly speeds up processing. Fetching the next instruction while the current instruction executes is called pipelining.

Word Read

Each of 1 MB memory address of 8086 represents a byte wide location.16-bit

words will be stored in two consecutive memory locations. If first byte of the data is stored at an even address, 8086 can read the entire word in one operation.

For example if the 16 bit data is stored at even address 00520H is 9634H

MOV BX, [00520H]

8086 reads the first byte and stores the data in BL and reads the 2nd byte and stores the data in BH

BL= (00520H)

i.e.

BL=34H

BH= (00521H)

BH=96H

If the first byte of the data is stored at an odd address, 8086 needs two operations to read

the 16 bit data.

For example if the 16 bit data is stored at even address 00521H is 3897H

MOV BX, [00521H]

In first operation, 8086 reads the 16 bit data from the 00520H location and stores the data of 00521H location in register BL and discards the data of 00520H location In 2nd operation, 8086 reads the 16 bit data from the 00522H location and stores the data of 00522H location in register BH and discards the data of 00523H location.

image

Byte Read:

MOV BH, [Addr]

For Even Address:

Ex: MOV BH, [00520H]

8086 reads the first byte from 00520 location and stores the data in BH and reads the 2nd byte from the 00521H location and ignores it

BH =[ 00520H]

For Odd Address

MOV BH, [Addr]

Ex: MOV BH, [00521H]

8086 reads the first byte from 00520H location and ignores it and reads the 2nd byte from the 00521 location and stores the data in BH

BH = [00521H]

 

Microprocessors and Microcontrollers/Architecture of Micro controllers part3.

General Purpose I/O Ports

• Port 0 whose lines can serve as either general purpose inputs or alternatively as input to the analog-to-digital converter family.

• Port 1 is a quasi-bidirectional I/O port.

• Port 2 includes four input lines, two output lines, and two quasi-bidirectional I/O lines.

• Port 3 and 4 when used as ports, they have open drain outputs.

• By writing anything but a 1 to a line, it can serve as an input even as other lines serve as outputs.

• Each output line needs the addition of a pullup resistor having a value of 15kΩ.

• In the expanded mode the bus lines gain the ability to drive both high and low, forming the expansion bus without the need of pullup resistors.

image

image

 

Microprocessors and Microcontrollers/Architecture of Micro controllers part2.

Architecture

• The MCS-96 supports a complete instruction set which includes bit operations, byte operations, word operations, double-word operations (unsigned 32 bit), long operations (signed 32 bit), flag manipulations as well as jump and call instructions.

• All the standard logical and arithmetic instructions function as both byte and word operations.

• The jump bit set and jump bit clear instructions can operate on any of the SFR or bytes in the lower register files. These fast bit manipulations allow for rapid I/O functions.

• Byte and word operations make up the instruction set. The assembly language ASM-96 uses a “B” suffix on a mnemonic for a byte operation or for word operation.

• Addressing modes: This supports the following modes.

• Register-direct, indirect, indirect with auto-increment, immediate, short-indexed and long-indexed.

• These modes increase the flexibility and overall execution speed of the MCS-96 devices.

image

image

Instruction Format

8096 Peripherals

Standard I/O Ports – The 8096 has five 8 bit I/O ports.

• Port 0 is an input port that is also the analog input for the A/D converter.

• Port 1 is a quasi-bidirectional port.

• Port 2 contains three types of port lines.

• Quasi-Bidirectional, input and output. Other functions on the 8096 share the input and output lines with Port 2.

• Port 3 and 4 are open-drain bidirectional ports that share their pins with the address/data bus.

Timers – The 8096 has two 16 bit timers. Timer 1 and Timer 2.

• An internal clock increments the Timer 1 value every 8 state times. (A state time is 3 oscillator periods)

• An external clock increments Timer 2 on every positive and negative transition.

• Either an internal or external source can reset Timer 2.

• This two timers can generate an interrupt when crossing the 0FFFFH/0000H boundary.

• The 8096 includes separate, dedicated timers for serial port baud rate generator and watchdog timer.

• The watchdog Timer is an internal timer that resets the system if the software fails to operate properly.

High Speed Input Unit (HSI) – The 8096 HIS unit can record times of external events with a 9 state time resolution. It can monitor four independently configurable HSI lines and captures the value of timer 1 when events takes place.

• The four types of events that can trigger captures include: rising edge only, falling edge only, rising or falling edges, or every eight rising edge.

• The HSI unit can store upto 8 entries (Timer 1 values ).

• Reading the HSI holding register unloads the earliest entry placed in the FIFO.

• The HSI unit can generate an interrupt when loading an entry into the HSI holding register or loading the sixth entry into the FIFO.

High Speed Output Unit (HSO) – The 8096 HSO unit can trigger events at specified times based on Timer1 or Timer2.

• These programmable events include: starting an A/D conversion, resetting Timer2, generating up to four software time delays, and setting or clearing one or more of the six HSO output lines.

• The HSO unit stores pending event and specified times in a Content Addressable Memory (CAM) file. This file stores up to 8 commands.

• Each command specifies the action time, the nature of the action, whether an interrupt is to occur, and whether Timer1 or Timer2 is the reference timer.

• Every 8 state times the HSO compares the CAM locations for time matches. The HSO unit triggers the specified event when it finds a time match.

• A command is cleared from the CAM as soon as it executes.

Serial Port – The serial port on the 8096 has one synchronous (Mode 0) and three asynchronous modes (Modes 1, 2 and 3).

• The asynchronous modes are full duplex.

• Mode 0, the synchronous mode, is to expand the I/O capability of the 8096 using shift register.

• Mode 1 is the standard asynchronous mode used for normal serial communication.

• Modes 2, 3 are 9-bit modes commonly used for multiprocessor communications.

Pulse Width Modulator (PWM) – The PWM output waveform is a variable duty cycle pulse that repeats every 256 state times.

• The PWM output can perform digital to analog conversions and drive several types of motors that require a PWM waveform for more efficient operation.

A/D Converter – The 8096 A/D converts an analog input to a 10 bit digital equivalent.

• The main components of the A/D Converter are: 8 analog inputs, an 8 to 1 multiplexer, a sample and hold capacitor and resistor ladder.

• The A/D Converter can start a conversion immediately or the High Speed Output unit can trigger a conversion at a preprogrammed time.

• The A/D converter performs a conversion in 88 state times. Upon completion of each conversion the converter can generate a conversion complete interrupt.

• The 8X9X provides separate VREF and ANGND supply pins to isolate noise on the Vcc or Vss lines.

Interrupts – There are 21 interrupts sources and 8 interrupt vector on the 8096.

• When the interrupt controller detects one of the 8 interrupts it sets the corresponding bit in the interrupt pending register. Individual interrupts are enabled or disabled by setting or clearing bits in the interrupt mask register.

• When the interrupt controller decides to process an interrupt, it executes a “call” to an interrupt service routine ISR. The corresponding interrupt vector contains the address of the ISR. The interrupt controller then clears the associated pending bit.

image

Chip configuration byte (CCB)

Configuring the 8096

• The 8096 can be operated in either the single-chip mode, or two of its ports can be redefined to bring out the internal address bus and data bus.

• For the single chip mode, the internal ROM and EPROM must be accessed. This choice is made by tying the EA# pin high.

• When EA pin is tied high, the internal ROM or EPROM is accessed during instruction and data fetches from addresses 2080 to 3FFFH and for interrupt vectors located at addresses 2000 to 2011H.

image

image

• When operated in the expanded mode the internal ROM or EPROM can still be used by tying EA# high.

• Accesses to the addresses 2000 to 2011H and 2080 to 3FFFH can be made to access off-chip memory by tying the EA# pin low.

• If the EA pin is high, then we have the option of using the internal ROM or EPROM together with external memory and devices.

• One of the options made available by the BH series over the original 8096 family is the option to deal with either a 16 bit external data bus or else an 8 bit external data bus.

• The latter options permits expanding the 8096 with a single byte wide static RAM chip or with a single byte wide EPROM chip for program memory.

• The latter is particularly convenient for users who can either put their application program into a single EPROM or who do not have the EPROM programming capability to separate their object code into even addresses and odd addresses as required for the two byte wide EPROM used with a 16 bit data bus.

• The choice of bus width is made in two places. When the 8096 comes out of reset, it reads the content of address 2018H of our ROM or EPROM. This is called the chip configuration CCB.

• The 8096 stores this byte in a chip configuration register which is unaccessable by our software.

• Bit 1 works together with the external BUSWIDTH pin to determine the data bus width (when the EA pin is tied low).

• While the BUSWIDTH pin is tied either high or low, it can actually be changed during each bus cycle of normal operation.

• If it is tied to the A15 address lines, then accesses to external addresses 8000 to FFFFH would use a 16-bit data bus while accesses to external addresses below this would use an 8-bit data bus. In either case, the full 16 bit address bus is brought out.

• When an 8-bit data bus is brought out, the lines which bring out the upper half of the address bus do not have to be multiplexed.

• In this case, the designers of the chip have saved users the need for an external latch for the upper half of the address bus by latching the address internally.

• The original 8096 parts gave the user of the expanded chip an ALE output. This was used to latch the address. The new option is selected with a 0 in bit 3 of CCB. The ADV# line remains high during any machine cycles which are not accessing external memory, but goes low during external accesses. Because of this ADV# can be used to simplify the decoding to enable external devices.

• In addition to the external access, ADV# drop low at precisely the current time to latch the multiplexed address. Consequently, it can serve double duty, both helping with decoding and also latching the multiplexed address.

• Another feature of the original 8096 parts operating in the expanded mode was the need to decode a BHE# signal.

• This was used during writes to a byte at an odd address so that the lower byte on the 16-bit data bus could be left unchanged.

• Users of the original 8096 parts had to gate BHE# together with a WR# signal to generate two write signals.

• One for chips connected to the upper half of the data bus and one for chip connected to the lower half of the data bus.

• This option is selected with 0 bit 2 of CCB.

• INST output is a signal which takes on when the RD# line is active, signaling that a read from an external device is taking place. If the read is an instruction fetch, then INST will be high. Otherwise it will be low during the read cycle.

• Users of logia analyzers and designers of 8096 emulators can use this signal to help sort out the activity on external bus.

• The READY control line permits the 8096 to run at full speed for its internal accesses and yet to slow down for some of its external accesses.

• It is used in conjunction with bits 4 and 5 of CCB to introduce extra 250ns (assuming a 12 MHz crystal) wait states into external read and write cycles.

• If the READY line is tied high then the CCB bits do not matter and no external wait states are introduced into external read or writes.

• If the READY line is tied low (signifying that external devices are not ready), then this READY signal can be overridden by the CCB bits.

• Thus 00 in bits 4 and 5 of CCB will now limit the delay to a signal wait state.

• READY line can be changed by dynamically from cycle to cycle. If it is tied to the upper address lines, then we can position external devices which can run at full speed in the 8000 to FFFF address range and slower external device needing an extra wait state at lower addresses.

• The lock mode is selected by the coding of bit 6 and 7. Whether the software is in on-chip manage to get the chip to execute code from external memory and then have that external program dump the internal memory to the serial port.

• In a read-protected mode, only code executing from internal memory can read from memory addresses between 2020 to 3FFFH.

• In a write-protected mode, no code can write to memory address between 2000 and 3FFFH.

• One problem arises with a memory protection scheme such as, if we purchase ROM-protected parts from Intel, then before we use them, we would like to test them.

• We can drive the EA# line low and use our own program to test all the resource on the chip. This does not test the ROM contents.

• Intel supports the verification of ROM by including a 16byte security key, located at address 2020 to 202FH. Before protected memory can read, the chip must read external memory locations 4020 to 402FH and compare the contents with the internal security key.

• Access to protected memory will only be allowed if a match I found for all 16 bytes.

• The first 26 addresses from the register file, used to set up and access almost all of the on-chip resources. The rest of the page 0 is dedicated to internal RAM, for a total of 230 bytes of RAM.

• While the ROM or EPROM extends from 2000 to 3FFFH, Intel reserves address 2012 to 2017H.

image

image

image

 

Microprocessors and Microcontrollers/Architecture of Micro controllers part1.

Microcontroller
Contents

•Introduction

•Inside 8051

•Instructions

•Interfacing

Introduction

• Definition of a Microcontroller

• Difference with a Microprocessor

• Microcontroller is used where ever

Definition

• It is a single chip

• Consists of Cpu, Memory

• I/O ports, timers and other peripherals

Difference

image

Where ever

• Small size

• Low cost

• Low power

Architecture

•Harvard university

The Architecture given by Harvard University has the following advantages:

1: Data Space and Program Space are distinct

2: There is no Data corruption or loss of data

Disadvantage is:

1: The circuitry is very complex.

Features

• 8 bit cpu

• 64k Program memory (4k on chip)

• 64k Data memory

• 128 Bytes on chip

• 32 I/O

• Two 16 bit timers

• Full duplex UART

• 6 Source/5 Vector interrupts with two level priority levels

• On chip clock Oscillator.

image

image

image

image

Overview of 8096 16 bit microcontroller

Features

• 232 Byte Register File.

• Register to Register Architecture.

• 10 bit A/D Converter with S/H.

• Five 8 bit I/O ports.

• 20 Interrupt Sources.

• Pulse Width Modulation Output.

• High speed I/O subsystem.

• Dedicated Baud Rate Generator.

• Full Duplex Serial Port.

• 16 bit Watchdog Timer.

Introduction

• The MSC-96 family members are all high performance microcontroller with a 16 bit CPU and atleast 230 bytes of on-chip RAM.

• Intel MSC-96 family easily handles high speed calculations and fast input/out operations.

• All of the MCS-96 components share a common instruction set and architecture.

• However the CHMOS components have enhancements to provide higher performance with lower power consumption.

• These microcontroller contains dedicated I/O subsystem and perform 16-bit arithmetic instructions including multiply and divide operations.

CPU: The major components of the MCS-96 CPU are the Register File and the Register / Arithmetic Logic Unit (RALU).

• Location 00H through 17H are the I/O control registers or Special function registers (SFR).

• Locations 18H and 19H contains the stack pointer, which can serve as general purpose RAM when not performing stack operations.

• The remaining bytes of the register file serve as general purpose RAM, accessible as bytes, words or double-words.

• Calculations performed by the CPU take place in the RALU. The RALU contains a 17bit ALU, the program status word (PSW), the program Counter (PC), a loop counter and three temporary registers.

• The RALU operates directly on the Register Files, thus eliminating accumulator bottleneck and providing for direct control of I/O operations through the SFR.

 

Module 4 learning unit 11 of Microprocessors and Microcontrollers/Coprocessor.

Module 4 learning unit 11:

Data Types

�Internally, all data operands are converted to the 80-bit temporary real format. We have 3 types.

•Integer data type

•Packed BCD data type

•Real data type

Coprocessor data types Integer Data Type

Packed BCD

Real data type

Example

  • Converting a decimal number into a Floating-point number.

1) Converting the decimal number into binary form.

2) Normalize the binary number

3) Calculate the biased exponent.

4) Store the number in the floating-point format.

Example

Step Result

1) 100.25

2) 1100100.01 = 1.10010001 * 26

3) 110+01111111=10000101

4 ) Sign = 0

Exponent =10000101

Significand = 10010001000000000000000

•In step 3 the biased exponent is the exponent a 26 or 110,plus a bias of 01111111(7FH)

,single precision no use 7F and double precision no use 3FFFH.

•IN step 4 the information found in prior step is combined to form the floating point no.

INSTRUCTION SET

�The 8087 instruction mnemonics begins with the letter F which stands for Floating point and distinguishes from 8086.

�These are grouped into Four functional groups.

�The 8087 detects an error condition usually called an exception when it executing an

instruction it will set the bit in its Status register.

Types

I. DATA TRANSFER INSTRUCTIONS.

II. ARITHMETIC INSTRUCTIONS.

III. COMPARE INSTRUCTIONS.

IV. TRANSCENDENTAL INSTRUCTIONS.

(Trigonometric and Exponential)

Data Transfers InstructionsREAL TRANSFER FLD Load real

image

image

image

image

image

 

Module 4 learning unit 10 of Microprocessors and Microcontrollers/Coprocessor part2.

INTERFACING

1

�Multiplexed address-data bus lines are connected directly from the 8086 to 8087.

�The status lines and the queue status lines connected directly from 8086 to 8087.

�The Request/Grant signal RQ/GT0 of 8087 is connected to RQ/GT1 of 8086.

�BUSY signal 8087 is connected to TEST pin of 8086.

�Interrupt output INT of the 8087 to NMI input of 8086. This intimates an error condition.

�A WAIT instruction is passed to keep looking at its TEST pin, until it finds pin Low to indicates that the 8087 has completed the computation.

�SYNCHRONIZATION must be established between the processor and coprocessor in two situations.

a) The execution of an ESC instruction that require the participation of the NUE must not be initiated if the NUE has not completed the execution of the previous instruction.

b) When a processor instruction accesses a memory location that is an operand of a previous coprocessor instruction .In this case CPU must synchronize with NPX to ensure that it has completed its instruction.

Processor WAIT instruction is provided.

Exception Handling

�The 8087 detects six different types of exception conditions that occur during instruction execution. These will cause an interrupt if unmasked and interrupts are enabled.

1)INVALID OPERATION

2)OVERFLOW

3)ZERO DIVISOR

4)UNDERFLOW

5) DENORMALIZED OPERAND

6) INEXACT RESULT

 

Module 4 learning unit 10 of Microprocessors and Microcontrollers/Coprocessor part1.

Module 4 learning unit 10:

Contents •Architecture of 8087

•Data types

•Interfacing

•Instructions and programming

Overview Each processor in the 80 x 86 families has a corresponding coprocessor with which it is compatible.

  • Math Coprocessor is known as NPX,NDP, FUP.

Numeric processor extension (NPX), Numeric data processor (NDP), Floating point unit (FUP).

Compatible Processor and Coprocessor

Processors

1. 8086 & 8088

2. 80286

3. 80386DX

4. 80386SX

5. 80486DX

6. 80486SX

Coprocessors

1. 8087

2. 80287, 80287XL

3. 80287, 80387DX

4. 80387SX

5. It is Inbuilt

6. 80487SX

image

image

Control Unit�Control unit: To synchronize the operation of the coprocessor and the processor.

  • This unit has a Control word and Status word and Data Buffer
  • If instruction is an ESCape (coprocessor) instruction, the coprocessor executes it, if not the microprocessor executes.
  • Status register reflects the over all operation of the coprocessor.

image

  • B-Busy bit indicates that coprocessor is busy executing a task. Busy can be tested by examining the status or by using the FWAIT instruction. Newer coprocessor automatically synchronize with the microprocessor, so busy flag need not be tested before performing additional coprocessor tasks.
  • C3-C0 Condition code bits indicates conditions about the coprocessor.
  • TOP- Top of the stack (ST) bit indicates the current register address as the top of the stack.
  • ES-Error summary bit is set if any unmasked error bit (PE, UE, OE, ZE, DE, or IE) is set. In the 8087 the error summary is also caused a coprocessor interrupt.
  • PE- Precision error indicates that the result or operand executes selected precision.
  • UE-Under flow error indicates the result is too large to be represent with the current precision selected by the control word.
  • OE-Over flow error indicates a result that is too large to be represented. If this error is masked, the coprocessor generates infinity for an overflow error.
  • ZE-A Zero error indicates the divisor was zero while the dividend is a non-infinity or non-zero number.
  • DE-Denormalized error indicates at least one of the operand is denormalized.
  • IE-Invalid error indicates a stack overflow or underflow, indeterminate from (0/0,0,-0, etc) or the use of a NAN as an operand. This flag indicates error such as those produced by taking the square root of a negative number.

Control Register�Control register selects precision, rounding control, infinity control.

  • It also masks an unmasks the exception bits that correspond to the rightmost Six bits of status register.
  • Instruction FLDCW is used to load the value into the control register.

Control Register

image

image

  • IC –Infinity control selects either affine or projective infinity. Affine allows positive and negative infinity, while projective assumes infinity is unsigned.
INFINITY CONTROL

0 = Projective

1 = Affine

  • RC –Rounding control determines the type of rounding.
ROUNDING CONTROL

00=Round to nearest or even

01=Round down towards minus infinity

10=Round up towards plus infinity

11=Chop or truncate towards zero

  • PC- Precision control sets the precision of he result as define in table
PRECISION CONTROL

00=Single precision (short)

01=Reserved

10=Double precision (long)

11=Extended precision (temporary)

  • Exception Masks – It Determines whether the error indicated by the exception affects the error bit in the status register. If a logic1 is placed in one of the exception control bits, corresponding status register bit is masked off.

Numeric Execution Unit�This performs all operations that access and manipulate the numeric data in the coprocessor’s registers.

  • Numeric registers in NUE are 80 bits wide.
  • NUE is able to perform arithmetic, logical and transcendental operations as well as supply a small number of mathematical constants from its on-chip ROM.
  • Numeric data is routed into two parts ways a 64 bit mantissa bus and a 16 bit sign/exponent bus.
Circuit Connection for 8086 – 8087

image

➢ Multiplexed address-data bus lines are connected directly from the 8086 to 8087. The status lines and the queue status lines connected directly from 8086 to 8087.

➢ The Request / Grant signal RQ/GT0 of 8087 is connected to RQ / GT1 of 8086.

➢ BUSY signal 8087 is connected to TEST pin of 8086.

➢ Interrupt output INT of the 8087 to NMI input of 8086. This intimates an error condition.

  • The main purpose of the circuitry between the INT output of 8087 and the NMI input is to make sure that an NMI signal is not present upon reset, to make it possible to mask NMI input and to make it possible for other devices to cause an NMI interrupt.
  • BHE pin is connected to the system BHE line to enable the upper bank of memory.
  • The RQ/GT1 input is available so that another coprocessor such as 8089 I/O processor can be connected and function in parallel with the 8087.
  • One type of Cooperation between the two processors that you need to know about it is how the 8087 transfers data between memory and its internal registers.
  • When 8086 reads an 8087 instruction that needs data from memory or wants to send data to memory, the 8086 sends out the memory address code in the instruction and sends out the appropriate memory read or memory write signal to transfer a word of data.
  • In the case of memory read, the addressed word will be kept on the data bus by the memory. The 8087 then simply reads the word of data bus. The 8086 ignores this word .If the 8087 only needs this one word of data, it can then go on and executes its instruction.
  • Some 8087 instructions need to read in or write out up to 80-bit word. For these cases 8086 outputs the address of the first data word on the address bus and outputs the appropriate control signal.
  • The 8087 reads the data word on the data bus by memory or writes a data word to memory on the data bus. The 8087 grabs the 20-bit physical address that was output by the 8086.To transfer additional words it needs to/from memory, the 8087 then takes over the buses from 8086.
  • To take over the bus, the 8087 sends out a low-going pulse on RQ/GT0 pin. The 8086 responds to this by sending another low going pulse back to the RQ/GT0 pin of 8087 and by floating its buses.
  • The 8087 then increments the address it grabbed during the first transfer and outputs the incremented address on the address bus. When the 8087 output a memory read or memory write signal, another data word will be transferred to or from the 8087.
  • The 8087 continues the process until it has transferred all the data words required by the instruction to/from memory.
  • When the 8087 is using the buses for its data transfer, it sends another low-going pulse out on its RQ/ GT0 pin to 8086 to know it can have the buses back again.

The next type of the synchronization between the host processor and the coprocessor is that required to make sure the 8086 hast does not attempt to execute the next instruction before the 8087 has completed an instruction.

  • Taking one situation, in the case where the 8086 needs the data produced by the execution of an 8087 instruction to carry out its next instruction.
  • In the instruction sequence for example the 8087 must complete the FSTSW STATUS instruction before the 8086 will have the data it needs to execute the MOV AX , STATUS instruction.
  • Without some mechanism to make the 8086 wait until the 8087 completes the FSTSW instruction, the 8086 will go on and execute the MOV AX , STATUS with erroneous data .
  • We solve this problem by connecting the 8087 BUSY output to the TEST pin of the 8086 and putting on the WAIT instruction in the program.
  • While 8087 is executing an instruction it asserts its BUSY pin high. When it is finished with an instruction, the 8087 will drop its BUSY pin low. Since the BUSY pin from 8087 is connected to the TEST pin 8086 the processor can check its pin of 8087 whether it finished it instruction or not.
  • You place the 8086 WAIT instruction in your program after the 8087 FSTSW instruction .When 8086 executes the WAIT instruction it enters an internal loop where it repeatedly checks the logic level on the TEST input. The 8086 will stay in this loop until it finds the TEST input asserted low, indicating the 8087 has completed its instruction. The 8086 will then exit the internal loop, fetch and execute the next instruction.

image

image

  • In this code we are adding up of FWAIT instruction so that it will stop the execution of the command until the above instruction is finishes it’s work .so that you are not loosing data and after that you will allow to continue the execution of instructions.
  • Another case where you need synchronization of the processor and the coprocessor is the case where a program has several 8087 instructions in sequence.

➢ The 8087 are executed only one instruction at a time so you have to make sure that 8087 has completed one instruction before you allow the 8086 to fetch the next 8087 instruction from memory.

  • Here again you use the BUSY-TEST connection and the FWAIT instruction to solve the problem. If you are hand coding, you can just put the 8086 WAIT(FWAIT) instruction after each instruction to make sure that instruction is completed before going on to next.
  • If you are using the assembler which accepts 8087 mnemonics, the assembler will automatically insert the 8-bit code for the WAIT instruction ,10011011 binary (9BH), as the first byte of the code for 8087 instruction.
 

Module 3 learning unit 9 of Microprocessors and Microcontrollers/Interfacing With 8086 part4.

Interfacing Analog to Digital Data Converters

• In most of the cases, the PIO 8255 is used for interfacing the analog to digital converters with microprocessor.

• We have already studied 8255 interfacing with 8086 as an I/O port, in previous section. This section we will only emphasize the interfacing techniques of analog to digital converters with 8255.

• The analog to digital converters is treaded as an input device by the microprocessor, that sends an initialising signal to the ADC to start the analogy to digital data conversation process. The start of conversation signal is a pulse of a specific duration.

• The process of analog to digital conversion is a slow process, and the microprocessor has to wait for the digital data till the conversion is over. After the conversion is over, the ADC sends end of conversion EOC signal to inform the microprocessor that the conversion is over and the result is ready at the output buffer of the ADC. These tasks of issuing an SOC pulse to ADC, reading EOC signal from the ADC and reading the digital output of the ADC are carried out by the CPU using 8255 I/O ports.

• The time taken by the ADC from the active edge of SOC pulse till the active edge of EOC signal is called as the conversion delay of the ADC.

• It may range any where from a few microseconds in case of fast ADC to even a few hundred milliseconds in case of slow ADCs.

• The available ADC in the market use different conversion techniques for conversion of analog signal to digitals. Successive approximation techniques and dual slope integration techniques are the most popular techniques used in the integrated ADC chip.

• General algorithm for ADC interfacing contains the following steps:

1. Ensure the stability of analog input, applied to the ADC.

2. Issue start of conversion pulse to ADC

3. Read end of conversion signal to mark the end of conversion processes.

4. Read digital data output of the ADC as equivalent digital output.

5. Analog input voltage must be constant at the input of the ADC right from the start of conversion till the end of the conversion to get correct results. This may be ensured by a sample and hold circuit which samples the analog signal and holds it constant for a specific time duration. The microprocessor may issue a hold signal to the sample and hold circuit.

6. If the applied input changes before the complete conversion process is over, the digital equivalent of the analog input calculated by the ADC may not be correct.

ADC 0808/0809 :

• The analog to digital converter chips 0808 and 0809 are 8-bit CMOS, successive approximation converters. This technique is one of the fast techniques for analog to digital conversion. The conversion delay is 100µs at a clock frequency of 640 KHz, which is quite low as compared to other converters. These converters do not need any external zero or full scale adjustments as they are already taken care of by internal circuits. These converters internally have a 3:8 analog multiplexer so that at a time eight different analog conversion by using address lines – ADD A, ADD B, ADD C. Using these address inputs, multichannel data acquisition system can be designed using a single ADC. The CPU may drive these lines using output port lines in case of multichannel applications. In case of single input applications, these may be hardwired to select the proper input.

• There are unipolar analog to digital converters, i.e. they are able to convert only positive analog input voltage to their digital equivalent. These chips do no contain any internal sample and hold circuit.

image

image

Timing Diagram of ADC 0808

Example: Interfacing ADC 0808 with 8086 using 8255 ports. Use port A of 8255 for transferring digital data output of ADC to the CPU and port C for control signals. Assume that an analog input is present at I/P2 of the ADC and a clock input of suitable frequency is available for ADC.

Solution: The analog input I/P2 is used and therefore address pins A,B,C should be 0,1,0 respectively to select I/P2. The OE and ALE pins are already kept at +5V to select the ADC and enable the outputs. Port C upper acts as the input port to receive the EOC signal while port C lower acts as the output port to send SOC to the ADC.

• Port A acts as a 8-bit input data port to receive the digital data output from the ADC. The 8255 control word is written as follows:

image

image

Interfacing 0808 with 8086

Interfacing Digital To Analog Converters

INTERFACING DIGITAL TO ANALOG CONVERTERS: The digital to analog converters convert binary number into their equivalent voltages. The DAC find applications in areas like digitally controlled gains, motors speed controls, programmable gain amplifiers etc.

AD 7523 8-bit Multiplying DAC : This is a 16 pin DIP, multiplying digital to analog converter, containing R-2R ladder for D-A conversion along with single pole double thrown NMOS switches to connect the digital inputs to the ladder.

The pin diagram of AD7523 is shown in fig the supply range is from +5V to+15V, while Vref may be any where between -10V to +10V. The maximum analog output voltage will be any where between -10V to +10V, when all the digital inputs are at logic high state.

Usually a zener is connected between OUT1 and OUT2 to save the DAC from negative transients. An operational amplifier is used as a current to voltage converter at the output of AD to convert the current out put of AD to a proportional output voltage.

It also offers additional drive capability to the DAC output. An external feedback resistor acts to control the gain. One may not connect any external feedback resistor, if no gain control is required.

EXAMPLE: Interfacing DAC AD7523 with an 8086 CPU running at 8MHZ and write an assembly language program to generate a sawtooth waveform of period 1ms with Vmax 5V.

Solution: Fig shows the interfacing circuit of AD 74523 with 8086 using 8255. program gives an ALP to generate a sawtooth waveform using circuit.

image

image

• In the above program, port A is initialized as the output port for sending the digital data as input to DAC. The ramp starts from the 0V (analog), hence AL starts with 00H. To increment the ramp, the content of AL is increased during each execution of loop till it reaches F2H.

• After that the saw tooth wave again starts from 00H, i.e. 0V(analog) and the procedure is repeated. The ramp period given by this program is precisely 1.000625 ms. Here the count F2H has been calculated by dividing the required delay of 1ms by the time required for the execution of the loop once. The ramp slope can be controlled by calling a controllable delay after the OUT instruction.