Microprocessor Systems


Chapter 1 INTRODUCTION TO MICROPROCESSORS A microprocessor is a data processing unit. Data processing includes both computations and data handling. The data processing is done by the ALU. It must have logic to process and handle data and control logic. The control logic tells the microprocessor how to decode and execute the program. Microprocessors operates on the following steps: The microprocessors fetches or gets an instruction The control logic decodes what the instruction says to do. After decoding the microprocessor executes the instruction. These steps are called the fetch and execute cycle. Microcomputer The microcomputer is a complete computing system based on a microprocessor. It has a microprocessor, memory and input/output functions. It also has a power supply and is enclosed in a packaging. A bus connects all the cards in the microcomputer. The bus consists of many single lines that let the different cards “talk” to one another. The microprocessor is on the CPU card. The CPU card has a clock generator that generates timing signal for the microprocessor Power of a Microprocessor This is the capacity of the microprocessor to process data. Three Main Measures of the Power of a Microprocessor: 1. The length of the microprocessor’s data word Word lengths of 4, 8, 16, 32 are common.


Microprocessor Systems


An 8-bit word is called a byte, 16-bit word = 2 bytes, 32-bit word = 4 bytes

















Hi byte

Low byte

A 16-bit word The larger the microprocessor’s word length, the more powerful the microprocessor becomes. 2. The number of memory locations addressed by the microprocessor. The length of the data word in the memory is the same as the length of the data word used by the microprocessor. Each word in a memory is assigned a location number or address. The larger the number of memory addresses, the greater the power of the microprocessor. Word size & memory addressing range & some commonly available microprocessors:
DATA WORD 4-bit 4096 (4K) 8192 (8K) 65,536 (64K) Memory Range address 32,768 (32K) 65,536 (64K) 1,048,576 2,097,152 (1M) 4,194,304 (2M) (4M) 4,294,967,296 34,359,738,367 (46) (326) 8-bit 16-bit 32-bit

3. Speed of the microprocessor. Measured by how long it takes to fetch and execute an instruction. Instruction time and clock frequency are used to describe a microprocessor speed.

Microprocessor Systems


Measured by the time it takes to execute a standard or “benchmark” program. • Benchmark programs are short programs. BASIC MICROPROCESSOR ARCHITECTURAL CONCEPTS Three Major Architectural Differences: 1. Length of data 2. Size of addressable memory 3. Microprocessor’s instruction speed Additional Architectural Differences: Number of registers available to the programmer Different types of instructions available to the programmer Different types of registers available to the programmer Different types of memory addressing modes available to the programmer Different types of support circuits available to the system designer Compatibility with readily available development, system & application software Compatibility with hardware development systems 4-bit Microprocessor Typically used for low-cost consumer applications such as toys, calculators and power tool controllers 8-bit Microprocessor Typically used in more expensive commercial products such as video games and computer peripherals 16-bit, 32-bit, 64-bit Microprocessor • • features very fast operation, extreme computing power can be found on CAD and CAM systems

Speed may be measured in two different ways:

Microprocessors Clock Speed This is the frequency at which the microprocessor’s clock oscillator operates It is expressed in MHz. but draws less power can stand the widest variation in temperature and operating voltage and has the greatest operating speed. GHz 2. The effectiveness of cache memory depends on how many times the processor is able to make a hit in the cache memory.Microprocessor Systems 4 1. Some other Microprocessor Architectural Techniques being used to increase Speed: Parallel Processing An architectural feature which allows two parts of the computation to be performed at the same time. CMOS (Complementary Metal-Oxide Semi-conductor) More complex and therefore more expensive to build. Co-Processing An architectural feature that provides another processor to handle a special function while the microprocessor is doing general-purpose computing. however. which is used to store a section of data so that it can be accessed quickly by the processor. Example: math co-processor Cache Memory Special memory. 2. NMOS (N-Channel Metal-Oxide Semi-conductor) Lowest cost because the device is simple to build. Number of Instructions it can execute per speed expressed in millions of instructions per second (MIPS) Two Semi-conductor Technologies commonly used to make Microprocessors: 1. Pipelining AVROCILLO DCEE/CEIT/CvSU . they consume the most power.

