The document outlines various input/output (I/O) methods for data transfer between microcomputers and external devices, categorizing them into Virtual I/O and Physical I/O. It details Programmed I/O, Interrupt Driven I/O, and Direct Memory Access (DMA), explaining their operations, advantages, and disadvantages. Each method has specific use cases, with Programmed I/O being simple but CPU-intensive, Interrupt Driven I/O being efficient for asynchronous devices, and DMA allowing data transfer without CPU involvement for high data rates.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
16 views16 pages
Input Output Methods
The document outlines various input/output (I/O) methods for data transfer between microcomputers and external devices, categorizing them into Virtual I/O and Physical I/O. It details Programmed I/O, Interrupt Driven I/O, and Direct Memory Access (DMA), explaining their operations, advantages, and disadvantages. Each method has specific use cases, with Programmed I/O being simple but CPU-intensive, Interrupt Driven I/O being efficient for asynchronous devices, and DMA allowing data transfer without CPU involvement for high data rates.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16
INPUT/OUTPUT METHODS
INPUT/OUTPUT METHODS/TECHNIQUES
• The technique of data transfer between a
microcomputer and an external device is called input/output (I/O). • Peripherals are the I/O devices that connected to a microcomputer and provide an efficient means of communication between the microcomputer and the outside world. • I/O methods are divided into two; Virtual I/O and Physical I/O. • VIRTUAL/DIRECT I/O • Data transfer between the microcomputer and the I/O device occurs by calling I/O routines provided by the operating system. It is only suitable for some I/O devices especially simple ones such as LEDs, simple switches. The device is always ready for data transfer thus no checking of status is required. • Demerit-limited usage PHYSICAL I/O • There are three ways of transferring data between a microcomputer and physical I/O devices: • Programmed I/O • Interrupt I/O • Direct memory access. PROGRAMMED I/O • The microprocessor executes a program to perform all data transfers between the microcomputer and the external device (the CPU has direct control over I/O) i.e. • Sensing status • Read/write commands • Transferring data • The device indicates readiness to transfer data. It has a flag that can be interrogated by the CPU. The CPU under program control, reads (polls) the status waiting for the device to indicate readiness for transfer of data. This is easy to understand and implement though it wastes CPU time. Programmed I/O is divided into two: Unconditional I/O when the CPU can send data to the peripheral device at any time i.e. the external device is always ready for data transfer. Conditional I/O, the microprocessor outputs data to an external device via handshaking. This means that data transfer occurs via the exchange of control signals between the microprocessor and an external device. Handshaking begins when one device sends a message to another device indicating that it wants to establish a communications channel. The two devices then send several messages back and forth that enable them to agree on a communications protocol. Handshaking occurs before the transfer of data or any other communication and just after the establishment of the physical channel between the two entities. Handshaking is helpful in checking the quality and speed of the transmission and also the necessary authority needed for same. A disadvantage of conditional programmed I/O is that the microcomputer needs to check the status bit (a conversion complete signal of the A/D converter) by waiting in a loop when the CPU has to check the status of the external device before data transfer. The CPU waits for I/O module to complete operation thus CPU time is wasted. Operation of Polled I/O • CPU requests I/O operation • I/O module performs operation • I/O module sets status bits • CPU checks status bits periodically • I/O module does not inform CPU directly • I/O module does not interrupt CPU • CPU may wait or come back later. • CPU issues address- identifies the module if more than one • CPU issues command for control, test or read/write Programmed I/O addressing Standard I/O or port I/O (called isolated I/O) • Separate address spaces and thus requires I/O or memory select lines(IO/ M pin) As a result the IO/M pin is active when an I/O port is referred and low when memory address is referred. • Need I/O or memory select lines —Special commands for I/O • Limited spaces PIO addressing Memory-mapped I/O • The microprocessor does not use the IO / M control pin. Instead, the microprocessor uses an unused address pin to distinguish between memory and I/O. • Devices and memory share an address space and thus large selection of memory access commands is available. • No special commands for I/O • Large selection of memory access commands available PIO Good for well-defined periodic slow devices Poor for input devices and non-periodic devices • Wastes CPU time due to polling INTERRUPT DRIVEN I/O
•Interrupt I/O is a device-initiated I/O transfer.
•An external device can force the microprocessor to stop executing the current program temporarily so that it can execute another program known as an interrupt service routine (ISR). After completing this program, a return from interrupt instruction can be executed at the end of the service routine to return control at the right place in the main program. Operation of interrupt driven I/O • External device activates the interrupt (INTR) pin of the processor chip. The device has an output signal that is connected to a special signal of the CPU. The device asserts the signal when it is ready to transfer data (interrupt request) • The CPU may ignore the request-the interrupt is said to be masked. However some CPUs have a special interrupt that is non maskable for very important interrupts such as power failure, alarms etc • The microcomputer completes the current instruction and saves the contents of the program counter and the status register in the stack. • The microcomputer then loads an address into the program counter to branch to a subroutine-like program called the interrupt service routine(ISR) • ISR is executed • The last instruction of the ISR is a RETURN, which loads the addresses saved in the stack before going to the ISR into the PC. Advantages/disadvantages of Interrupt Driven I/O • Overcomes CPU waiting • No repeated CPU checking of device • I/O module interrupts when ready • Good for non –period, asynchronous devices • Requires extra programming to set up the interrupt and ISR • Can be difficult to test and debug e.g. keyboard input DIRECT MEMORY ACCESS (DMA)
• This is when data can be transferred between
microcomputer memory and an external device such as the hard disk, without microprocessor (CPU) involvement. A special chip called the DMA controller is typically used with the microprocessor for transferring data. Key points on DMA
• Requires a DMA controller
• Data is transferred without the CPU being involved • CPU programs the DMAc to: • Set transfer direction-input or output • Start address in memory • Number of bytes to transfer • Copy from memory to memory • DMAc performs the transfer between the memory and the I/O device. • DMAc interrupts the CPU on completion Advantages/disadvantages of DMA
• Requires additional hardware
• Good for transferring large blocks of data • Good for high data rates e.g. hard disks, network card