Friday, December 25, 2009

I/O DEVICES Unit 4

The term I/O is used to describe any program, operation or device that transfers data to or from a computer and to or from a peripheral device. Every transfer is an output from one device and an input into another. Devices such as keyboards and mouse are input-only devices while devices such as printers are output-only.


 

Input devices

Purpose

  • Entering data into a computer system
  • Issuing commands (instructions) to a computer
    • Transform data from the user into a form that computer system can process


 

Keyboards

The set of typewriter-like keys that enables you to enter data into a computer. Computer keyboards are similar to electric-typewriter keyboards but contain additional keys. The keys on computer keyboards are often classified as follows:

  • Alphanumeric keys -- letters and numbers
  • Punctuation keys -- comma, period, semicolon, and so on.
  • Special keys -- function keys, control keys, arrow keys, Caps Lock key, and so on.

The standard layout of letters, numbers, and punctuation is known as a QWERTY keyboard because the first six keys on the top row of letters spell QWERTY. The QWERTY keyboard was designed in the 1800s for mechanical typewriters and was actually designed to slow typists down to avoid jamming the keys. Another keyboard design, which has letters positioned for speed typing, is the Dvorak keyboard.

There is no standard computer keyboard, although many manufacturers imitate the keyboards of PCs. There are actually three different PC keyboards: the original PC keyboard, with 84 keys; the AT keyboard, also with 84 keys; and the enhanced keyboard, with 101 keys. The three differ somewhat in the placement of function keys, the Control key, the Return key, and the Shift keys.


 

MOUSE

A mouse is a small hand-held box used to position the screen cursor. Wheels or rollers on the bottom of the mouse can be used to record the amount and direction of movement. Another method for detecting the mouse motion is with an optical sensor. For these systems, the mouse is moved over a special mouse pad that has a grid of horizontal and vertical lines. The optical sensor detects movement across the lines in the grid.

It is used for making relative changes in the position of the screen cursor. One, two or three buttons are usually included on the top of the mouse for signaling the execution of some operation, such as recording cursor position or invoking a function.

Additional device can be included in the basic mouse design to increase the number of allowable input parameters. The Z mouse includes three buttons, a thumbwheel on the side, a track ball on the top and a standard mouse ball underneath. This design provides six degrees of freedom to select spatial positions, rotations and other parameters.


 

TRACKBALL

A trackball is a ball that can be rotated with the fingers or palm of the hand to produce screen-cursor movement. Potentiometers attached to the ball, measure the amount and direction of rotation. Trackballs are often mounted on keyboards or other devices such as Z mouse.


 

JOYSTICKS

A joystick consists of small, vertical lever (stick) mounted on a base that is used to steer the screen cursor around. Most joysticks select the screen positions with actual stick movement and others respond to pressure on the stick. Some joysticks are mounted on a keyboard and others function as stand-alone units.

The distance that the stick is moved in any direction from its center position corresponds to screen-cursor movement in that direction. Potentiometers mounted on the base of the joystick measure the mount of movement, and springs return the stick to the center position when it is released.


 

DATA GLOVE

A data glove is an interactive device, resembling a glove worn on the hand, which facilitates tactile sensing and fine-motion control in robotics and virtual reality. Data gloves are one of several types of electro-mechanical devices used in hepatics applications.

Tactile sensing involves simulation of the sense of human touch and includes the ability to perceive pressure, linear force, torque, temperature, and surface texture. Fine-motion control involves the use of sensors to detect the movements of the user's hand and fingers, and the translation of these motions into signals that can be used by a virtual hand (for example, in gaming) or a robotic hand (for example, in remote-control surgery).


 

LIGHT PEN

A light pen is a computer input device in the form of a light-sensitive wand used in conjunction with the computer's CRT monitor. It allows the user to point to displayed objects, or draw on the screen, in a similar way to a touch screen but with greater positional accuracy. A light pen can work with any CRT-based monitor, but not with LCD screens, projectors and other display devices.

A light pen is fairly simple to implement. The light pen works by sensing the sudden small change in brightness of a point on the screen when the electron gun refreshes that spot. By noting exactly where the scanning has reached at that moment, the X,Y position of the pen can be resolved. This is usually achieved by the light pen causing an interrupt, at which point the scan position can be read from a special register, or computed from a counter or timer. The pen position is updated on every refresh of the screen.


 

GRAPHICS TABLET

A graphics tablet (or digitizing tablet, graphics pad, drawing tablet[1]) is a computer input device that allows one to hand-draw images and graphics, similar to the way one draws images with a pencil and paper.