Microprocessor Systems 5 Describes an architectural feature. This means that the process is broken up into sub-steps. which allows the process to be worked on an assembly line fashion. which are then worked on by multiple processors. Chapter 2 AVROCILLO DCEE/CEIT/CvSU .

Instruction Register 8 bit Internal Data Bus Temp 1 IN ALU Temp 2 IN OUT Control Logic Instruction Decoder PC SP MAR Accumulator Status Register Microprocessor Basic Block Diagram AVROCILLO DCEE/CEIT/CvSU . Shows how each of these logic functions are connected to all the others.Microprocessor Systems 6 INSIDE THE MICROPROCESSOR The Microprocessor Block Diagram and Programming Model Microprocessor Block Diagram • • Shows a microprocessor’s logic functions foe data processing and data handling. Makes it easier to understand the architecture of a microprocessor.

Registers 3. An output port is made up of the logic circuits used to get a data word out of a logic device. ALU 2. which the programmer can change. Used to arithmetically or logically change or test data.Microprocessor Systems 7 Programming Model 7 Accumulator A Reg B Reg D Reg H SP PC 15 0 07 Status Reg Reg C Reg E Reg L 0 Assists in the programming process Shows only those parts of the microprocessor. AVROCILLO DCEE/CEIT/CvSU . An input port is made up of the logic circuits used to get a data word into a logic device. each port has a register that temporarily stores one data word holding the word for the ALU. Makes it easier to understand the microprocessor in a programming environment. Three Major Logic Functions of the Microprocessor: 1. Both of the input ports are buffered by a temporary register. Control Logic The ALU or Arithmetic Logic Unit Contains the Microprocessor’s data processing logic Contains two input ports and one output port.

b. 5. Some of the microprocessors have an accumulator. which is twice as long as their data word and have two accumulators that let you do accumulator-toaccumulator arithmetic and logic operations. Program Counter 3. General Purpose Register 6. The program counter’s length must be long enough to address any memory location. Status Register 4. Stack Pointer Accumulator Microprocessor’s major register to hold data for manipulation. Accumulator’s length is the same as that of the microprocessor’s data word. Each program instruction step is then executed in sequence unless a special instruction changes the sequence. Others are a general-purpose register. Some registers serve a special purpose that is they hold data used in a specific job. it always gets its first instruction from the same memory location. The pc has to be loaded up with a number. & Logic 7. The Program Counter Keeps track of what instruction is being used and what the next instructions will be. This number is the address of the memory location containing the first program instruction. a. All Microprocessors have the following basic Registers: 1. Accumulator 2. Accumulator’s content is usually one half of an arithmetic or logic operation.Microprocessor Systems 8 The Microprocessor’s Registers Lets you temporarily store a word or a data. When a microprocessor first starts up. Memory Address Reg. Temporary Register AVROCILLO DCEE/CEIT/CvSU . Instruction Register 8.

Once the instruction is fetched. This happens not only when you decrement the register. Often the data in the status register is used to control how the rest of the program will execute. 2. Some of the Common Status Register Bits are: 1. The memory address register points to each memory location that the microprocessor wants to use when it wants to use it. e. The control logic fetches an instruction from the memory location.Microprocessor Systems 9 c. the microprocessor increments the pc and executes an instruction. Sometimes called a flag register. Carry/Borrow This bit indicates that the last operation caused either a carry or a borrow. Negative AVROCILLO DCEE/CEIT/CvSU . d. The memory address register is long enough to address every memory location in the microprocessor’s main memory. Zero • The zero bit is set when the operation causes all of the register’s bit to be logic zero. The Status Register Used to store the results of certain tests performed during the execution of a program. The memory address register drives the microprocessor’s address bus. The incremented program counter now points to the next program instruction f. The program counter points to a memory location. 3. g. but also when any operation causes the register’s bit all to become logic zero. A borrow is generated when a larger number is subtracted from a smaller number. h. The carry bit is set when two binary numbers are added and generate a carry from the eight bit.

