Input/Output • A computer system has three major components: CPU Memories (primary and secondary) I/O (Input/Output) equipment • • • • printers scanners modems etc. Buses Physically, most PCs have a structure similar to that shown on the next slide. The PC contains a metal box with a large printed circuit board (the motherboard) at the bottom. The motherboard contains: • • • • • CPU chip Slots for DIMM modules Various support chips A bus etched along its length (maybe two) Sockets into which the edge connectors of I/O boards can be inserted. Physical Structure of a PC Buses Each I/O device consists of two parts: • the controller, which contains most of the electronics • the I/O device itself The controller is usually on a board plugged into a free slot, except for those controllers which are not optional which are sometimes located on the motherboard. • The monitor is not optional, but the video controller is sometimes located on a plug-in board to allow the user to choose the type of display. Logical Structure of a PC Buses The job of a controller is to control its I/O device and handle bus access for it. A controller that reads or writes data to or from memory without CPU intervention is said to be performing Direct Memory Access (DMA). When the transfer is finished, the controller issues an interrupt, forcing the CPU to switch from the running program to an interrupt handler. After this, the OS can resume the suspended job. Buses The bus is used by both I/O controllers and the CPU. When both want to use the bus, a bus arbiter decides who will go next. In general, I/O devices are given precedence since disks and other moving devices cannot be stopped without losing data. When no I/O is in progress, the CPU has all the bus cycles for itself to reference memory. When some I/O device is also running, it will request and be granted the bus. This is called cycle stealing and it slows down the computer. Buses As CPUs, memories and I/O devices became faster, the bus could no longer handle the load. Replacing the bus every time it became overloaded with a higher capacity one would cause the old peripherals to become useless. • Therefore many manufacturers stayed with the old ISA (Industry Standard Architecture) bus. Eventually companies started developing computers with multiple buses including the ISA, the backward-compatible EISA (Extended ISA), and now PCI (Peripheral Component Interface). PC with PCI and ISA Buses Keyboards On PCs, when a key is depressed, an interrupt is generated and the keyboard interrupt handler is started. The interrupt handler reads a hardware register inside the keyboard controller to get the number of the key depressed. When a key is released, a second interrupt is generated. This allow for multikey sequences (including SHIFT, CTRL, and ALT), which are handled entirely in software. CRT Monitors A monitor is a box containing a CRT (Cathode Ray Tube) and its power supplies. The CRT contains a gun that can shoot an electron beam against a phosphorescent screen near the front of the tube. • Color monitors have three electron guns for read, blue and green. • The CRT is a raster scan device since it produces an image line by line. • A full-screen image is repainted 30 to 60 times a second. CRT Monitors Flat Panel Displays CRTs are too bulky and heavy to be used in notebook computers, so a technology called LCD (Liquid Crystal Display) is used. Using an applied electric field, the molecular alignment of the liquid crystals, and hence the optical properties, can be changed. The crystal is sealed between two glass plates. • Passive matrix displays use a two-dimensional grid of wires to generate the voltage required. • Active matrix displays contain a tiny switching element at each pixel position. LCD Screens Character-Map Terminals Three kinds of terminals are in common use: • Character-map terminals • Bit-map terminals • RS-232-C terminals A character-map terminal is shown on the following slide. To display characters, the CPU copies them to the video memory in alternate bytes. Associated with each character is an attribute byte that describes how that character is to be displayed. Character-Map Terminals • Attributes include color, intensity, blinking, etc. A screen of 25 by 80 characters requires 4000 bytes of video memory, 2000 for the characters and 2000 for the attributes. The video board fetches characters from the video RAM, a line at a time, and generates the necessary signal to drive the monitor. Because the board outputs a video signal, the monitor must be within a few meters of the computer to prevent distortion. PC Video Output Bit-map Terminals A variation on this idea is to have the screen regarded not as a 25 by 80 array of characters, but as an array of picture elements called, pixels. The general idea is the same, except that the video RAM is seen as a big bit array. To draw characters, for example, the software might allocate a 9 by 14 rectangle for each character and fill in the necessary bits to make the character appear. Bit-map Terminals Bit-map terminals are typically used to support displays containing several windows. Bit-map terminals require a considerable amount of video RAM. The most common sizes are 640x480 (VGA), 800x600 (SVGA), 1024x768 (XVGA), and 1280x960. Each of these has an aspect ratio of 4:3. To get true color, 8 bits are needed for each of the three primary colors, or 3 bytes/pixel. Thus, 1024x768 requires 2.3 MB of video RAM. Bit-map Terminals To lessen this requirement, some computers use an 8-bit number to indicate the desired color. This number is then used as an index into a hardware table called the color palette that contains 256 entries, each holding a 24-bit RGB value. This is called indexed color. It reduces the required RAM by 2/3, but allows only 256 colors. Usually each window on the screen has its own mapping. The palette is changed when a new window gains focus. Bit-map Terminals To display full-screen full-color multimedia on a 1024x768 display requires copying 2.3 MB of data to the video RAM for every frame. For full-motion video, 25 frame/sec is needed for a total data rate of 57.6 MB/sec. • This is too much for an (E)ISA bus, so highperformance video cards need to be PCI cards. RS-232-C Terminals To allow terminals to be used with many computer systems, a standard computerterminal interface called RS-232-C has been developed. When the computer and terminal are far apart, the only practical way to connect them is over the telephone system. The telephone system, however, is not capable of transmitting the signals required by RS-232-C, so a device known as a modem (modulator-demodulator) has to be used. RS-232-C Terminals To communicate, the terminal and computer each contain a chip called a UART (Universal Asynchronous Receiver Transmitter), as well logic to access the bus. To display a character, the computer takes a word from memory and presents it to the UART which shifts it onto the RS-232-C cable 1 bit at a time. It also adds a start bit and a stop bit to each character to delimit the character. RS-232-C Terminal Mice • A mouse is used as a pointing device. The mouse can have one, two, or three buttons. • Three kinds of mice have been produced: mechanical mice optical mice electromechanical mice • The optical mouse is used on top of a special plastic pad containing a rectangular grid of lines. A common arrangement is to have the mouse send a sequence of three bytes every time the mouse moves a certain minimum distance (e.g. 0.01 inch). Byte 1 gives movement in the x direction, 2 in the y direction and 3 gives the state of the mouse buttons. Mouse Printers The cheapest kind of printer is the matrix printer, in which a print head of between 7 and 24 lines is scanned across each page. • Print quality can be increased by two techniques: use more needles have the dots overlap Inkjet printers have a movable print head which holds an ink cartridge and is swept horizontally across the paper • An ink droplet inside a nozzle is heated to the boiling point, explodes out the front of the nozzle. Matrix Printers Laser Printers The heart of a laser printer is a rotating precision drum. • The drum is charged to 1000 volts and coated with a photosensitive material. • Light from a laser is scanned along the length of the drum. The light beam is modulated to produce a pattern of light and dark spots. The spots where the beam hits lose their electrical charge. • The drum rotates until the first line of dots reaches the toner, a reservoir of electrostatically sensitive black powder. The toner is attracted to the charged dots, forming an image of that line. Laser Printers Laser Printers Color Printers Nearly all color printing systems use four inks: cyan, magenta, yellow, and black. These systems are called CMYK printers. • In theory, CMY should be enough, but due to impurities in the ink, it is difficult to produce a pure black. • The lowest cost color printers are color ink jet printers which work with four ink cartridges. • Solid ink jet printers use a waxy ink which is melted into hot ink reservoirs. The ink is sprayed onto the paper where is solidifies and is fused with the paper by forcing it between two hard rollers. Color Printers • The color laser printer has four different toners (for C, M, Y, and K) on which separate images are laid down. • The wax printer has a wide ribbon of of four-color wax that is segmented into page-size bands. Thousands of heating elements melt the wax as the paper moves under it. The wax is fused to the paper. • In dye sublimation printers, a carrier containing the CMYK dyes passes over the thermal print head containing thousands of programmable heating elements. The dyes are vaporized instantly and are absorbed by a special paper close by. Modems A raw telephone line is not suitable for transmitting computer signals since two-level signals suffer distortion leading to errors. A pure sine wave called a carrier can be transmitted with little distortion, however. By varying the amplitude, frequency, or or phase of the sine wave, a sequence of 0s or 1s can be transmitted. This process is called modulation. • In amplitude modulation, two different voltage levels are used for 0 and 1. Modems • In frequency modulation, the voltage level is constant, but the carrier frequency is different for 1 and 0. • In phase modulation, the phase of the carrier is reversed 180 degrees when the data switch from 0 to 1, or 1 to 0. More sophisticated phase-modulated schemes are also possible. • Modems accept 8-bit characters and serialize them for transmission on the phone lines in amplitude-, frequency-, or phase-modulated form. Modems ISDN ISDN (Integrated Services Digital Network) is a standard for digital telephony. A digital ISDN line holds two independent digital channels at 64,000 bits/sec each plus a signaling channel at 16,000 bits/sec. ISDN allows quicker connection, requires no modem, and is more reliable. Specialized equipment must be installed to use ISDN. ISDN Character Codes Each computer has a set of characters that it uses. In order to store the characters in the computer, each one is assigned a number. The mapping of characters onto integers is called a character code. • One widely used code is ASCII (American Standard Code for International Interchange). Each ASCII character has 7 bits, allowing for 128 characters. • Non-English languages work less well with ASCII. For this reason, a new system called UNICODE is being introduced. UNICODE uses 16 bits/character.