A graphics tablet consists of a flat surface upon which the user may "draw" an image using an attached stylus, a pen-like drawing apparatus. The image generally does not appear on the tablet itself but, rather, is displayed on the computer monitor.

Some tablets are intended as a general replacement for a mouse as the primary pointing and navigation device for desktop computers.


 

TOUCH PANEL(touch screens)

Touchpanels are displays which also have the ability to detect the location of touches within the display area. This allows the display to be used as an input device, removing the keyboard and/or the mouse as the primary input device for interacting with the display's content. Such displays can be attached to computers or, as terminals, to networks. Touchscreens also have assisted in recent changes in the design of personal digital assistant (PDA), satellite navigation and mobile phone devices, making these devices more usable.


 

Output devices

Purpose

It is a device, which is used to communicate the result of data processing carried out by the user or CPU.

Examples


 


 

PRINTERS

A computer printer, or more commonly a printer, produces a hard copy (permanent human-readable text and/or graphics) of documents stored in electronic form, usually on physical print media such as paper or transparencies. Many printers are primarily used as local computer peripherals, and are attached by a printer cable to a computer which serves as a document source. Some printers, commonly known as network printers, have built-in network interfaces (typically wireless or Ethernet), and can serve as a hardcopy device for any user on the network. Individual printers are often designed to support both local and network connected users at the same time.


 

TYPES OF PRINTERS    

Impact Printers

Printers that transfer the image onto paper by pressing the formed character faces against an inked ribbon.


 

Daisy wheel
printers

Daisy-wheel printers operate in much the same fashion as a typewriter. A hammer strikes a wheel with petals (the daisy wheel), each petal containing a letter form at its tip. The letter form strikes a ribbon of ink, depositing the ink on the page and thus printing a character. By rotating the daisy wheel, different characters are selected for printing.

These printers were also referred to as letter-quality printers because, during their heyday, they could produce text which was as clear and crisp as a typewriter (though they were nowhere near the quality of printing presses). The fastest letter-quality printers printed at 30 characters per second.


 

Dot-matrix printers

In the general sense many printers rely on a matrix of pixels, or dots, that together form the larger image. However, the term dot matrix printer is specifically used for impact printers that use a matrix of small pins to create precise dots. The advantage of dot-matrix over other impact printers is that they can produce graphical images in addition to text; however the text is generally of poorer quality than impact printers that use letterforms (type).

Dot matrix printers can either be character-based or line-based (that is, a single horizontal series of pixels across the page), referring to the configuration of the print head.

At one time, dot matrix printers were one of the more common types of printers used for general use - such as for home and small office use. Such printers would have either 9 or 24 pins on the print head. 24-pin print heads were able to print at a higher quality. Once the price of inkjet printers dropped to the point where they were competitive with dot matrix printers, dot matrix printers began to fall out of favor for general use.

Some dot matrix printers, such as the NEC P6300, can be upgraded to print in color. This is achieved through the use of a four-color ribbon mounted on a mechanism (provided in an upgrade kit that replaces the standard black ribbon mechanism after installation) that raises and lowers the ribbons as needed. Color graphics are generally printed in four passes at standard resolution, thus slowing down printing considerably. As a result, color graphics can take up to four times longer to print than standard monochrome graphics, or up to 8-16 times as long at high resolution mode.


 

Line printers

Line printers, as the name implies, print an entire line of text at a time. Three principal designs existed. In drum printers, a drum carries the entire character set of the printer repeated in each column that is to be printed. In chain printers (also known as train printers), the character set is arranged multiple times around a chain that travels horizontally past the print line. In either case, to print a line, precisely timed hammers strike against the back of the paper at the exact moment that the correct character to be printed is passing in front of the paper. The paper presses forward against a ribbon which then presses against the character form and the impression of the character form is printed onto the paper.

Comb printers represent the third major design. These printers were a hybrid of dot matrix printing and line printing. In these printers, a comb of hammers printed a portion of a row of pixels at one time (for example, every eighth pixel). By shifting the comb back and forth slightly, the entire pixel row could be printed (continuing the example, in just eight cycles). The paper then advanced and the next pixel row was printed. Because far less motion was involved than in a conventional dot matrix printer, these printers were very fast compared to dot matrix printers and were competitive in speed with formed-character line printers while also being able to print dot-matrix graphics.