there may be multiple interrupt flags. Z7 N6 C5 I4 IF 3 O2 P1 10 Parity Overflow Interrupt Flag Intermediate Carry Negative Zero Bit AVROCILLO DCEE/CEIT/CvSU . It is cleared when the programmer wants to disable the interrupt function. Parity Is set when the results of an operation leave the indicated register with an odd number of 1’s. 7. 5. Intermediate Carry The status register’s intermediate carry bit is set when an addition in the first four bits caused a carry into the fifth bit. 4. In 2’s complement arithmetic. Interrupt Flag The status register’s interrupt flag is set when the programmer desires to enable the interrupt functions. a logic 1 in the register’s most significant bit means that the number in the register is negative. If the microprocessor has multiple interrupts. This is often referred to as the half carry.Microprocessor Systems 10 The status register’s negative bit is set when a register’s most significant bit is logic 1. It is frequently used to assist in the conversion of BCD numbers into binary numbers. Overflow Is set when both an arithmetic carry and a signed carry occur in 2’s complement arithmetic operations. 6.

00000001 01111111 g). Memory Address Register and Logic Points to the memory location the processor wants to use Hold a binary number. 00111011 11000101 c). a). 00001111 11110000 e). BC. DE &HL When used as a register pair. it is decremented so that it points to the next available location General Purpose Registers Simple storage areas Register pairs. 00001111 00010000 h). 11111111 11111111 d). the two registers act as a single 16-bit register. which is the address of a memory location Does not increment Contents of the memory address register depends on the instruction being executed AVROCILLO DCEE/CEIT/CvSU . indicate how the results sets the bits of the status register.Microprocessor Systems 11 Example: Add the following 8-bit binary numbers. 11000000 10000001 The Stack Pointer Points to the memory location where temporary data is stored. The stack is used to keep information like the return address The programmer pushes (puts) information onto the stack in order and pops (takes) information from the stack in the reverse order Last-in-First-Out (LIFO) operation Each time the stack is used to store data in the stack pointer. 01010100 11001100 b). 00000001 11111110 f).

The microprocessor’s control logic timing comes from the clock The Microprocessor’s Internal Data Bus Data Bus Data path between all the microprocessor’s logic devices All the logic devoices are always connected to the bus Logic devices must wait for a signal from the control logic before they can talk to or listen to the bus Data on the bus moves from source to destination AVROCILLO DCEE/CEIT/CvSU . a copy is taken from the memory location in the program and placed in the instruction register c. b. The instruction register holds the binary word that tells the microprocessor what to do to carry out the current instruction. When the instruction is fetched. the instruction decoder and control logic read the word in the instruction register. Temporary Data Register Holds data The need for the temporary registers arises because the ALU has no data storage of its own Cannot be used by the programmer and is not a part of the programming model The Microprocessors Control Logic Decodes the instruction and tells the other logic devices what to do and in what order to carry out the instruction. During execution.Microprocessor Systems 12 Instruction Register Holds the instruction the microprocessor is currently executing a.

The microprocessor’s instruction are decoded and carried out when an instruction is loaded into the microprocessor’s instruction register by the fetch cycle. During the execute cycle. tells it to perform a certain specific operation. Example: 8-bit microprocessor is 8 bits long 16-bit microprocessor is 16 bits long Any microprocessor may use a number of instruction words to make up a complete instruction. Instruction Set All the instructions the microprocessor knows how to use It is the complete set of instructions that allows the microprocessor to manipulate data by moving it or processing it and to perform housekeeping functions. the instruction decodes and the control logic are used to make the microprocessor perform the function indicated by the instruction. AVROCILLO DCEE/CEIT/CvSU .Microprocessor Systems 13 Chapter 3 MICROPROCESSOR INSTRUCTIONS A Microprocessor Instruction is a unique binary word which. The microprocessor’s instruction word is the same length as its data word. The Microprocessor’s instruction set is the complete collection of all the instructions the instructions the microprocessor knows hoe to perform Its instruction set is unique to that particular model of microprocessor. when interpreted by the microprocessor as an instruction.

Machine Code The actual binary instruction. Second. First. it tells the microprocessor the address of the data or target with the instruction. The op code tells the microprocessor what to do while the address tells the microprocessor where to take the action.Microprocessor Systems 14 Get instruction from memory Decode instruction Execute instruction The Microprocessor’s Fetch/Execute Cycle A microprocessor instruction contains two pieces of information. Mnemonics Is an abbreviation that reminds us of what it stands for Example: CLA LD JMP clear load jump AVROCILLO DCEE/CEIT/CvSU . An instruction can be broken into two parts called the op code (operation code) and the address. It must tell the microprocessor the location of the data to work on. it tells the microprocessor what to do.

