Here is explanation of Modes of Transfer:
- The binary information that is received from an external device is usually stored in the memory unit. The information that is transferred from the CPU to the external device is originated from the memory unit. CPU merely processes the information but the source and target is always the memory unit. Data transfer between CPU and the I/O devices may be handled in a variety of modes.
Data transfer to and from the peripherals may be done in any of the three possible ways:
1.)Programmed I/O:
- In Programmed I/O mode of data transfer the operations are the results in I/O instructions which is part of computer program. Each data transfer is initiated by a instruction in the program. Normally the transfer is from a CPU register to peripheral device or vice-versa.
- Once the data is initiated the CPU starts monitoring the interface to see when next transfer can made. The instructions of the program keep close tabs on everything that takes place in the interface unit and the I/O devices.
Example of Programmed I/O:
The transfer of data requires three instructions:
- Read the status register.
- Check the status of the flag bit and branch to step 1 if not set or to step 3 if set.
- Read the data register.
In this technique CPU is responsible for executing data from the memory for output
and storing data in memory for executing of Programmed I/O as shown in Flowchart:
2.) Interrupt- initiated I/O:
- In Programmed I/O, we saw that the CPU is kept busy unnecessarily. We can avoid this situation by using an interrupt-Initiated I/O method for data transfer.
- The interrupt facilities and special commands inform the interface for issuing an interrupt request signal as soon as the data is available from any device. In the meantime, the CPU can execute other programs, and the interface will keep monitoring the i/O device.
- Whenever it determines that the device is ready for transferring data interface initiates an interrupt request signal to the CPU.
- As soon as the CPU detects an external interrupt signal, it stops the program it was already executing, branches to the service program to process the I/O transfer, and returns to the program it was initially running.
Working of CPU in the term of interrupts:
- CPU issues read command.
- It starts executing other programs.
- Check for interruptions at the end of each instruction cycle.
- On interruptions:-
- Process interrupt by fetching data and storing it.
- See operation system notes.
- Starts working on the program it was executing.
3.) Direct memory access( DMA):
- The data transfer between any fast storage media like a memory unit and a magnetic disk gets limited with the speed of the CPU.
- Thus it will be best to allow the peripherals to directly communicate with the storage using the memory buses by removing the intervention of the CPU. This mode of transfer of data technique is known as Direct Memory Access (DMA).
- During Direct Memory Access, the CPU is idle and has no control over the memory buses. The DMA controller takes over the buses and directly manages data transfer between the memory unit and I/O devices.
Bus Request:
• We use bus requests in the DMA controller to ask the CPU to relinquish the control buses.
Bus grant:
 • CPU activates bus grant to inform the DMA controller that DMA can take control of the control buses. Once the control is taken, it can transfer data in many ways.
Software Considerations:
Software considerations in microprocessor design refer to the aspects of microprocessor architecture and functionality that have implications for software development, execution, and performance.
• Software control of input and output equipment is a complex undertaking for this reason I/O routines for standard peripherals are provided by the manufacturer as part of the computer system.
I/O Routines:
I/O (Input/Output) routines refer to the functions or procedures within a computer program responsible for handling input and output operations.
• I/O Routines typically include functions for tasks such as reading data from input sources (e.g., keyboard, files) and writing data to output destinations (e.g., displays, printers).
I/O routines may involve tasks such as:
‣ Reading input from devices:
This includes reading data entered via keyboards, mouse clicks, or data received from other sources such as files or network connections.
‣ Writing output to devices:
This involves displaying data on screens, printing data to printers, saving data to files, or sending data over a network.
‣ Managing device communication:
This includes opening and closing connections to devices, checking for errors during data transfer, and handling interruptions or exceptions.
‣ Buffering:
To improve performance, many I/O routines use buffers to temporarily store data before transferring it to or from external devices.