Line printers were the fastest of all impact printers and were used for bulk printing in large computer centres. They were virtually never used with personal computers and have now been replaced by high-speed laser printers.


 

Non-impact Printers

Printers that produce images and characters on to the paper by using laser techniques, electrostatic methods and electro thermal methods.


 

Laser Printer

In a Laser printer, a laser beam creates a charge distribution on a rotating drum coated with a photoelectric material such as selenium. The drum is rolled through a toner, which is very fine positively charged black powder that will be attracted by the points of negative charge on the drum surface. After the full rotation the drum's surface contains the whole of the required black image. Finally using a combination of heat and pressure the ink on the drum is transferred onto the page.


 

Inkjet Printer

In an inkjet printer, outputs are produced by squirting ink in horizontal rows across a roll of paper wrapped on a drum. The electrically charged ink stream is deflected by an electric field to produce dot-matrix patterns. It is capable of producing high quality print, which almost matches the quality of a laser printer. It has a resolution of 300 dots per inch.


 

SCANNING

Definition

It is the process of moving a finely focused beam of light or electrons in a systematic pattern over a surface in order to reproduce or sense and subsequently transmit an image.

Scanning Methods

1) RASTER SCAN

2) RANDOM SCAN

Raster Scan

In a raster-scan system, the electron beam is swept across the screen, one row at a time from top to bottom. As the electron beam move across each row, the beam intensity is turned on and off to create a pattern of illuminated spots. Picture definition is stored in a memory area called the refresh buffer and frame buffer. This memory area stores the intensity values of for all the screen points. Stored intensity values are then retrieved from the refresh buffer and painted on the screen one row at a time. Each screen point is referred to as a pixel (picture element). The capability of a raster scan system to store intensity information for each screen points make well suited for the realistic display of scenes containing subtle shadings and color patterns.

Intensity range for pixel positions depends on the capability of the raster system. In a simple black and white system, each screen point is either on or off, so only one bit per pixel is needed to control the intensity of screen positions .For a bi-level system, a bit value of "1" indicates that the electron beam is to be turned on at that position and a value of "0" indicates that the beam intensity is to be off. Additional bits are needed when color and intensity variations can be displayed.


 

Refreshing on raster-scan displays is carried out at the rate of 60 to 30 frames per second. Sometimes refresh rates are described in units of cycles per second or Hertz, where a cycle corresponds to one frame. At the end of each scan line, the electron beam returns to the left side of the screen to begin displaying the next scan line. The return to the left of the screen, after refreshing each scan line is called the "Horizontal retrace". At the end of each frame the electron beam returns to the top left corner of the screen to begin the next frame. This is called as "Vertical retrace".

Random Scan

When operated as a random-scan display unit, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn. Random scan monitors draw a picture one line at a time and for this reason are also referred to as vector displays (or stroke-writing or calligraphic displays). The component lines of a picture can be drawn and refreshed by a random-scan system in any specified order (Fig. 2-9). A pen plotter operates in a similar way and is an example of a random-scan, hard-copy device.

Refresh rate on a random-scan system depends on the number of lines to be displayed. Picture definition is now stored as a set of line-drawing commands in an area of memory referred to as the refresh display file. Sometimes the refresh display file is called the display list, display program, or simply the refresh buffer. To display a specified picture, the system cycles through the set of commands in the display file, drawing each component line in turn. After all line drawing commands have been processed, the system cycles back to the first line command in the list. Random-scan displays are designed to draw all the component lines of a picture 30 to 60 times each second. High-quality vector systems are capable of handling approximately 100,000 "short" lines at this refresh rate. When a small set of lines is to be displayed, each refresh cycle is delayed to avoid refresh rates greater than 60 frames per second. Other wise, faster refreshing of the set of lines could burn out the phosphor.


 

Random-scan systems are designed for line-drawing applications and cannot display realistic shaded scenes. Since picture definition is stored as a set of line-drawing instructions and not as a set of intensity values for all screen points, vector displays generally have higher resolution than raster systems. Also, vector, displays produce smooth line drawings because the CRT beam directly follows the line path. A raster system, in contrast, produces jagged lines that are plotted as discrete point sets.


 

CRT

The primary components of an electron gun in a CRT are the heated metal cathode and a control grid (Fig. 2-3). Heat is supplied to the cathode by directing a current through a coil of wire, called the filament, inside the cylindrical cathode structure. This causes electrons to be "boiled off" the hot cathode surface. In the vacuum inside the CRT envelope, the free, negatively charged electrons are then accelerated toward the phosphor coating by a high positive voltage. The accelerating voltage can be generated with a positively charged metal coating on the inside of the CRT envelope near the phosphor screen or an accelerating anode can be used, as in Fig. 2-3. Sometimes the electron gun is built to contain the accelerating anode and focusing system within the same unit.