n Tells us that the register r is loaded with the value n. The Block Transfer Instructions are used to move a block of data from one set of locations to another set of locations. The source data is copied into the destination. and Exclusive-OR (XOR). which converts mnemonics into machine executable instructions. r’ r in the source. Example: EX DE. Register-to-Register Example: LD r. HL 3. AVROCILLO DCEE/CEIT/CvSU r’` Note: Data in the source is copied into the destination and original data stays . The Exchange Instructions are used to swap data between sets of registers. 2. subtract. add with carry. OR. which is the second word on the instruction. Register-to-Memory and Memory-to -Register Example 1: LD r. Example 2: LD r. The Search Instructions allow the programmer to search a block or memory locations for a particular set of data. Microprocessor’s Basic Instruction types 1. subtract with carry. Data Transfer Instructions allows the programmer to copy data from register to register and between registers and memory locations. The arithmetic and logical instructions allow the programmer to modify the data in a register or sometimes the data in the memory using the arithmetic or logical operators: add. (HL) Tells us that the register r is loaded from the memory location pointed to by the register pair HL. AND.Microprocessor Systems 15 Assembler Computer program.

Example: CPL DI EI NOP HLT A ← A (A 1’s complement) Interrupts Disabled Interrupts Enabled No Operation Halt AVROCILLO DCEE/CEIT/CvSU . the contents of the memory location being pointed to by the HL registered pair. and the contents of the status register’s carry bit (CY) The Arithmetic and Logical Instruction Group also includes instructions.Microprocessor Systems 16 Example: A ADC (HL) A + (HL) + CY Sum of the accumulator’s current contents. The Rotate and Shift Functions allow the programmer to move data to the right or to the left. A rotate instruction is a closed loop instruction wherein the data is moved out at the end and is put back at the other end the shift instruction loses the data that is moved out of the last location. They also include instructions. They perform a simple operation on the data in a single register or on one of the microprocessor’s built in functions. which allow the programmer to compare the value of a register or a memory location to the value in another register or memory location. 4. Example: SLA r = CY 7 0 0 Shift left arithmetic will move the contents of bit 7 (MSB) into the carry bit (CY) 5. The compare instruction only affects the microprocessor status register. which let you. increment or decrement the current value contained in a register or memory location. General-Purpose and CPU Control Instructions usually address the microprocessor itself.

The new starting address is given as part of the jump instruction. Example: Set b. 7. this is an important instruction group when you are working with data from external hardware. Conditional – changes the program counter’s value if the conditional test is met. and Bit Reset Instructions give the programmer the ability to work at the bit level with the data. Bit Set. r rb ← 1 Shows us that we can set any bit b in any register r to logic 1. Example: JMP 101E 101E JMP nn PC ← PC ← nn b. A Subroutine is a short program that runs after the program executes a call instruction. Example: JZ nn (if zero bit is 1) PC ← nn 8. Example: CALL (SP – 1) (SP – 2) PC nn ← ← ← nn nn nn PCH PCL AVROCILLO DCEE/CEIT/CvSU . The Call Instruction is used to start execution of a subroutine. which is in a register. The Bit Test. memory location.Microprocessor Systems 17 6. When you change the program counter’s value. Two Kinds of Jump Instructions: a. you start executing a different part of the program. or other location. Unconditional – simply changes the program counter’s value. The Jump Instructions are used to permanently change the program counter’s value.

Then the program execution begins with the instruction stored in the memory location whose address is located into the PC by the call instruction. Example: RET PCL PCH 9. executing a return instruction loads the program counter with the value saved on the stack. Example: CALL NZ. (n) ← (n) OUT (n) A (n)←A The Microprocessor’s Addressing Modes AVROCILLO DCEE/CEIT/CvSU . Conditional Call instruction – PC is only changed if the condition is met. Example: IN A A. 2.1) (SP . I/O instructions are only used on the microprocessors that have separate I/O capability. This allows the program to continue execution from where it left off.2) PC ← ← PCH ← PCL nn When the value of the program counter is saved on the stack. ← (SP) ← (SP + 1) The Input and Output Instructions are used to move data into and out of the microprocessor’s I/O ports. Two forms of Call Instruction: 1.Microprocessor Systems 18 The call instructions are different from the jump instruction because executing the call instructions save the current program counter value on the stack. nn (SP . Unconditional Call instruction – first the current value of the PC is saved.

The resulting sum is used as a pointer to the address of a memory location. It only requires one word. Indexed addressing only works in microprocessors. the second word is the immediate data to be acted on. 05 AVROCILLO DCEE/CEIT/CvSU . Inherent or Implied The address is contained in the instruction itself. Some manufacturers call 2-byte direct addressing as direct or page addressing while the 3-byte direct addressing as extended direct addressing. The first word is instructions (op code). Example: 3. Example: MOV A. Direct Addressing May use 2 or 3 bytes. Register Indirect Addressing Another single word instruction. The source of the data and the destination of the data are built into the instruction. LD A. Immediate Uses two word instructions. Indexed Addressing Uses a special register called the index register. This is where the data to be operated on the instruction is stored. 5.Microprocessor Systems 19 Addressing modes Are different ways that the microprocessor uses to access memory locations. The instruction indicates which register contains the address of the needed data. The first is the op code. It is done by adding the contents of the indexed addressing instructions’ second byte to the index register’s current contents. 4. which have an index register. the second or third byte are memory address. B NOP ALT 2. 1.

The sum is used as the instruction’s address.Microprocessor Systems 20 8-bit number added to the index register has a range of 60H to FFh is called an offset. however. (IX + n) 6. Relative Addressing Mode Is like indexed addressing. Example: ADD A. This means indexed addressing permits pointing to 256 memory locations without changing the index register value. the data value is added to the program counter’s current value. Chapter 4 AVROCILLO DCEE/CEIT/CvSU .

2. 2 Types of I/O Data Transfer 1. Memory-mapped Accessed using the same process and hardware used to access a memory location. Transfer with Human Slow and must use meaningful symbols such as the alphanumeric character sets. Interface describes the process. Connecting the I/O Port to the Microprocessor 2 Ways the I/O Port can be connected to the microprocessor: 1. However. thus reducing the number of memory locations available. and some are only output ports. One common form of I/O data transfer is called the Programmed Data Transfer. The purpose of the I/O port is to get data into the microprocessor for processing and out of the microprocessor when the processing is complete. For example. Interfacing is the process of making two different systems communicate with each other. but giving the programmer all of the memory handling instructions for handling I/O transfers. which allows things to get into or out of something. data is moved between a data register in the I/O port and a memory location or other storage port. Using a programmed data transfer. it is common to call them I/O ports. Transfer with Machine Can be fast and use coded data. The I/O port simply replaces memory locations. hardware and software used to get data into and out of a microprocessor.Microprocessor Systems 21 COMMUNICATING WITH THE MICROPROCESSOR A port is a hole. a data word at the I/O port may first be transferred into the accumulator and then transferred from the accumulator to a memory location. AVROCILLO DCEE/CEIT/CvSU . Some microprocessor ports are only input ports.

Microprocessor Systems 22 2. servicing the I/O. Is service request bit set? Call the I/O service routine Get I/O 02 status Example of a Polling Routine: Get I/O 03 status register Is service request bit set? Call the I/O service routine AVROCILLO DCEE/CEIT/CvSU Exit . Polling RoutineIs service request bit routine A short program that often checks the I/O port to see if it needs service. Two methods of connecting to and addressing I/O devices 64Kk I/O Port Empty Empty RAM RAM RAM I/O I/O mapped Ports 0K 48K RAM 32K RAM 16K ROM Memory-mapped Polling and R /W Interrupts When the M /W R 1R 0 /W asked to communicate with an I/O port. I/O mapped Use special control lines which memory location or an I/O location. This kind of microprocessor has special instructions to perform I/O data transfers and addressing. Get I/O 01 status register Microprocessor Enter I/O polling routine Microprocessor microprocessor is the microprocessor is 2 Ways on how the Microprocessor can service the I/O devices: 1. If there is a request for service at the I/O port. The memory and I/O devices are controlled by this line and only respond when they are addressed. the polling routine register moves on to the next I/O port until all I/O ports have been tested and those needing service are serviced. If it is Call the I/O service the microprocessor will conduct an I/O service routine and transfer data with the I/O port. It set? checks the I/O port’s status register to see if it is requesting for service.

The microprocessor executes the interrupt service routine that starts at this vector Execute return from the interrupt AVROCILLO DCEE/CEIT/CvSU Continue where interrupted . the microprocessor takes special action tospecial the interrupt. Once an interrupt is received. An current program is a special I/O port on the counter value on stack microprocessor. contents of a service memory address called the interrupt vector Load PC with the A Flow Diagram showing the Interrupt Process . Interrupt Put interrupt input Uses an interrupt input.Microprocessor Systems 23 An interrupt signal is received by the processor Complete current instruction 2. A signal on the interrupt input tells the microprocessor that an external device needs attention.

can supply the microprocessor with the interrupt vector.Microprocessor Systems 24 The interrupt vector is the starting address for the interrupt service routine that is stored at the two special memory locations. with the help of some special logic circuits. there are a number of ways the microprocessor can find out that needs service. The microprocessor can have multiple interrupt inputs. A return instruction is used to exit from the interrupt routine. 1. AVROCILLO DCEE/CEIT/CvSU . one for each interrupting device. The interrupting device. When multiple devices can interrupt the microprocessor. 2.

Chapter 5 INPUT/OUTPUT AND COMPUTER INTERFACING AVROCILLO DCEE/CEIT/CvSU . 1.Microprocessor Systems 25 3. and the microprocessor can poll each of the devices to see which caused the interrupt. which cannot be turned off. each having a different priority. which is used for initialization. 2. All interrupting devices can use the same interrupt input. 3. which is controlled by the programmer. Maskable interrupt. Most microprocessors have 3 different kinds of interrupt inputs. Reset. Nonmaskable interrupt.

These ICs act as intermediate between the microprocessor and the peripheral. They include the READ and WRITE commands and the M/IO signal ( for Intel microprocessors). they control the way the peripheral operates. 3. The user can decide which way the data will flow. Status Lines – these lines transmit status information from the peripheral.Microprocessor Systems 26 Interface ICs Microprocessors do not communicate directly with any of the peripheral devices. Status information tells the microprocessor what is happening within the peripheral. The bus between the microprocessor and the interface IC is consists of three parts: 1. AVROCILLO DCEE/CEIT/CvSU . When deselected. OUT if going to the peripheral) is usually declared at the start of operation and not changed. 3. The interrupts from the peripheral to the microprocessor also use three lines. 2. The direction of data flow (IN if coming to the peripheral. it will not respond to any commands from the microprocessor. 2. Instead they use a special purpose interface IC like the 8255 Programmable Peripheral Interface. It transfers data between the microprocessor and the interface IC. Control Lines – These lines transmit commands to the peripheral. The bus between the interface IC and the peripheral is also consists of three parts: 1. Data Bus – carries the data between the interface IC and the peripheral. Data Bus – this is the 8 or 16-bit bidirectional data bus connected directly to the microprocessor. Chip Select (CS) – used to select the interface IC and should be LOW. Control – these are the signals that control the operation of the microprocessor and the interface IC.

It has 24 lines to connect to external devices AVROCILLO DCEE/CEIT/CvSU . Construct a decoder needed to select the IC. These interface ICs have address inputs that are connected to the LSBs of the address bus and determine which port is selected. Assume the IC has only one CS line. It is most commonly used in parallel interface IC. Example: An interface IC has four registers that occupy locations 8008-800B in a 16-bit address space.Microprocessor Systems 27 Port Addressing A single interface IC contains several ports. The Intel 8255 The Intel 8255 is called a Programmable Peripheral Interface. These ports must have an address to access them. There must be a decoder on the address lines to determine when the address is for the interface IC. Selecting an Interface IC An interface IC is selected or accessed when its CS line goes low.

Microprocessor Systems 28 and an interface to a microprocessor. port C. 8255 Pin Layout (Source: Intel) D0-D7 RD and WR - 8-bit bidirectional data bus signals from the microprocessor that indicate whether the 8255 is being read or written AVROCILLO DCEE/CEIT/CvSU . It has three ports namely port A . port B.

the data coming in from the port A lines can be read in this register. If port A is an output. Port C This register is accessed when A0=0 and A1 = 1. the data to be sent out must be written to the port A register. Chip Select. This pin determines when the port address for the 8255 is present and the 8255 should be accessed. If port A is an input. They select one of the four registers in the 8255.Microprocessor Systems 29 A0 and A1 CS the two LSBs of the address bus. Port B This register is accessed when A0 =1 and A1 = 0. but functions in the same way as the port A register. Control Register This register is accessed when A0 = 1 and A1 = 1. The Control Register for the 8255 AVROCILLO DCEE/CEIT/CvSU . It is the data register for Port A. It controls port C. The 8255 Registers Port A this registers is accessed when A0=0 and A1 = 0. It controls port B.

sets the mode of the 8255. All lines on all ports are either input or output as determined by the word written to the command register. Example: AVROCILLO DCEE/CEIT/CvSU . Mode 1 is the handshaking mode. If bit 7 is a 1. It sets or clears a bit in the port C register. Mode 0 Operation Mode 0 operation is a simple I/O. the command is a bit set command. If bit 7 of the control register is a 0. 1. It is the most commonly used mode.2. D7 D6 D5 D4 D3 D2 D1 D0 Bit 5 and 6 Bit 4 Bit 3 and 0 Bit 2 Bit 1- determine the mode of port A direction bit for port A direction bit for port C mode bit for port B which can only operate in modes 0 or 1 direction bit for port B. Commands are given to the 8255 by writing to the control register. This can be used in mode 1 operation. Mode 2 is the bidirectional data mode. The reset of the bits in the command. Mode 0 is the basic I/O mode where all ports are either input or output. 0. and some of the port C lines are reserved for control functions. the command is in mode set.Microprocessor Systems 30 The 8255 operates in one of three modes.

Input often called the handshaking mode. Either port A or port B (or both) can operate in this mode. it indicates that the 8255 has received data. INTRB are on pins PC2. PC1 and PC0 respectively.Microprocessor Systems 31 The 8255 uses ports 60-63 and is set-up so that ports A and C are used for input and port B is used for output. PC5. STRB. IBFB. but has not processed it. so it can read in the byte and allow the next byte to be sent. The configuration for Port A in input handshaking uses three lines of port C (PC4. It indicates that the peripheral device has a valid byte for the 8255 and has placed it on the port A lines. Some bits of port C are reserved for controlling the flow of information between the 8255 and the peripheral device and may not used for data transmission. AVROCILLO DCEE/CEIT/CvSU . IBFA (Input Buffer Full A) When the IBF is high. The pins for mode 1 input to Port B. The peripheral should not send another byte of data while IBF is high. a) What control word must be sent to the 8255 to set the ports? b) What instructions must be issued to do this? Mode 1 Operation . PC3) STBA (Strobe A) This signal is sent from the peripheral device to the 8255. INTRA (Interrupt) This signal allows port C to interrupt the microprocessor when data has been received.

This indicates to the peripheral that data is available. OBFA (PC7) A write to port A in mode 1 causes OBF to go LOW. Three lines on port C are used to control the data transmission. which is controlled by the peripheral indicates that it has accepted the data and causes OBF to go high. This interrupt will then cause the microprocessor to write the next data byte to the output REFERENCES AVROCILLO DCEE/CEIT/CvSU . interrupt. It will remain HIGH until the microprocessor writes the next byte to the port. the trailing edge of ACK will cause an port. ACKA (PC6) A LOW pulse on the ACK line. INTRA (PC3) If interrupts are used.Microprocessor Systems 32 Mode 1 Operation – Output Handshaking on output can occur when the microprocessor is sending data to a peripheral IC via the 8255 interface.

W. Inc....A..Microprocessor Systems 33 Greenfield. Hardware and Software 5th ed.J. F.. Microprocessors and Microcomputers. Software and Applications. .. 551-576. Regents Prentice Hall.. J. Triebel. Practical Digital Design using ICs 3rd ed. Ambrosio. R. 1994 Tocci. pp. 2nd ed.J. Hardware. Prentice Hall Int’l.D. Interfacing. The 8088 and 8086 Microprocessors Programming. Avtar. 1997 AVROCILLO DCEE/CEIT/CvSU . Prentice Hall International. Inc. Singh..

Sign up to vote on this title
UsefulNot useful