The functions of interfaces can be divided into two categories: Enable the auxiliary circuit required by the CPU to work normally through these auxiliary circuits, so that the CPU gets the clock signal or receives multiple interrupt requests from external signals; the input and output interfaces enable the CPU to receive or receive information from external devices.
Interface functions: Addressing, input and output, data conversion, and contact functions (contact CPU and peripherals)
Three types of signals between CPU and input/output devices: data, status, and control information. The three types of information are transmitted through the data bus. In the interface, the three types of information enter three different registers: data register, Status Register, and control register.
Each interface contains a set of registers-I/O port and its port address.
The I/O port compilation methods include the uniform addressing with memory and independent addressing with I/O Ports.
Data transmission between CPU and peripherals
Unconditional Transfer Mode
This method is also called synchronization mode and is rarely used. It can be applied only when the time of various actions in the external control process is fixed and is known. When transmitting information in this way, peripherals must always be ready, so you do not have to query the status of peripherals. Its advantage is thatProgramSimple, hardware and software are saved, but the status of peripherals must be known; otherwise, errors may occur.
Query Method
Query input: Enter the peripheral data and provide the prepared status. Check the CPU read status and read the information.
Query output: The device reads status information and outputs data information.
The following registers are required for query: data input, data output, and Status Register.
Interrupt mode
Interruption refers to the process that causes the CPU to pause the running of the current program, transfer it to the processing of the event, and return to the interrupted place of the original program after the processing is completed.
When the CPU runs the main program, it does not care about the peripheral status. When the peripheral needs services, the peripheral sends an interrupt request, and the CPU response is interrupted to provide services for the peripheral.
The fundamental difference between the interrupt mode and query mode: the query mode is pre-scheduled in the time sequence of the event, and the time when the interrupt mode event occurs is random.
DMA mode
Process: The interface sends a DMA request to the DMA controller. The DMA controller sends a bus request and obtains the bus response signal sent by the CPU to obtain the control of the bus; the content of the address register in the DMA controller is sent to the address bus. The DMA controller sends a response DMA transmission signal to the interface, notifying the interface to send the data to the data bus; the data is sent to the memory unit specified by the address bus; the value of the address register is plus one.
The DMA method requires the participation of the DMA controller without the involvement of the CPU. The interface directly transmits high-speed data with the memory.