Intensity of the electron beam is controlled by setting voltage levels on the control grid,, which is a metal cylinder that fits over the cathode. A high negative voltage applied to the control grid will shut off the beam by repelling electrons and stopping them from passing through the small hole at the end of the control grid structure. A smaller negative voltage on the control grid simply decreases the number of electrons passing through. Since the amount of light emitted by the phosphor coating depends on the number of electrons striking the screen, we control the brightness of a display by varying the voltage on the control grid. We specify the intensity level for individual screen positions with graphics software commands, as discussed in Chapter 3.

The focusing system in a CRT is needed to force the electron beam to converge into a small spot as it strikes the phosphor. Otherwise, the electrons would repel each other, and the beam would spread out as it approaches the screen. Focusing is accomplished with either electric or magnetic fields. Electrostatics focusing is commonly used in television and computer graphics monitors. With electrostatic focusing, the electron beam passes through a positively charged metal cylinder that forms an electrostatic lens, as shown in Fig. 2-3. The action of the electrostatic lens focuses the electron beam at the center of the screen, in exactly the same way that an optical lens focuses a beam of light at a particular focal distance. Similar lens focusing effects can be accomplished with a magnetic field set up by a coil mounted around the outside of the CRT envelope. Magnetic lens focusing produces the smallest spot size on the screen and is used in special purpose devices.


 

Additional focusing hardware is used in high-precision systems to keep the beam in focus at all screen positions. The distance that the electron beam must travel to different points on the screen varies because the radius of curvature for most CRTs is greater than the distance from the focusing system to the screen center. Therefore, the electron beam will be focused properly only at the center of the screen. As the beam moves to the outer edges of the screen, displayed images become blurred. To compensate for this, the system can adjust the focusing according to the screen position of the beam.

As with focusing, deflection of the electron beam can be controlled either with electric fields or with magnetic fields. Cathode-ray tubes are now commonly constructed with magnetic deflection coils mounted on the outside of the CRT envelope, as illustrated in Fig. 2-2. Two pairs of coils are used, with the coils in each pair mounted on opposite sides of the neck of the CRT envelope. One pair is mounted on the top and bottom of the neck, and the other pair is mounted on opposite sides of the neck. The magnetic field produced by each pair of coils results in a transverse deflection force that is perpendicular both to the direction of the magnetic field and to the direction of travel of the electron beam. Horizontal deflection is accomplished with one pair of coils, and vertical deflection by the other pair. The proper deflection amounts are attained by adjusting the current through the coils. When electrostatic deflection is used, two pairs of parallel plates are mounted inside the CRT envelope. One pair of plates is mounted horizontally to control the vertical deflection, and the other pair is mounted vertically to control horizontal deflection (Fig. 2-4).

Spots of light are produced on the screen by the transfer of the CRT beam energy to the phosphor. When the electrons in the beam collide with the phosphor coating, they are stopped and their kinetic energy is absorbed by the phosphor. Part of the beam energy s converted by friction into heat energy, and the remainder causes electrons in the phosphor atoms to move up to higher quantum-energy levels. After a short time, the "excited" phosphor electrons begin dropping back to their stable ground state, giving up their extra energy as small quantum of light energy. What we see on the screen is the combined effect of all the electron light emissions: a glowing spot that quickly fades after all the excited phosphor electrons have returned to their ground energy level. The frequency (or color) of the light emitted by the phosphor is proportional to the energy difference between the excited quantum state and the ground state.

Different kinds of phosphors are available for use in a CRT. Besides color, a major difference between phosphors is their persistence: how long they continue to emit light (that is, have excited electrons returning to the ground state) after the CRT beam is removed. Persistence is defined as the time it takes the emitted light from the screen to decay to one-tenth of its original intensity. Lower-persistence phosphors require higher refresh rates to maintain a picture on the screen without flicker. A phosphor with low persistence is useful for animation; a high-persistence phosphor is useful for displaying highly complex, static pictures. Although some phosphors have persistence greater than 1 second, graphics monitors are usually constructed with persistence in the range from 10 to 60 microseconds.

Figure 2-5 shows the intensity distribution of a spot on the screen. The intensity is greatest at the center of the spot, and decreases with a Gaussian distribution out to the edges of the spot. This distribution corresponds to the cross-sectional electron density distribution of the CRT beam.

The maximum number of points that can be displayed without overlap on a CRT is referred to as the resolution. A more precise definition of resolution is the number of points per centimeter that can be plotted horizontally and vertically, although it is often simply stated as the total number of points in each direction. Spot intensity has a Gaussian distribution (Fig. 2-5), so two adjacent spots will appear distinct as long as their separation is greater than the diameter at which each spot has an intensity of about 60 percent of that at the center of the spot. This overlap position is illustrated in Fig. 2-6. Spot size also depends on intensity. As more electrons are accelerated toward the phosphor per second, the CRT beam diameter and the illuminated spot increase. In addition, the increased excitation energy tends to spread to neighboring phosphor atoms not directly in the path of the beam, which further increases the spot diameter. Thus, resolution of a CRT is dependent on the type of phosphor, the intensity to be displayed, and the focusing and deflection systems. Typical resolution on high-quality systems is 1280 by 1024, with higher resolutions available on many systems. High resolution systems are often referred to as high-definition systems. The physical size of a graphics monitor is given as the length of the screen diagonal, with sizes varying from about 12 inches to 27 inches or more. A CRT monitor can be attached to a variety of computer systems, so the number of screen points that can actually be plotted depends on the capabilities of the system to which it is attached.

Another property of video monitors is aspect ratio. This number gives the ratio of vertical points to horizontal points necessary to produce equal-length lines in both directions on the screen. (Sometimes aspect ratio is stated in terms of the ratio of horizontal to vertical points.) An aspect ratio of 3/4 means that a vertical line plotted with three points has the same length as a horizontal line plotted with four points.

auxiliary memory

Magnetic disks

A magnetic disk is a circular plate constructed of metal or plastic coated with magnetized material. Often both sides of the disk are used and several disks may be stacked on one spindle with read/write heads available on each surface. All disks rotate together at high speed are not stopped or started for access purposes. Bits are stored in the magnetized surface in spots along concentric circles called tracks. The tracks are commonly divided into sections called sectors.


 


 


 


 


 


 


 


 

Some units use a single read/write head for each disk surface. In this type of unit, the track address bits are used by a mechanical assembly to move the head into the specified track position before reading or writing .In other disk systems, separate read/write heads are provided for each track in each surface. The address bits can than select a particular track electronically through a decoder circuit.

Permanent timing tracks are used in disks to synchronize the bits and recognize the sectors. A disk system is addressed by address bits that specify the disk number, the disk surface, the sector number and the track within the sector. After the read/write heads are positioned in the specified track, the system has to wait until the rotating disks reaches the specified sector under the read/write head. Information transfer is very fast once the beginning of a sector has been reached. Disks may have multiple heads and simultaneous transfer of bits from several tracks at the same time.

A track in a given sector near the circumference is longer than a track nears the center of the disk. If bits are recorded with equal density, some tracks will contain more recorded bits than others. To make all the records in a sector of equal length, some disks use a variable recording density with higher density on tracks near the center than on tracks near the circumference. This equalizes the number of bits on all tracks of a given sector.

magnetic tape

A magnetic tape transport consists of the electrical, mechanical and electronic components to provide the parts and control mechanism for a magnetic-tape unit. The tape itself is a strip of plastic coated with a magnetic recording medium. Bits are recorded as magnetic spots on the tape along several tracks. Usually, seven or nine bits are recorded simultaneously to form a character together with a parity bit. Read/write heads are mounted one in each track so that data can be recorded and read as a sequence of characters.

Magnetic tape units can be stopped, started to move forward or in reverse, or can be rewound. However they cannot be started or stopped fast enough between individual characters. For this reason, information is recorded in blocks referred to as records. Gaps of unrecorded tape are inserted between records where the tape can be stopped. The tape starts moving while in a gap and attains its constant speed by the time it reaches the next record. Each record on tape has an identification bit pattern at the beginning, the tape control identifies the record number. By reading the bit pattern at the end of the record, the control recognizes the beginning of a gap. A tape unit is addressed by specifying the record number and the number of characters in the record. Records may be of fixed or variable length.

Computer System Architecture Unit 5

Hardware layer

The hardware of the computer is usually divided into three major parts, the central processing unit (CPU) contains an arithmetic and logic unit for manipulating data, a number of registered for storing data, and control circuits for fetching and executing instructions. The memory of a computer contains storage for instructions and data. It is called a random access memory (RAM) because the CPU can access any location in memory at random and retrieve the binary information within a fixed interval of time.

The input and output processor (IOP) contains electronic circuits for communicating and

Controlling the transfer of information between the computer and the outside world. The input and output devices connected to the computer include keyboards, printers, terminals, magnetic disk drives, and other communication devices.

Computer Organization is concerned with the hardware components operate and the way they connected together to form a computer system.

Computer Architecture is concerned with the structure and behavior of the computer. It includes the information formats, the instruction set, and the techniques for addressing memory. The architectural design of the system is concerned with the specifications of the various functional modules, such as processors and memories, and structuring them together into computer system.

Input-Output Interface

Peripherals are electromechanical and electromagnetic devices and their manner of operation is different from the operation of the CPU and memory, which are electronic devices. The data transfer rate of peripherals is usually slower than the transfer rate of the CPU. The operating modes of peripherals are different from each other and must be controlled so as not to disturb the operation of other peripherals connected to the CPU.

To resolve these differences, computer systems include special hardware components between the CPU and peripherals to supervise and synchronize all inputs and output transfers. These components are called interface units because they interface between the processor bus and the peripheral device.


 

I/O Bus and Interface Modules

Each peripheral has its own controller that operates the particular electromechanical device. For example, the printer controller controls the paper motion, the print timing, and the selection of printing characters. The I/O bus from the processor is attached to all peripheral interfaces. To communicate with the particular device, the processor places a device address on the address lines. When the interface detects its own address, it activates a path between the bus lines and the device that it controls. The address is available in the address lines; the processor provides a function code in the control lines.

The interface selected responds to the function code and proceeds to execute it. The function code is referred to as an I/O Command. There are four types of commands that an interface may receive.

A control command is issued to activate the peripheral and to inform it what kind of operation to do.

A status command is used to test various status conditions in the interface and the peripherals.

A data output command causes the interface to respond by transferring data from the bus into one of its registers.

A data input command interface receives an item of data from the peripherals and places it in its buffer register.


 


 

Modes of Tranfer

Binary information received from external devices is usually stored in memory for later processing. The CPU merely executes the I/O instructions and may accept data temporarily, but the ultimate source or destination is the memory unit. Data transfer between the central computer and I/O devices may be handled in variety of modes.

Some modes use the CPU as an intermediate path; others transfer the data directly to and from the memory unit. Data transfer to and from peripherals may be handled in one of three possible modes:

    

•Programmed I/O

•Interrupt-initiated I/O

•Direct Memory Access (DMA)


 

Overview

I/O Techniques

No Interrupts

Uses of Interrupts
 

I/O-to-memory transfer

Through processor

Programmed I/O 

Interrupt-driven I/O 

Direct I/O-to-memory

Transfer

---------- 

Direct memory access

(DMA). 


 

The following flowchart gives an example of the use of programmed I/O to read in a block of data from a peripheral device (e.g., a record from tape) into memory. Data are read in one word (e.g., 16 bits) at a time. For each word that is read in, the processor must remain in a status-checking cycle unit it determines that the word is available in the I/O module's data register. This flowchart highlights the main disadvantage of this technique: It is a time-consuming process that keeps the processor busy.


 

        Programmed I/O


 


 


 


 


 


 


 

                    


 


 


 


 


 


 


 

Programmed I/O


 

In the programmed I/O method, the I/O device does not have direct access to memory. Transferring data under program control requires constant monitoring of the peripheral by the CPU. In the programmed I/O method, the CPU stays in a program loop until the I/O unit indicates that it is ready for data transfer.

Each byte is read into a CPU register and then transferred to memory with a store instruction. A common I/O programming task is to transfer a block of words from an I/O device and store them in a memory buffer.

The programmed I/O method is particularly useful in small low-speed computers or in systems that are dedicated to monitor a device continuously.


 

Interrupt-initiated I/O

An alternative to the CPU constantly monitoring the flag is to let the interface inform the computer when it is ready to transfer data.
This mode of transfer uses interrupt facility. The CPU responds to the interrupt signal by storing the return address from the program counter into a memory stack and then control branches to a service routine that processes the required I/O transfer. The way that the processor chooses the branch address of the service routine varies from one unit to another.


 

In principle, there are two methods, vectored interrupt and non-vectored interrupt.

In non-vectored interrupt, the branch address is assigned to a fixed location in memory.

In vectored interrupt, the source that interrupts supplies the branch information to the computer.

The following flowchart shows the use of interrupt I/O for reading in a block of data. Compare this with programmed I/O. Interrupt I/O is more efficient than programmed I/O because it eliminates needless waiting. However, interrupt I/O still consumes a lot of processor time, because every word of data that goes from memory to I/O module or from I/O module to memory must pass through the processor.


 

When an I/O device completes an I/O operation, the following sequence of hardware events occurs:


 

  1. The device issues an interrupt signal to the processor.
  2. The processor finishes execution of the current instruction before responding to the interrupt
  3. The processor tests for an interrupt, determines that there is one, and sends an acknowledgment signal to the device that issued the interrupt. The acknowledgement allows the device to remove its interrupt signal.
  4. The processor now needs to prepare to transfer control to the interrupt routine. To begin, it needs to save information needed to resume the current program at the point of interrupt. The minimum information required is (a) the status of the processor, which is contained in a register called the program status word (PSW), and (b) the location of the next instruction to be executed, which is contained in the program counter.
  5. The processor now loads the program counter with the entry location of the interrupt-handling program that will respond to this interrupt. If there is more than one interrupt-handling routine, the processor must determine which one to invoke. This information may have been included in the original interrupt signal, or the processor may have to issue a request to the device that issued the interrupt to get a response that contains needed information.
  6. At this point, the program counter and PSW relating to the interrupted program have been saved on the system stack. The contents of the processor registers need to saved, because the interrupt handler may use these registers. So all these values, plus any other state information, need to be saved. The interrupt handler will begin by saving the contents of registers on the stack.
  7. The interrupt handler next processes the interrupt. This includes an examination of status information relating to the I/O operation or other event that caused an interrupt.
  8. When interrupt processing is complete, the saved register values are retrieved from the stack and restored to the registers
  9. The final act is to restore the PSW and program counter values from the stack. As a result, the next instruction to be executed will be from the previously interrupted program.


 

Thus the interrupt can occur at any time and therefore at any point in the execution of the user program.


 


 


 


 


 


 


 


 

        Interrupt-Driven I/O


 


 


 


 


 


 


 


 


 

                


 


 


 


 


 


 


 


 


 

Direct memory Access (DMA)

During DMA transfer, the CPU is idle and has no control of the memory buses.

DMA controller takes over the buses to manage the transfer directly between the I/O device and memory. The CPU may be placed in an idle state in a variety of ways. One common method is to disable the buses through special control signals.


 


 


 

        CPU bus signals for DMA transfer


 


 


 


 

The bus request (BR) input is used by the DMA controller to request to control of the buses. When this input is active, the CPU terminates the execution of the current instruction and places the address bus, the data bus and read and writes lines into a high-impedance state. The high-impedance state behaves like an open circuit, which means that the output is disconnected and does not logic significance. The CPU activates the bus grant (BG) output to inform the external DMA that the buses are in high-impedance state. When the DMA takes control of the bus system, it communicates directly with the memory. The data transfer may be done directly between the device and memory under control of DMA.


 


 


 

                        


 


 

DMA transfer is very useful in many applications. It is used for fast transfer of information between magnetic disks and memory. It is also useful for updating the display in an interactive terminal. Typically, an image of the screen display of the terminal is kept in memory, which can be updated under program control. The contents of the memory can be transferred to the screen periodically by means of DMA transfer.


 

This diagram shows the block diagram of a typical DMA controller. The Unit communicates with the CPU via the data bus and control lines. The CPU through the address bus selects the registers in the DMA by enabling the DS (DMA select) and RS (register select) inputs. The RD (read) and WR (write) inputs are bidirectional. When the BG (bus grant) input is 0, the CPU can communicate with the DMA registers through the data bus to read from or write to the DMA registers. When BG = 1, the CPU has relinquished the buses and DMA can communicate directly with the memory by specifying an address in the address bus and activating the RD or WR control.

The DMA controller has three registers: an address register, a word count register, and a control register. The address register contains an address to specify the desired location in memory. The address bits go through bus buffers into the address bus. The CPU can read from or write into the DMA registers under program control via the data bus.


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 

                            


 


 


 


 


 


 


 


 

        DMA transfer in a computer system


 


 


 


 


 


 


 


 


 


 


 


 

DMA transfer


From the above diagram, the CPU communicates with the DMA through the address and data buses as with any interface unit. The DMA has its own address, which activates the DS and RS lines. The CPU initializes the DMA through the data bus. Once the DMA receives the start control command, it can start the transfer between the peripheral device and the memory.

    When the peripheral device sends a DMA request, the DMA controller activates the BR line, informing the CPU to relinquish the buses. The CPU responds with its BG line, informing the DMA that its buses are disabled. The DMA then puts the current value of its address register into the address bus, initiates the RD or WR signal, and sends a DMA acknowledge to the peripheral device. Note that the RD and WR lines in the DMA controller are bi-directional. The direction of transfer depends on the status of the BG line.

    When BG = 0, the RD and WR are input lines allowing the CPU to communicate with the internal DMA registers.

    When BG = 1, the RD and WR are output lines from the DMA controller to the random-access memory to specify the read or write operation for the data.

When the peripheral device receives a DMA acknowledge, it puts a word in the data bus (for write) or receives a word from the data bus (for read). Thus the DMA controls the read or write operations and supplies the address for the memory. For each word that is transferred, the DMA increments its address registers and decrements its word count registers.

If the word count does not reach zero, the DMA checks the request line coming from the peripheral. For a high-speed device, the line will be active as soon as the pervious transfer is completed. If the peripheral speed is slower, the DMA request line may come somewhat later.

If the word count register reaches zero, the DMA stops any further transfer and removes its bus request. It also informs the CPU of the termination by means of an interrupt.

When the CPU responds to the interrupt, it reads the content of the word count register. The zero value of this register indicates that all the words were transferred successfully. The CPU can read this register at any time to check the number of words already transferred.


 


 


 


 


 


 

I/O Processor (IOP)

The IOP is similar to a CPU except that it is designed to handle the details of I/O processing. IOP instructions are designed to facilitate I/O transfers. It can perform other processing task, such as arithmetic, logic, branching, and code translation.


 


 


 


 


 


 

The block diagram of a computer with two processors is shown above. The memory unit occupies a central position and can communicate with each processor by means of direct memory access. The CPU is responsible for processing data needed for computational tasks. The data formats of peripheral devices differ from memory and CPU data formats. Data are gathered in the IOP at the device rate and bit capacity while the CPU is executing its own program. The communication between the IOP and the devices attached to it is similar to the program control method of transfer. The way by which the CPU and IOP communicate depends on the level of the sophistication included in the system. In most computer systems, the CPU is the master while the IOP is a slave processor.

Instructions that are read from memory by an IOP are sometimes called commands, to distinguish them from instructions that are read by the CPU. Otherwise, an instruction and a command have similar functions. Commands are prepared by experienced programmers and are stored in memory. The command words constitute the program for the IOP. The CPU informs the IOP where to find the commands in memory when it is time to execute the I/O program.


 


 


 

CPU-IOP Communication

The communication between CPU and IOP may take different forms, depending on the particular computer considered. The CPU sends an instruction to test the IOP path.

The IOP responds by inserting a status word in memory for the CPU to check.

The CPU refers to the status word in memory to decide what to do next.

The IOP takes care of the data transfers between several I/O units and the memory while the CPU is processing another program


 

                CPU-IOP communication


 


 

     CPU Operation                 IOP Operation


 


 


 

    


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 

    Continue

The sequence of operations may be carried out as shown in the above flowchart. The CPU sends an instruction to test the IOP path. The IOP responds by inserting a status word in memory for the CPU to check. The bits of the status word indicate the condition of the IOP and I/O device, such as IOP overload condition, device busy with another transfer, or device ready for I/O transfer.


 

The CPU refers to the status word in memory to decide what to next.

The CPU sends the instruction to start I/O transfer.

The memory address received with this instruction tells the IOP where to find its program.

The CPU can now continue with another program while the IOP is busy with the I/O program.

Both programs refer to memory by means of DMA transfer.

When the IOP terminates the execution of its program, its sends the interrupt request to the CPU.

The CPU responds to the interrupt by issuing an instruction to read the status from the IOP.

The IOP responds by placing the contents of its status report into the specified location.

The status word indicates whether the transfer has been completed or if any errors occurred during the transfer.

The IOP takes care of all data transfers between several I/O units and the memory while the CPU is processing another program.


 

I/O Interrupts

External interrupts come from input-output (I/O) devices, from timing devices, from a circuit monitoring the power supply, or from any other external source.

For example external interrupts are I/O device requesting transfer of data, I/O finished transfer of data, elapsed time of an event, or power failure. Timeout interrupt may result from a program that is in an endless loop and thus exceeded its time allocation.

Power failure interrupt may have its service routine a program that transfers the state of the CPU into a nondestructive memory in the few milliseconds before power ceases